Lee-W commented on code in PR #74695:
URL: https://github.com/apache/airflow/pull/74695#discussion_r4348583200


##########
providers/common/ai/docs/structured_output.rst:
##########
@@ -64,4 +67,7 @@ that pattern work.
 
 If a downstream consumer needs the dict shape (e.g. forwarding to an external
 system that expects JSON-style payloads), pass ``serialize_output=True`` and 
the
-operator calls ``model_dump()`` before pushing to XCom.
+operator dumps the model with ``pydantic_core.to_jsonable_python`` before 
pushing to XCom,
+so ``HttpUrl``, ``Path`` and ``Enum`` fields become plain JSON values. The 
operator also dumps an
+output that is a list, tuple, set or dict holding models, and any model of a 
shape the worker
+registers no class for (such as a list of types), even without 
``serialize_output``.

Review Comment:
   Split into two cases in `structured_output.rst`. With 
`serialize_output=True` every output holding a model is dumped. Without it, a 
model whose class the worker registers (`MyModel`, `list[MyModel]`) is pushed 
as an instance, and only a model of a shape the worker registers no class for 
(such as `[MyModel, int]`) is dumped to JSON values.



-- 
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]

Reply via email to