feat: renaming GuardrailTask to TaskGuardrail

This commit is contained in:
Lucas Gomide
2025-04-23 14:37:46 -03:00
parent 0ed683241d
commit 05e99bdfe5
7 changed files with 42 additions and 244 deletions

View File

@@ -322,9 +322,9 @@ blog_task = Task(
- On success: it returns a tuple of `(bool, Any)`. For example: `(True, validated_result)`
- On Failure: it returns a tuple of `(bool, str)`. For example: `(False, "Error message explain the failure")`
### GuardrailTask
### TaskGuardrail
The `GuardrailTask` class provides a sophisticated way to generate and execute validation code for task outputs. Here's how it works:
The `TaskGuardrail` class provides a sophisticated way to generate and execute validation code for task outputs. Here's how it works:
#### Code Execution
@@ -800,7 +800,7 @@ from crewai.llm import LLM
task = Task(
description="Generate JSON data",
expected_output="Valid JSON object",
guardrail=GuardrailTask(
guardrail=TaskGuardrail(
description="Ensure the response is a valid JSON object",
llm=LLM(model="gpt-4o-mini"),
)