FrankYang0529 commented on code in PR #74729:
URL: https://github.com/apache/airflow/pull/74729#discussion_r4321405440
##########
providers/common/ai/src/airflow/providers/common/ai/operators/agent.py:
##########
@@ -1077,6 +1087,22 @@ def _complete_run(self, context: Context, result: Any,
*, attempt_usage: RunUsag
self._clear_usage_budget(context)
return output
+ def _convert_output_for_xcom(self, output: Any) -> Any:
+ """Return the XCom value, with dicts in place of models that a
downstream task could not load."""
+ if self._serialize_model_output and isinstance(output, BaseModel):
+ return output.model_dump()
+ if not _CORE_WALKER:
+ # iter_pydantic_models could not be imported, so the worker
registers no class.
+ # _serialize_model_output is always True when that import fails,
so a model at the top level
+ # was already dumped above. Any other output is pushed unchanged.
+ return output
Review Comment:
Changed to use `_dump_unregistered_models(output, set())`. Thanks for the
review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]