/** * Hallucination Detection guardrail module. * * This module provides a guardrail for detecting when an LLM generates content that * may be factually incorrect, unsupported, or "hallucinated." It uses the OpenAI * Responses API with file search to validate claims against actual documents. * * **IMPORTANT: A valid OpenAI vector store must be created before using this guardrail.** * * To create an OpenAI vector store, you can: * * 1. **Use the Guardrails Wizard**: Configure the guardrail through the [Guardrails Wizard](https://guardrails.openai.com/), which provides an option to create a vector store if you don't already have one. * 2. **Use the OpenAI Dashboard**: Create a vector store directly in the [OpenAI Dashboard](https://platform.openai.com/storage/vector_stores/). * 3. **Follow OpenAI Documentation**: Refer to the "Create a vector store and upload a file" section of the [File Search documentation](https://platform.openai.com/docs/guides/tools-file-search) for detailed instructions. * 4. **Use the provided utility script**: Use the `create_vector_store.py` script provided in the [repo](https://github.com/OpenAI-Early-Access/guardrails/blob/main/guardrails/src/guardrails/utils/create_vector_store.py) to create a vector store from local files or directories. * * **Pricing**: For pricing details on file search and vector storage, see the [Built-in tools section](https://openai.com/api/pricing/) of the OpenAI pricing page. */ import { z } from 'zod'; import { type CheckFn, type GuardrailLLMContext } from '../types'; /** * Configuration schema for hallucination detection. * * Extends the base LLM configuration with file search validation parameters. */ export declare const HallucinationDetectionConfig: z.ZodObject<{ model: z.ZodString; confidence_threshold: z.ZodDefault; knowledge_source: z.ZodString; include_reasoning: z.ZodDefault; }, z.core.$strip>; export type HallucinationDetectionConfig = z.infer; /** * Context requirements for the hallucination detection guardrail. */ export type HallucinationDetectionContext = GuardrailLLMContext; /** * Base output schema for hallucination detection (without reasoning fields). */ export declare const HallucinationDetectionBaseOutput: z.ZodObject<{ flagged: z.ZodBoolean; confidence: z.ZodNumber; }, z.core.$strip>; export type HallucinationDetectionBaseOutput = z.infer; /** * Full output schema for hallucination detection analysis (with reasoning fields). */ export declare const HallucinationDetectionOutput: z.ZodObject<{ flagged: z.ZodBoolean; confidence: z.ZodNumber; reasoning: z.ZodString; hallucination_type: z.ZodNullable; hallucinated_statements: z.ZodNullable>; verified_statements: z.ZodNullable>; }, z.core.$strip>; export type HallucinationDetectionOutput = z.infer; /** * Detect potential hallucinations in text by validating against documents. * * This function uses the OpenAI Responses API with file search and structured output * to validate factual claims in the candidate text against the provided knowledge source. * It flags content that contains any unsupported or contradicted factual claims. * * @param ctx Guardrail context containing the LLM client. * @param candidate Text to analyze for potential hallucinations. * @param config Configuration for hallucination detection. * @returns GuardrailResult containing hallucination analysis with flagged status * and confidence score. */ export declare const hallucination_detection: CheckFn; //# sourceMappingURL=hallucination-detection.d.ts.map