Quick Start
Simple Usage
Pass file paths or directories — the agent indexes on first run, then retrieves on each query:
How It Works
| Phase | What happens |
|---|---|
| 1. Index | Documents are chunked and embedded into the vector store on first access |
| 2. Retrieve | User query is embedded; top-k similar chunks are returned |
| 3. Generate | Retrieved context is injected before the LLM prompt; LLM answers from your data |
agent.retrieve("query") directly.
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
sources | List[str] | [] | Files, directories, or URLs |
embedder | str | "openai" | Embedding provider |
chunk_size | int | 1000 | Chunk size in tokens |
chunk_overlap | int | 200 | Overlap between chunks |
retrieval_k | int | 5 | Chunks retrieved per query |
retrieval_threshold | float | 0.0 | Minimum similarity score |
rerank | bool | False | Rerank retrieved chunks |
auto_retrieve | bool | True | Inject context automatically |
vector_store | dict | None | Backend provider config |
pip install "praisonaiagents[knowledge]"
Best Practices
Index documents before querying
Index documents before querying
Pass sources via
knowledge=["file.pdf"] at agent creation — first run indexes, later runs retrieve without re-indexing.Use specific questions
Use specific questions
Narrow questions retrieve better chunks than broad prompts like “tell me everything”.
Use persistent vector stores in production
Use persistent vector stores in production
Set
vector_store with Chroma path, Qdrant, or Pinecone — avoid in-memory stores for production.Combine RAG with tools for live data
Combine RAG with tools for live data
Pair
knowledge= with web tools when you need both static documents and real-time data.Related
Vector Store
Pluggable embedding storage
Knowledge
Sources and retrieval strategies

