can anyone tell me how can we use the local system files. i dont wnat to use a pdf url or link can someone tell me how can i use the local or give the path to the system files ??
here is my code but i dont think its working fine.
import typer
from phi.agent import Agent
from phi.tools.csv_tools import CsvTools
from pathlib import Path
from phi.agent import Agent, RunResponse
from phi.model.google import Gemini
from phi.knowledge.csv import CSVKnowledgeBase
from phi.vectordb.pgvector import PgVector
import os
from dotenv import load_dotenv
load_dotenv()
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
GOOGLE_ENGINE_ID = os.getenv("GOOGLE_ENGINE_ID")
# Define the path to the local CSV file
csv_name = "HousingData.csv"
csv = Path(__file__).parent.joinpath(csv_name)
csv.parent.mkdir(parents=True, exist_ok=True)
knowledge_base = CSVKnowledgeBase(
path="data/csv",
# Table name: ai.csv_documents
vector_db=PgVector(
table_name="csv_documents",
db_url="postgresql+psycopg://ai:ai@localhost:5532/ai",
),
)
# Initialize the agent with the local CSV file
agent = Agent(
tools=[CsvTools(csvs=csv_name, read_csvs=True)],
model=Gemini(id="gemini-2.0-flash-exp"),
markdown=True,
show_tool_calls=True,
instructions=[
"You are an expert data scientist focused on providing comprehensive analysis of data. Follow these steps:",
],
)
# Run the CLI application
agent.cli_app(stream=False)
Hi @pschoudhary
Thank you for reaching out and using Phidata! We’re currently easing into the New Year, so the team might take a bit longer than usual to respond, but we’ll aim to get back to you within 24 hours. I’ve also tagged the relevant engineers to assist you with your query.
If this is urgent, please let us know, and we’ll do our best to prioritize it.
Thanks for your understanding and patience, and Happy New Year!
@pschoudhary you can use Combined Knowledge Base where you can put CSVKnowledgeBase and PDFKnowledgeBase mentioning the local files as paths. Here is the doc for it
you are running PgVector on the docker. You can try to use other vector databases that are in memory so it uses a local file system.
ChromaDB is a good option