Knowledge
Knowledge
Parameter reference for the Knowledge class: vector database, contents database, readers, and search options.
Knowledge is a class that manages knowledge bases for AI agents. It handles adding content, searching, and deleting content from the knowledge base.
| Parameter | Type | Default | Description |
|---|---|---|---|
name | Optional[str] | None | Name of the knowledge base |
description | Optional[str] | None | Description of the knowledge base |
vector_db | Optional[VectorDb] | None | Vector database for storing embeddings |
content_db | Optional[BaseDb or AsyncBaseDb] | None | Preferred constructor argument for the content metadata database. |
contents_db | Optional[BaseDb or AsyncBaseDb] | None | Supported read/write alias of content_db. If both arguments are supplied, they must be the same object. |
page_store | Optional[FileSystem] | None | Enables coordinated published pages; requires a PostgreSQL-backed filesystem and PgVector in the same logical database. |
page_search | Optional[PageSearchConfig] | None | Configuration for published-page retrieval. |
max_results | int | 10 | Maximum number of results to return from searches |
query_transformer | Optional[QueryTransformer] | None | Rewrites the query before it reaches the vector database, for example with HyDE. Rerankers still score against the original query. See Query Transformation. |
reranker | Optional[Reranker] | None | Reranks search results. Knowledge fetches a wider candidate pool sized by the reranker, reranks it, and returns the top max_results. See Reranking. |
isolate_vector_search | bool | False | When True, adds linked_to metadata during insert and filters by it during search. Enables isolation when multiple Knowledge instances share the same vector database. See Isolate Vector Search. |
content_sources | Optional[List[BaseStorageConfig]] | None | Cloud storage providers (S3, GCS, SharePoint, GitHub, Azure Blob) for loading remote content. See Cloud Storage Sources. |
readers | Optional[Dict[str, Reader]] | None | Dictionary of custom readers for processing content |
max_embedding_retries | int | 0 | Extra attempts when embedding fails during ingestion. Each retry re-embeds the whole document. Authentication and oversized-chunk failures are not retried. See content status. |
embedding_retry_backoff | float | 1.0 | Seconds before the first retry. The wait doubles on each later retry. |
The constructor is keyword-only. contents_db remains the canonical dataclass field for serialization and replacement; the alias is supported, not deprecated. Call setup() or asetup() before using a configured page store. See published-page methods and result types.