The PgVector Agent uses PgVector as Knowledge Base and Storage for the Agent.
Copy
Ask AI
from phi.agent import Agentfrom phi.storage.agent.postgres import PgAgentStoragefrom phi.knowledge.pdf import PDFUrlKnowledgeBasefrom phi.vectordb.pgvector import PgVectordb_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"agent = Agent( storage=PgAgentStorage(table_name="recipe_agent", db_url=db_url), knowledge_base=PDFUrlKnowledgeBase( urls=["https://phi-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"], vector_db=PgVector(table_name="recipe_documents", db_url=db_url), ), # Show tool calls in the response show_tool_calls=True, # Enable the agent to search the knowledge base search_knowledge=True, # Enable the agent to read the chat history read_chat_history=True,)# Comment out after first runagent.knowledge_base.load(recreate=False) # type: ignoreagent.print_response("How do I make pad thai?", markdown=True)