Key Features
Process PDFs, documents, spreadsheets, images, and web content
Multiple strategies for optimal text segmentation
Vector-based search with optional reranking
User, agent, and run-specific knowledge scoping
Optional relationship extraction and storage
Automatic quality assessment for stored knowledge
Quick Start
Level 2 — Dict (inline config)
Use a dict to pick a vector store while still passing sources inline.
How It Works
| Phase | What happens |
|---|---|
| 1. Add | Documents are chunked, embedded, and stored in the vector store via knowledge.add() |
| 2. Search | knowledge.search(query) embeds the query and returns top-k similar chunks |
| 3. Retrieve | Agent injects the chunks as context before calling the LLM |
| 4. Generate | LLM answers using the retrieved knowledge; responses are grounded in your data |
Configuration Options
KnowledgeConfig SDK Reference
Full parameter reference for KnowledgeConfig
| Option | Type | Default | Description |
|---|---|---|---|
sources | list[str] | [] | Files, directories, or URLs to index |
embedder | str | "openai" | Embedder to use for vector encoding |
chunking_strategy | str | "semantic" | "fixed" / "semantic" / "sentence" / "paragraph" |
retrieval_k | int | 5 | Number of chunks to retrieve per query |
rerank | bool | False | Apply reranking to improve result order |
Basic Configuration
Advanced Configuration with Graph Store
Choosing Sources and Chunking
Pick a source type, then a chunking strategy that matches your content.Chunking Strategies
Document Processing
Supported File Types
- PDF (.pdf)
- Word (.doc, .docx)
- Text (.txt)
- Markdown (.md)
- RTF (.rtf)
- Excel (.xls, .xlsx)
- CSV (.csv)
- JSON (.json)
- XML (.xml)
- Images (OCR)
- HTML pages
- Web URLs
- YouTube videos
Processing Options
Search Features
Basic Search
Advanced Search Options
Memory Integration
When used with agents, knowledge automatically integrates with memory:Graph Store Features
Graph stores add relationship extraction and connection queries on top of semantic search.Configuration
Relationship Queries
Best Practices
Match chunk size to your query complexity
Match chunk size to your query complexity
Use smaller chunks (100-200 tokens) for precise fact retrieval. Use larger chunks (500-1000 tokens) when answers need more context. Semantic chunking works best for research papers and long-form documents.
Separate collections by domain
Separate collections by domain
Use a different
collection_name per knowledge domain (e.g., product_docs, legal_contracts). This prevents cross-contamination and allows targeted filtering by domain.Use metadata for filtering
Use metadata for filtering
Add
metadata when indexing documents to enable filters= in searches. Filter by category, year, or author to narrow results without changing query text.Enable reranking for higher precision
Enable reranking for higher precision
Set
rerank=True in kb.search() when you need top-quality results. Reranking retrieves more candidates then scores them for relevance — best for Q&A and research assistants.Example: Research Assistant
Related
RAG
Build retrieval-augmented generation pipelines
Vector Store
Store and query embeddings with a pluggable, namespace-aware backend

