diff --git a/src/crewai/crews/crew_output.py b/src/crewai/crews/crew_output.py index 4d16cbc5d..125766a0b 100644 --- a/src/crewai/crews/crew_output.py +++ b/src/crewai/crews/crew_output.py @@ -27,19 +27,7 @@ class CrewOutput(BaseModel): ) token_usage: UsageMetrics = Field(description="Processed token summary", default={}) - def json( - self, - *, - include: Optional[IncEx] = None, - exclude: Optional[IncEx] = None, - by_alias: bool = False, - exclude_unset: bool = False, - exclude_defaults: bool = False, - exclude_none: bool = False, - encoder: Optional[Callable[[Any], Any]] = None, - models_as_dict: bool = True, - **dumps_kwargs: Any, - ) -> str: + def model_json(self) -> str: """Get the JSON representation of the output.""" if self.tasks_output and self.tasks_output[-1].output_format != OutputFormat.JSON: raise ValueError( @@ -53,24 +41,28 @@ class CrewOutput(BaseModel): indent: Optional[int] = None, include: Optional[IncEx] = None, exclude: Optional[IncEx] = None, + context: Optional[Any] = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = False, + serialize_as_any: bool = False, ) -> str: """Override model_dump_json to handle custom JSON output.""" return super().model_dump_json( indent=indent, include=include, exclude=exclude, + context=context, by_alias=by_alias, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, round_trip=round_trip, warnings=warnings, + serialize_as_any=serialize_as_any, ) def to_dict(self) -> Dict[str, Any]: diff --git a/src/crewai/tasks/task_output.py b/src/crewai/tasks/task_output.py index 5a1444a49..39017c5be 100644 --- a/src/crewai/tasks/task_output.py +++ b/src/crewai/tasks/task_output.py @@ -38,19 +38,7 @@ class TaskOutput(BaseModel): self.summary = f"{excerpt}..." return self - def json( - self, - *, - include: Optional[IncEx] = None, - exclude: Optional[IncEx] = None, - by_alias: bool = False, - exclude_unset: bool = False, - exclude_defaults: bool = False, - exclude_none: bool = False, - encoder: Optional[Callable[[Any], Any]] = None, - models_as_dict: bool = True, - **dumps_kwargs: Any, - ) -> str: + def model_json(self) -> str: """Get the JSON representation of the output.""" if self.output_format != OutputFormat.JSON: raise ValueError( @@ -68,24 +56,28 @@ class TaskOutput(BaseModel): indent: Optional[int] = None, include: Optional[IncEx] = None, exclude: Optional[IncEx] = None, + context: Optional[Any] = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = False, + serialize_as_any: bool = False, ) -> str: """Override model_dump_json to handle custom JSON output.""" return super().model_dump_json( indent=indent, include=include, exclude=exclude, + context=context, by_alias=by_alias, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, round_trip=round_trip, warnings=warnings, + serialize_as_any=serialize_as_any, ) def to_dict(self) -> Dict[str, Any]: