Documentation Index
Fetch the complete documentation index at: https://docs-v1.agno.com/llms.txt
Use this file to discover all available pages before exploring further.
Code
cookbook/models/vllm/memory.py
Ensure Postgres database is running.
You are viewing v1 docs. For the latest documentation, visit docs.agno.com
Documentation Index
Fetch the complete documentation index at: https://docs-v1.agno.com/llms.txt
Use this file to discover all available pages before exploring further.
from agno.agent import Agent
from agno.memory.v2.db.postgres import PostgresMemoryDb
from agno.memory.v2.memory import Memory
from agno.models.vllm import vLLM
from agno.storage.postgres import PostgresStorage
DB_URL = "postgresql+psycopg://ai:ai@localhost:5532/ai"
agent = Agent(
model=vLLM(id="microsoft/Phi-3-mini-128k-instruct"),
memory=Memory(
db=PostgresMemoryDb(table_name="agent_memory", db_url=DB_URL),
),
enable_user_memories=True,
enable_session_summaries=True,
storage=PostgresStorage(
table_name="personalized_agent_sessions",
db_url=DB_URL,
),
)
# Share personal details; the agent should remember them.
agent.print_response("My name is John Billings.", stream=True)
print("Current memories →")
pprint(agent.memory.memories)
print("Current summary →")
pprint(agent.memory.summaries)
agent.print_response("I live in NYC.", stream=True)
print("Memories →")
pprint(agent.memory.memories)
print("Summary →")
pprint(agent.memory.summaries)
agent.print_response("I'm going to a concert tomorrow.", stream=True)
print("Memories →")
pprint(agent.memory.memories)
print("Summary →")
pprint(agent.memory.summaries)
# Ask the agent to recall
agent.print_response(
"What have we been talking about, do you know my name?", stream=True
)
Create a virtual environment
Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Start vLLM server
vllm serve microsoft/Phi-3-mini-128k-instruct \
--dtype float32 \
--enable-auto-tool-choice \
--tool-call-parser pythonic
Was this page helpful?