How a document becomes searchable
1
Create a knowledge base
2
Ingest a document
content takes inline text, or a file you uploaded first (see Multimodal).Ingest is always asynchronous. The call answers
202 with a task_id, and the
document id is minted downstream — so the ack does not carry one.3
Wait for it to be processed
task_wait polls until the task reaches a terminal state, backs off between polls,
rides out a transient rate limit, and raises if the task fails or outlives the
timeout. Pass raise_on_failure=False to inspect a failure instead of raising.4
Find the document
The ingest ack has no document id, so resolve it by title once the task finishes.
5
Search it
What comes back
The unit of retrieval is the topic, not the document. Each hit carries its parent document’s title and summary, so a result list needs no follow-up request. Topic bodies are omitted by default. Ask for them when you actually need the text:Results can include the document-root topic —
depth 0, the document’s own title.
It is a container, not a section, so its content is always null even with
include=["content"]. Skip hits whose depth is 0 if you only want real sections.The topic list includes one synthetic document-root item (
type is "root"), so it
returns exactly one more entry than the document’s topic_count, which counts real
topics only. Build the tree from each item’s parent_id.Reading the score
hit.score is not a raw keyword or vector score. Every retrieval method reranks its
candidates with a cross-encoder and then normalizes within that response, so:
- scores compare inside one response, never across responses or queries;
- the best hit of any response sits near the top of the range by construction, however weak the pool actually is;
score_thresholdtherefore cuts a relative position, not an absolute relevance bar.
Categories
A category is a bucket a document is filed under. A new knowledge base starts with none, so until you create some, every document stays uncategorized (category_id
comes back as an empty string) and the classifier has nothing to choose from.
category_id on the upload to pin it instead. A category’s description is not
decoration: it is what the classifier matches a document against.
Re-file a document at any time:
Maintenance
client.knowledge.replace_document(...) — the swap is atomic and idempotent per
document id.
What’s next
Multimodal support
Upload a PDF or an image first, then ingest it by object key.
API Reference
Every knowledge-base operation, with parameters and responses.

