-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update-exa-phi-2406
- Loading branch information
Showing
31 changed files
with
343 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
This recipe shows how to use personalized memories and summaries in an agent. | ||
Steps: | ||
1. Run: `./cookbook/scripts/run_pgvector.sh` to start a postgres container with pgvector | ||
2. Run: `pip install anthropic sqlalchemy 'psycopg[binary]' pgvector` to install the dependencies | ||
3. Run: `python cookbook/models/anthropic/memory.py` to run the agent | ||
""" | ||
|
||
from agno.agent import Agent, AgentMemory | ||
from agno.memory.db.postgres import PgMemoryDb | ||
from agno.models.anthropic import Claude | ||
from agno.storage.agent.postgres import PostgresAgentStorage | ||
from rich.pretty import pprint | ||
|
||
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai" | ||
agent = Agent( | ||
model=Claude(id="claude-3-5-sonnet-20241022"), | ||
# Store the memories and summary in a database | ||
memory=AgentMemory( | ||
db=PgMemoryDb(table_name="agent_memory", db_url=db_url), | ||
create_user_memories=True, | ||
create_session_summary=True, | ||
), | ||
# Store agent sessions in a database | ||
storage=PostgresAgentStorage( | ||
table_name="personalized_agent_sessions", db_url=db_url | ||
), | ||
# Show debug logs so, you can see the memory being created | ||
# debug_mode=True, | ||
) | ||
|
||
# -*- Share personal information | ||
agent.print_response("My name is john billings?", stream=True) | ||
|
||
# -*- Share personal information | ||
agent.print_response("I live in nyc?", stream=True) | ||
|
||
# -*- Share personal information | ||
agent.print_response("I'm going to a concert tomorrow?", stream=True) | ||
|
||
# Ask about the conversation | ||
agent.print_response( | ||
"What have we been talking about, do you know my name?", stream=True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
This recipe shows how to use personalized memories and summaries in an agent. | ||
Steps: | ||
1. Run: `./cookbook/scripts/run_pgvector.sh` to start a postgres container with pgvector | ||
2. Run: `pip install cohere sqlalchemy 'psycopg[binary]' pgvector` to install the dependencies | ||
3. Run: `python cookbook/models/cohere/memory.py` to run the agent | ||
""" | ||
|
||
from agno.agent import Agent, AgentMemory | ||
from agno.memory.db.postgres import PgMemoryDb | ||
from agno.models.cohere import Cohere | ||
from agno.storage.agent.postgres import PostgresAgentStorage | ||
|
||
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai" | ||
agent = Agent( | ||
model=Cohere(id="command-r-08-2024"), | ||
# Store the memories and summary in a database | ||
memory=AgentMemory( | ||
db=PgMemoryDb(table_name="agent_memory", db_url=db_url), | ||
create_user_memories=True, | ||
create_session_summary=True, | ||
), | ||
# Store agent sessions in a database | ||
storage=PostgresAgentStorage( | ||
table_name="personalized_agent_sessions", db_url=db_url | ||
), | ||
# Show debug logs so, you can see the memory being created | ||
# debug_mode=True, | ||
) | ||
|
||
# -*- Share personal information | ||
agent.print_response("My name is john billings?", stream=True) | ||
|
||
# -*- Share personal information | ||
agent.print_response("I live in nyc?", stream=True) | ||
|
||
# -*- Share personal information | ||
agent.print_response("I'm going to a concert tomorrow?", stream=True) | ||
|
||
# Ask about the conversation | ||
agent.print_response( | ||
"What have we been talking about, do you know my name?", stream=True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
This recipe shows how to use personalized memories and summaries in an agent. | ||
Steps: | ||
1. Run: `./cookbook/scripts/run_pgvector.sh` to start a postgres container with pgvector | ||
2. Run: `pip install mistralai sqlalchemy 'psycopg[binary]' pgvector` to install the dependencies | ||
3. Run: `python cookbook/models/mistral/memory.py` to run the agent | ||
""" | ||
|
||
from agno.agent import Agent, AgentMemory | ||
from agno.memory.db.postgres import PgMemoryDb | ||
from agno.models.mistral.mistral import MistralChat | ||
from agno.storage.agent.postgres import PostgresAgentStorage | ||
|
||
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai" | ||
agent = Agent( | ||
model=MistralChat(id="mistral-large-latest"), | ||
# Store the memories and summary in a database | ||
memory=AgentMemory( | ||
db=PgMemoryDb(table_name="agent_memory", db_url=db_url), | ||
create_user_memories=True, | ||
create_session_summary=True, | ||
), | ||
# Store agent sessions in a database | ||
storage=PostgresAgentStorage( | ||
table_name="personalized_agent_sessions", db_url=db_url | ||
), | ||
# Show debug logs so, you can see the memory being created | ||
# debug_mode=True, | ||
) | ||
|
||
# -*- Share personal information | ||
agent.print_response("My name is john billings?", stream=True) | ||
|
||
# -*- Share personal information | ||
agent.print_response("I live in nyc?", stream=True) | ||
|
||
# -*- Share personal information | ||
agent.print_response("I'm going to a concert tomorrow?", stream=True) | ||
|
||
# Ask about the conversation | ||
agent.print_response( | ||
"What have we been talking about, do you know my name?", stream=True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
This recipe shows how to use personalized memories and summaries in an agent. | ||
Steps: | ||
1. Run: `./cookbook/scripts/run_pgvector.sh` to start a postgres container with pgvector | ||
2. Run: `pip install ollama sqlalchemy 'psycopg[binary]' pgvector` to install the dependencies | ||
3. Run: `python cookbook/models/ollama/memory.py` to run the agent | ||
""" | ||
|
||
from agno.agent import Agent, AgentMemory | ||
from agno.memory.db.postgres import PgMemoryDb | ||
from agno.models.ollama.chat import Ollama | ||
from agno.storage.agent.postgres import PostgresAgentStorage | ||
|
||
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai" | ||
agent = Agent( | ||
model=Ollama(id="qwen2.5:latest"), | ||
# Store the memories and summary in a database | ||
memory=AgentMemory( | ||
db=PgMemoryDb(table_name="agent_memory", db_url=db_url), | ||
create_user_memories=True, | ||
create_session_summary=True, | ||
), | ||
# Store agent sessions in a database | ||
storage=PostgresAgentStorage( | ||
table_name="personalized_agent_sessions", db_url=db_url | ||
), | ||
# Show debug logs so, you can see the memory being created | ||
# debug_mode=True, | ||
) | ||
|
||
# -*- Share personal information | ||
agent.print_response("My name is john billings?", stream=True) | ||
|
||
# -*- Share personal information | ||
agent.print_response("I live in nyc?", stream=True) | ||
|
||
# -*- Share personal information | ||
agent.print_response("I'm going to a concert tomorrow?", stream=True) | ||
|
||
# Ask about the conversation | ||
agent.print_response( | ||
"What have we been talking about, do you know my name?", stream=True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.