Chatbot Operations
Get confidence scores
This operation retrieves the confidence scores (defined as cosine similarity) 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.
post/get-confidence-score
Request
- Base URL: https://api.chat-data.com/api/v2
- URL: https://api.chat-data.com/api/v2/get-confidence-score
- Auth: HTTP bearer
Request body
Example request
{
"messages": [
{
"role": "assistant",
"content": "How can I help you?"
},
{
"role": "user",
"content": "How does Chat Data work?"
}
],
"chatbotId": "6650f1c2a9e4b83d2c7a1f05"
}Response
Successful response.
Example response
{
"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?"
}Changes
No recorded changes to this operation across all 1 revision of this API.