What is a knowledge base?
A knowledge base stores and retrieves documents:- Documents are chunked and embedded
- Vector database stores embeddings for similarity search
- Agents can search the knowledge base with agentic RAG
Learn more about Mintlify
Enter your email to receive updates about new features and product releases.
Add RAG and document retrieval to your agents
from agno.agent import Agent
from agno.knowledge import Knowledge
from agno.vectordb.pgvector import PgVector
# Create knowledge base
knowledge = Knowledge(
path="docs/",
vector_db=PgVector(
table_name="agno_docs",
db_url="postgresql://localhost/agno"
)
)
# Load documents
knowledge.load(recreate=False)
# Create agent with knowledge
agent = Agent(
knowledge=knowledge,
search_knowledge=True,
add_knowledge_to_context=True
)
response = agent.run("What is Agno?")
from agno.knowledge import Knowledge
from agno.vectordb.chroma import ChromaDb
knowledge = Knowledge(
path="docs/",
vector_db=ChromaDb(
collection="docs",
path="./chroma_db"
)
)
knowledge.load()