Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkbrnd committed Feb 18, 2025
1 parent 578dbc6 commit c9a314e
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions libs/agno/tests/integration/model/openai/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
from pydantic import BaseModel, Field

from agno.agent import Agent, RunResponse # noqa
from agno.memory import AgentMemory
from agno.memory.classifier import MemoryClassifier
from agno.memory.db.sqlite import SqliteMemoryDb
from agno.memory.manager import MemoryManager
from agno.memory.summarizer import MemorySummarizer
from agno.models.openai import OpenAIChat
from agno.storage.agent.sqlite import SqliteAgentStorage
from agno.tools.duckduckgo import DuckDuckGoTools


def _assert_metrics(response: RunResponse):
Expand Down Expand Up @@ -140,3 +146,37 @@ def test_history():
assert len(agent.run_response.messages) == 6
agent.run("Hello 4")
assert len(agent.run_response.messages) == 8


def test_persistent_memory():
agent = Agent(
model=OpenAIChat(id="gpt-4o-mini"),
tools=[DuckDuckGoTools()],
markdown=True,
show_tool_calls=True,
telemetry=False,
monitoring=False,
instructions=[
"You can search the internet with DuckDuckGo.",
],
storage=SqliteAgentStorage(table_name="chat_agent", db_file="tmp/agent_storage.db"),
# Adds the current date and time to the instructions
add_datetime_to_instructions=True,
# Adds the history of the conversation to the messages
add_history_to_messages=True,
# Number of history responses to add to the messages
num_history_responses=15,
memory=AgentMemory(
db=SqliteMemoryDb(db_file="tmp/agent_memory.db"),
create_user_memories=True,
create_session_summary=True, # troublesome
update_user_memories_after_run=True,
update_session_summary_after_run=True,
classifier=MemoryClassifier(model=OpenAIChat(id="gpt-4o-mini")),
summarizer=MemorySummarizer(model=OpenAIChat(id="gpt-4o-mini")),
manager=MemoryManager(model=OpenAIChat(id="gpt-4o-mini")),
),
)

response = agent.run("What is current news in France?")
assert response.content is not None

0 comments on commit c9a314e

Please sign in to comment.