Skip to main content

:::note Generated reference Generated from honeyframeapi 0.1.8 — do not edit by hand. :::

honeyframeapi.knowledge_base

Knowledge Bank handle — build a retrieval (RAG) corpus from code.

A Knowledge Bank is a first-class, standalone entity: create it, feed it documents, embed them into a vector store, then bind it to visual agents as a vector_search tool. The whole "knowledge agent" build loop is scriptable:

kb = client.create_knowledge_base("Support SOPs",
vector_connector_id=7, embedding_connector_id=3)
kb.upload_doc("sop.pdf")
kb.embed() # embed any un-embedded chunks
kb.search("what is the sepsis protocol?")
tool = kb.create_tool() # → a vector_search agent-tool bound to this KB

KBs are org+project scoped — the client's project_id (sent as X-Project-Id) decides which project a created KB belongs to; org-level KBs (project_id NULL) are also visible. Which connectors can back a KB (vector stores incl. pgvector, embedding providers) comes from HoneyframeClient.kb_connector_options.

class KnowledgeBase​

KnowledgeBase.name​

property

name: str

KnowledgeBase.reload()​

reload() -> KnowledgeBase

KnowledgeBase.get_settings()​

get_settings() -> dict

Full KB record + doc/chunk counts + embedding health.

KnowledgeBase.update()​

update(**fields) -> dict

Patch KB fields (name, description, embedding_model, embedding_dimensions, chunk_size, chunk_overlap, top_k, similarity_threshold, source_folder_id, vector_connector_id, embedding_connector_id). Only the fields you pass change.

KnowledgeBase.delete()​

delete() -> dict

Delete the KB (409 if any tool/agent still consumes it — detach first; see usage).

KnowledgeBase.docs()​

docs() -> list[dict]

Ingested documents ({doc_id, filename, file_type, file_size_bytes, chunk_count, status, created_at}).

KnowledgeBase.upload_doc()​

upload_doc(path) -> dict

Ingest a local document (pdf/txt/md/docx/… per the server's supported types; 50 MB cap). Chunks it and, if an embedding provider is wired, embeds it. Returns the ingest result.

KnowledgeBase.remove_doc()​

remove_doc(doc_id: int) -> dict

Delete a document and its chunks/vectors.

KnowledgeBase.embed()​

embed() -> dict

Embed any chunks that were stored but never embedded (e.g. ingested before an embedding provider was wired). Returns the embed result.

KnowledgeBase.sync()​

sync() -> dict

Re-ingest from the KB's wired source_folder_id (pick up new / changed files). Returns the sync result.

KnowledgeBase.clear()​

clear() -> dict

Empty the corpus — drop every doc, chunk, and vector but keep the KB object, its connector wiring, and agent links.

KnowledgeBase.search()​

search(query: str, *, top_k: Optional[int] = None, threshold: Optional[float] = None) -> dict

Semantic search the corpus — the same retrieval a bound vector_search tool runs. top_k / threshold default to the KB's configured values. Returns {query, match_count, results: [{content, source, score}]}.

KnowledgeBase.check_vector_store()​

check_vector_store() -> dict

Validate the wired vector store can hold this KB's embeddings — the dimension probe that catches a fixed-dimension index (Pinecone) sized wrong. Auto-sizing stores (pgvector/chroma/faiss) report compatible. Best-effort: an unreachable store degrades to {checked: false} with a reason, never a 500.

KnowledgeBase.create_tool()​

create_tool() -> dict

Turn this KB into a reusable vector_search agent-tool bound to it (the same tool the UI's "create agent tool" action makes). Idempotent per KB — re-invoking returns the existing tool. Returns {tool_id, name, status} (status ∈ created | existed). Needs org admin.

link_agent(asset_id: int) -> dict

Link this KB to a knowledge-mode agent/webapp (the M2M the agent builder writes; idempotent).

unlink_agent(asset_id: int) -> dict

Unlink this KB from an agent/webapp.

KnowledgeBase.usage()​

usage() -> dict

Reverse-lookup of who consumes this KB — {tools, agents, total_consumers} (the same payload the impact-aware delete guard reads).


Verified against honeyframeapi 0.1.8.