Code
cookbook/agent_concepts/knowledge/vector_dbs/milvus_db/milvus_db_hybrid_search.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
You are viewing v1 docs. For the latest documentation, visit docs.agno.com
import typer
from agno.agent import Agent
from agno.knowledge.pdf_url import PDFUrlKnowledgeBase
from agno.vectordb.milvus import Milvus, SearchType
from rich.prompt import Prompt
vector_db = Milvus(
collection="recipes", uri="tmp/milvus.db", search_type=SearchType.hybrid
)
knowledge_base = PDFUrlKnowledgeBase(
urls=["https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"],
vector_db=vector_db,
)
def milvusdb_agent(user: str = "user"):
agent = Agent(
user_id=user,
knowledge=knowledge_base,
search_knowledge=True,
)
while True:
message = Prompt.ask(f"[bold] :sunglasses: {user} [/bold]")
if message in ("exit", "bye"):
break
agent.print_response(message)
if __name__ == "__main__":
# Comment out after first run
knowledge_base.load(recreate=True)
typer.run(milvusdb_agent)
Create a virtual environment
Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Was this page helpful?