Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions python/packages/core/agent_framework/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3297,13 +3297,16 @@ async def from_update_generator(
Example:
.. code-block:: python

from agent_framework import ChatResponse, ChatResponseUpdate, ChatClient
from agent_framework import ChatResponse, ChatResponseUpdate, Content

client = ChatClient() # should be a concrete implementation
response = await ChatResponse.from_update_generator(
client.get_streaming_response("Hello, how are you?")
)
print(response.text)

async def updates():
yield ChatResponseUpdate(contents=[Content.from_text(text="Hello")], role="assistant")
yield ChatResponseUpdate(contents=[Content.from_text(text=" How can I help you?")])


response = await ChatResponse.from_update_generator(updates())
print(response.text) # "Hello How can I help you?"

Args:
updates: An async iterable of ChatResponseUpdate objects to combine.
Expand Down
Loading