Query the knowledge base
This operation fetches segments pertinent to generating responses. Designed for seamless chatbot integration with the GPTs store, this API endpoint allows users to supply relevant document fragments to the GPTs. As with the /get-confidence-score endpoint, results are cached by query for efficiency.
Credit Cost: Each query costs 0.5 message credits. If reranking runs, the total cost is 1.0 message credit (0.5 base + 0.5 reranking); a cached result costs 0.5 even with reranking enabled. Requests are rejected if the available credits are insufficient.
Request
- Base URL: https://api.chat-data.com/api/v2
- URL: https://api.chat-data.com/api/v2/query-knowledge-base/{chatbotId}
- Auth: HTTP bearer
Path parameters
The unique identifier allocated to the chatbot.
Request body
Example request
{
"query": "What are your opening hours?"
}Response
Successful response. The body is a JSON array of matching chunks, without a status field.
Example response
[
{
"source": "https://www.example.com/support/opening-hours",
"type": "website",
"snippet": "Our support team is available Monday to Friday, 9am to 6pm EST. Outside these hours you can email support@example.com.",
"relavant_score": "0.87"
}
]Changes
No recorded changes to this operation across all 1 revision of this API.