mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-26 08:38:15 +00:00
Update Patronus AI evaluator tool and example
This commit is contained in:
@@ -1,34 +1,27 @@
|
||||
import os
|
||||
|
||||
from crewai import Agent, Crew, Task
|
||||
from patronus_eval_tool import PatronusEvalTool
|
||||
|
||||
|
||||
patronus_eval_tool = PatronusEvalTool(
|
||||
evaluators=[{
|
||||
"evaluator": "judge",
|
||||
"criteria": "patronus:is-code"
|
||||
}],
|
||||
tags={}
|
||||
evaluators=[{"evaluator": "judge", "criteria": "patronus:is-code"}], tags={}
|
||||
)
|
||||
|
||||
# Create a new agent
|
||||
coding_agent = Agent(
|
||||
role="Coding Agent",
|
||||
goal="Generate high quality code. Use the evaluation tool to score the agent outputs",
|
||||
backstory="Coding agent to generate high quality code. Use the evaluation tool to score the agent outputs",
|
||||
goal="Generate high quality code and verify that the code is correct by using Patronus AI's evaluation tool to check validity of your output code.",
|
||||
backstory="You are an experienced coder who can generate high quality python code. You can follow complex instructions accurately and effectively.",
|
||||
tools=[patronus_eval_tool],
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
# Define tasks
|
||||
generate_code = Task(
|
||||
description="Create a simple program to generate the first N numbers in the Fibonacci sequence.",
|
||||
description="Create a simple program to generate the first N numbers in the Fibonacci sequence. Use the evaluator as `judge` from Patronus AI with the criteria `patronus:is-code` and feed your task input as input and your code as output to verify your code validity.",
|
||||
expected_output="Program that generates the first N numbers in the Fibonacci sequence.",
|
||||
agent=coding_agent,
|
||||
)
|
||||
|
||||
|
||||
crew = Crew(agents=[coding_agent], tasks=[generate_code])
|
||||
|
||||
crew.kickoff()
|
||||
crew.kickoff()
|
||||
|
||||
Reference in New Issue
Block a user