import asyncio
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.vectordb.lancedb import LanceDb
vector_db = LanceDb(
table_name="vectors",
uri="tmp/lancedb",
)
knowledge = Knowledge(
name="Basic SDK Knowledge Base",
description="Agno 2.0 Knowledge Implementation with LanceDB",
vector_db=vector_db,
)
agent = Agent(knowledge=knowledge)
if __name__ == "__main__":
asyncio.run(
knowledge.add_content_async(
name="Recipes",
url="https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf",
metadata={"doc_type": "recipe_book"},
)
)
asyncio.run(
agent.aprint_response("List down the ingredients to make Massaman Gai", markdown=True)
)
Create a virtual environment
Terminal
and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Install libraries
pip install -U lancedb pypdf openai agno
Run Agent
python cookbook/knowledge/vector_db/lance_db/lance_db.py