View Source Rag.Generation.HallucinationDetection.Nx (rag v0.1.0)

Functions to detect hallucinations in generated responses using Nx.Serving.batched_run/2.

Summary

Functions

Takes the values of query, response and context from generation and passes it to serving to detect potential hallucinations. Then, puts hallucination? in generation.

Functions

detect_hallucination(generation, serving \\ Rag.HallucinationDetectionServing)

@spec detect_hallucination(Rag.Generation.t(), Nx.Serving.t()) :: Rag.Generation.t()

Takes the values of query, response and context from generation and passes it to serving to detect potential hallucinations. Then, puts hallucination? in generation.