Skip to content

Get confidence scores

post/get-confidence-score
Any key

This operation retrieves the confidence scores of the related chunks used to generate answers. You can use it to obtain confidence scores before calling the /chat API endpoint, providing an estimate of the chatbot's ability to deliver high-quality answers based on the context. Chunks are cached based on the messages array, so subsequent calls to the /chat API with the same messages array will incur minimal latency in retrieving related vector embeddings from the database. Therefore, calling this API endpoint before /chat should not significantly impact overall chat performance.

Minimum API key access level: Read.

Request body

Sending 2 of 3 fields
Required
messagesarray of object
The messages of the conversation, oldest first. On this endpoint, non-image files are not downloaded or parsed (only a provided content is used), and extra files are not dropped.
chatbotIdstring
The ID of the chatbot.

Only these fields are sent (application/json).

Try it · POST /get-confidence-score
curl 'https://api.chat-data.com/api/v2/get-confidence-score' \  -H "Authorization: Bearer $CHAT_DATA_API_KEY" \  -H 'Content-Type: application/json' \  -d '{  "messages": [    {      "role": "assistant",      "content": "How can I help you?"    },    {      "role": "user",      "content": "How does Chat Data work?"    }  ],  "chatbotId": "6650f1c2a9e4b83d2c7a1f05"}'
Loading…

Responses

Successful response.

Content type: application/json

FieldDescription
statusstringOne of: success.
scorenumberOnly returned, instead of the other fields, when the chatbot uses custom-model or ignoreDataSource is on. Always 0.
averageScorenumberThe average confidence score of all context chunks. A chunk's score starts from its cosine similarity to the query, is weighted by source type (the highest-ranked Q&A, CSV and product chunks score slightly higher) and, when reranking is enabled, is blended with the reranker's relevance score; scores are scaled so the highest is at most 1. Only context chunks with a positive cosine similarity are included.
scoresArrayarray of numberThe confidence score of each context chunk used to generate the answer.
sourcesarray of objectThe context chunks used to generate the answer, with their sources.
sources[].scorenumberConfidence score of the associated context chunk (see averageScore).
sources[].questionstringThe question text if this is a 'q&a' type source.
sources[].answerstringThe answer text if this is a 'q&a' type source.
sources[].urlstringThe URL of the website if this is a 'website' type source.
sources[].titlestringThe title of the document or website.
sources[].textstringOriginal chunk text used to generate the answer in the custom-data-upload model chatbot. Text is not truncated for chatbots based on the custom-data-upload model.
sources[].truncatedTextstringTruncated text from the medical-chat-human or medical-chat-vet model used to generate the answer. To protect the intellectual property of our database, only the first 100 characters are shown.
sources[].tableobjectThe table chunk as stored. Its table field holds the rows (arrays of cell strings); merges and merge_alias describe merged cells.
sources[].topicstringThe topic of the medical chat model text.
sources[].subtopicstringThe subtopic of the medical chat model text.
sources[].typestringThe document type of the source.
embeddingTextstringThe actual text used to generate the embedding. To take the chat history into account, more than the last query may be used to generate embeddingText, depending on the messages array.

Example

{  "status": "success",  "averageScore": 0.8,  "scoresArray": [    0.85,    0.75  ],  "sources": [    {      "score": 0.85,      "url": "https://www.chat-data.com/",      "title": "Chat Data | Build AI chatbots with your own data",      "text": "Chat Data lets you build an AI chatbot trained on your own documents, websites and Q&As, then embed it on your site or connect it to WhatsApp, Slack, Discord and more.",      "type": "website"    },    {      "score": 0.75,      "question": "How do I train my chatbot?",      "answer": "Add documents, website links, plain text or Q&As as sources, then retrain the chatbot. Training usually finishes in 1-2 minutes.",      "type": "q&a"    }  ],  "embeddingText": "How does Chat Data work?"}

Last updated November 12, 2026