Correct hallucinations in generated text
POST/v2/hallucination_correctors/correct_hallucinations
Detects and corrects factual inaccuracies, commonly referred to as hallucinations, in generated summaries or responses. The platform compares a user-provided summary against one or more source documents. It returns a corrected version of the summary with minimal necessary edits.
Use this endpoint to validate and improve the factual accuracy of summaries generated by LLMs in Retrieval Augmented Generation (RAG) pipelines. This keeps the output grounded in trusted source content. If the corrector does not detect a hallucination, it preserves the original summary.
The response corrects the original summary. If the input summary is accurate, the corrected_summary matches the original_summary.
Interpreting empty corrections
In some cases, the corrected_text field in the response may be an empty string. This means the corrector determined that the entire input text was hallucinated and recommends removing it completely.
This outcome is valid. It typically occurs when none of the content in the generated_text is supported by the provided source documents or query. The response still includes an explanation of why the corrector removed the text.
Request
Responses
- 200
- 400
- 403
Successfully analyzed the text for hallucinations
Request was malformed
Permissions do not allow hallucination correction