From f1cfba7527f9255415d6e3aac68959735b8d875f Mon Sep 17 00:00:00 2001 From: Greyson LaLonde Date: Thu, 5 Jun 2025 12:34:52 -0400 Subject: [PATCH] docs: update hallucination guardrail examples - Add basic usage example showing guardrail uses task's expected_output as default context - Add explicit context example for custom reference content --- docs/enterprise/features/hallucination-guardrail.mdx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/enterprise/features/hallucination-guardrail.mdx b/docs/enterprise/features/hallucination-guardrail.mdx index 33fd3bb3b..8a04cae1a 100644 --- a/docs/enterprise/features/hallucination-guardrail.mdx +++ b/docs/enterprise/features/hallucination-guardrail.mdx @@ -25,8 +25,13 @@ AI hallucinations occur when language models generate content that appears plaus from crewai.tasks.hallucination_guardrail import HallucinationGuardrail from crewai import LLM -# Initialize the guardrail with reference context +# Basic usage - will use task's expected_output as context guardrail = HallucinationGuardrail( + llm=LLM(model="gpt-4o-mini") +) + +# With explicit reference context +context_guardrail = HallucinationGuardrail( context="AI helps with various tasks including analysis and generation.", llm=LLM(model="gpt-4o-mini") )