feat: support to set an empty context to the Task (#2793)

* feat: support to set an empty context to the Task

* sytle: fix linter issues
This commit is contained in:
Lucas Gomide
2025-05-14 07:36:32 -03:00
committed by GitHub
parent fed397f745
commit c403497cf4
6 changed files with 72 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
import re
from typing import TYPE_CHECKING, List
if TYPE_CHECKING:
from crewai.task import Task
from crewai.tasks.task_output import TaskOutput
@@ -17,6 +17,11 @@ def aggregate_raw_outputs_from_task_outputs(task_outputs: List["TaskOutput"]) ->
def aggregate_raw_outputs_from_tasks(tasks: List["Task"]) -> str:
"""Generate string context from the tasks."""
task_outputs = [task.output for task in tasks if task.output is not None]
task_outputs = (
[task.output for task in tasks if task.output is not None]
if isinstance(tasks, list)
else []
)
return aggregate_raw_outputs_from_task_outputs(task_outputs)