mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 23:58:34 +00:00
Add name and expected_output to TaskOutput (#1199)
* Add name and expected_output to TaskOutput This commit adds task information to the TaskOutput class. This is useful to provide extra context to callbacks. * Populate task name from function names This commit populates task name from function names when using annotations.
This commit is contained in:
@@ -98,6 +98,7 @@ def test_task_callback():
|
||||
task_completed = MagicMock(return_value="done")
|
||||
|
||||
task = Task(
|
||||
name="Brainstorm",
|
||||
description="Give me a list of 5 interesting ideas to explore for na article, what makes them unique and interesting.",
|
||||
expected_output="Bullet point list of 5 interesting ideas.",
|
||||
agent=researcher,
|
||||
@@ -109,6 +110,10 @@ def test_task_callback():
|
||||
task.execute_sync(agent=researcher)
|
||||
task_completed.assert_called_once_with(task.output)
|
||||
|
||||
assert task.output.description == task.description
|
||||
assert task.output.expected_output == task.expected_output
|
||||
assert task.output.name == task.name
|
||||
|
||||
|
||||
def test_task_callback_returns_task_output():
|
||||
from crewai.tasks.output_format import OutputFormat
|
||||
@@ -149,6 +154,8 @@ def test_task_callback_returns_task_output():
|
||||
"json_dict": None,
|
||||
"agent": researcher.role,
|
||||
"summary": "Give me a list of 5 interesting ideas to explore...",
|
||||
"name": None,
|
||||
"expected_output": "Bullet point list of 5 interesting ideas.",
|
||||
"output_format": OutputFormat.RAW,
|
||||
}
|
||||
assert output_dict == expected_output
|
||||
|
||||
Reference in New Issue
Block a user