From d6cfbe00c854a35f2cde88e80a8f2309d3e04716 Mon Sep 17 00:00:00 2001 From: Jeeho Lee Date: Fri, 23 Oct 2026 04:09:22 +0000 Subject: [PATCH] Python: Make response overview examples runnable AI-assisted with OpenAI Codex. --- .../packages/core/agent_framework/_types.py | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/python/packages/core/agent_framework/_types.py b/python/packages/core/agent_framework/_types.py index 629593b8839..bdb893a5b68 100644 --- a/python/packages/core/agent_framework/_types.py +++ b/python/packages/core/agent_framework/_types.py @@ -3084,7 +3084,7 @@ class ChatResponse(SerializationMixin, Generic[ResponseModelT]): Examples: .. code-block:: python - from agent_framework import ChatResponse, Message + from agent_framework import ChatResponse, ChatResponseUpdate, Content, Message # Create a response with messages msg = Message("assistant", ["The weather is sunny."]) @@ -3096,7 +3096,14 @@ class ChatResponse(SerializationMixin, Generic[ResponseModelT]): print(response.text) # "The weather is sunny." # Combine streaming updates - updates = [...] # List of ChatResponseUpdate objects + updates = [ + ChatResponseUpdate( + contents=[Content.from_text("The weather is sunny.")], + role="assistant", + finish_reason="stop", + model="gpt-4", + ) + ] response = ChatResponse.from_updates(updates) # Serialization - to_dict and from_dict @@ -3572,7 +3579,7 @@ class AgentResponse(SerializationMixin, Generic[ResponseModelT]): Examples: .. code-block:: python - from agent_framework import AgentResponse, Message + from agent_framework import AgentResponse, AgentResponseUpdate, Content, Message # Create agent response msg = Message("assistant", ["Task completed successfully."]) @@ -3584,7 +3591,13 @@ class AgentResponse(SerializationMixin, Generic[ResponseModelT]): print(len(user_requests)) # 0 # Combine streaming updates - updates = [...] # List of AgentResponseUpdate objects + updates = [ + AgentResponseUpdate( + contents=[Content.from_text("Task completed successfully.")], + role="assistant", + response_id="run_123", + ) + ] response = AgentResponse.from_updates(updates) # Serialization - to_dict and from_dict