Detect Hallucinations
Run hallucination detection on a conversation provided in the request body.
Send an array of messages in OpenAI chat format. The last message must be from the assistant. The endpoint evaluates that message for hallucinations and returns annotations with usage information.
Set store_conversation to true to persist the conversation, messages,
and evaluation in the database so they appear in the dashboard.
You can override the workspace hallucination config by providing a
config object with custom labels and domain context.
Header Parameters
Workspace UUID to operate within. Required for session auth and user-scoped API keys. Optional for workspace-scoped API keys (uses key's workspace if omitted).
Request Body
application/json
Array of messages in OpenAI chat format. Last message must be from assistant.
1 <= itemsPersist conversation, messages, and evaluation in the database.
trueMetadata about the LLM call that produced the assistant message.
Override the workspace hallucination config for this request.
Response Body
application/json
application/json
curl -X POST "https://loading/v1/detect-hallucinations" \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "content": "string", "role": "developer" } ] }'{
"annotations": [
{
"text": "string",
"label": "string",
"explanation": "string",
"message_part_index": 0,
"start_offset": 0,
"end_offset": 0,
"tool_name": "string",
"parameter_name": "string"
}
],
"usage": {
"input_tokens": 0,
"cost_cents": 0
},
"evaluation_id": "4108ec8e-6efd-4b9b-bace-0bb4c296c324",
"conversation_id": "cc71b11a-25cd-4c2d-9950-df2cc38e3407"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}