Skip to content

Knowledge Base Q&A

← API Reference · 简体中文

RAG Q&A against a knowledge base. Use the resource-level API key bound to that base (see API Keys & Authentication); strict/lenient mode and retrieval settings apply.

Request

http
POST /ext/v1/knowledge
ParameterTypeRequiredDescription
querystringyesThe user question
modelstringnoAnswering model; A_MODEL_NOT_AVAILABLE if missing or disabled
response_modestringnostreaming (default) / blocking

Response

streaming (default)

An SSE text stream. In strict mode, when nothing relevant is retrieved the API returns empty content (the web UI displays it as "[No answer]") — the model does not make up an answer.

blocking

Waits and returns the JSON result (including the answer text).

bash
curl -X POST "http://<host>:9999/ext/v1/knowledge" \
  -H "Authorization: <knowledge base API key>" \
  -H "Content-Type: application/json" \
  -d '{"query": "What is the company vacation policy?", "response_mode": "blocking"}'

Each call creates a record in the base's Q&A history, viewable and clearable in the UI.

Errors

ErrorScenario
401Invalid key
A_DATA_NOT_FOUNDKnowledge base not found
A_MODEL_NOT_AVAILABLEModel missing or disabled

Previous: Character Chat · Next: Draw Tasks