Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

docs: update hallucination guardrail examples

Greyson LaLondef1cfba7527f9
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")
)