mirror of
https://github.com/agno-agi/agno.git
synced 2026-10-12 02:10:54 +00:00
## Summary add `csv` and `csv url` reader and kb with tests ## Type of change - [ ] Bug fix (If applicable, issue number: #____) - [x] New feature - [ ] Breaking change - [ ] Improvement - [ ] Model update - [ ] Other: _____________________ --- ## Checklist - [x] Code complies with style guidelines - [x] Ran format/validation scripts (`./scripts/format.sh` and `./scripts/validate.sh`) - [x] Self-review completed - [x] Documentation updated (comments, docstrings) - [x] Examples and guides: Relevant cookbook examples have been included or updated (if applicable) - [x] Tested in clean environment - [x] Tests added/updated (if applicable) --- ## Additional Notes Add any important context (deployment instructions, screenshots, security considerations, etc.) --------- Co-authored-by: Dirk Brand <[email protected]>
28 lines
711 B
Python
28 lines
711 B
Python
from pathlib import Path
|
|
|
|
from agno.agent import Agent
|
|
from agno.knowledge.csv import CSVKnowledgeBase
|
|
from agno.vectordb.pgvector import PgVector
|
|
|
|
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
|
|
|
|
knowledge_base = CSVKnowledgeBase(
|
|
path=Path("data/csvs"),
|
|
vector_db=PgVector(
|
|
table_name="csv_documents",
|
|
db_url=db_url,
|
|
),
|
|
num_documents=5, # Number of documents to return on search
|
|
)
|
|
# Load the knowledge base
|
|
knowledge_base.load(recreate=False)
|
|
|
|
# Initialize the Agent with the knowledge_base
|
|
agent = Agent(
|
|
knowledge=knowledge_base,
|
|
search_knowledge=True,
|
|
)
|
|
|
|
# Use the agent
|
|
agent.print_response("Ask me about something from the knowledge base", markdown=True)
|