Skip to main content
The KnowledgeBase class is the SDK surface for VectorShift’s managed retrieval store. Ingest files, URLs, folders, tables, or third-party integrations; query them with vector + keyword search, hybrid fusion, rerank, and optional QA — directly from Python, or via an Agent tool / a Pipeline node.
Prerequisites: Installed SDK · API key set · Python 3.10+.

Mental model

  • A KB is a named collection of items (files, URLs, table rows, integration records). Each item is chunked, embedded, and indexed once on ingest.
  • Ingestion is task-based: every add_files / add_urls / add_folder / add_tables call returns an IngestionTask you can poll, or use the _and_wait variant which blocks until COMPLETED.
  • Querying is a single surfacekb.query("text", top_k=…, filters=…, hybrid=…, rerank=…, qa=…). Pass kwargs or a single QueryConfig, never both. Returns a typed QueryResult.
  • Every method has an async variant (anew, aadd_files, aquery, ascroll, …).
Where Knowledge Bases live in your code. A KB is rarely the endpoint — most production deployments expose it through one of two paths: as an AgentTools.knowledge_base(id=kb.id, …) tool on a conversational Agent (the RAG-with-Agent pattern; see the RAG guide), or as a pipeline.add(...).knowledge_base(knowledge_base=kb, …) node inside a Pipeline (the RAG-pipeline pattern; see the rag-pipeline example).

Quick start

How to use a Knowledge Base

Ingestion sources

All methods return an IngestionTask with .task_id, .status, .item_ids, and (on failure) .error / .failed_uploads. The _and_wait variants poll until terminal status; the bare ones return immediately and let you poll via ingestion_status(task_id).

Recent additions

The KB surface was overhauled: ingestion is now task-based (add_files / add_urls / add_folder / add_tables + _and_wait variants), kb.query(...) returns a typed QueryResult TypedDict with result["chunks"] / result["citations"] / optional result.get("answer"), and querying takes either kwargs (top_k, filters, hybrid, rerank, qa) or a single QueryConfig. Items can be enumerated and filtered via list_items / scroll and re-organised via create_folder / move_items / update_item_metadata.

What’s next

Reference

Every public method, grouped by topic.

RAG end-to-end guide

Wrap a KB as a tool on a conversational Agent.

RAG pipeline example

Compose a KB reader into a Pipeline.