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.

ParameterTypeDefaultDescription
nameOptional[str]NoneName of the knowledge base
descriptionOptional[str]NoneDescription of the knowledge base
vector_dbOptional[VectorDb]NoneVector database for storing embeddings
content_dbOptional[BaseDb or AsyncBaseDb]NonePreferred constructor argument for the content metadata database.
contents_dbOptional[BaseDb or AsyncBaseDb]NoneSupported read/write alias of content_db. If both arguments are supplied, they must be the same object.
page_storeOptional[FileSystem]NoneEnables coordinated published pages; requires a PostgreSQL-backed filesystem and PgVector in the same logical database.
page_searchOptional[PageSearchConfig]NoneConfiguration for published-page retrieval.
max_resultsint10Maximum number of results to return from searches
query_transformerOptional[QueryTransformer]NoneRewrites the query before it reaches the vector database, for example with HyDE. Rerankers still score against the original query. See Query Transformation.
rerankerOptional[Reranker]NoneReranks search results. Knowledge fetches a wider candidate pool sized by the reranker, reranks it, and returns the top max_results. See Reranking.
isolate_vector_searchboolFalseWhen 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_sourcesOptional[List[BaseStorageConfig]]NoneCloud storage providers (S3, GCS, SharePoint, GitHub, Azure Blob) for loading remote content. See Cloud Storage Sources.
readersOptional[Dict[str, Reader]]NoneDictionary of custom readers for processing content
max_embedding_retriesint0Extra 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_backofffloat1.0Seconds 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.