Conversation
d169b14 to
ba6e07a
Compare
ba6e07a to
51e0454
Compare
…s input to url generation
weedon-openai
approved these changes
Dec 18, 2025
chatkit/agents.py
Outdated
Comment on lines
718
to
740
| elif event.type == "response.image_generation_call.partial_image": | ||
| if not ctx.generated_image_item: | ||
| continue | ||
|
|
||
| url = await converter.base64_image_to_url( | ||
| event.item_id, | ||
| event.partial_image_b64, | ||
| event.partial_image_index, | ||
| ) | ||
| progress = converter.partial_image_index_to_progress( | ||
| event.partial_image_index | ||
| ) | ||
|
|
||
| ctx.generated_image_item.image = GeneratedImage( | ||
| id=event.item_id, url=url | ||
| ) | ||
|
|
||
| yield ThreadItemUpdatedEvent( | ||
| item_id=ctx.generated_image_item.id, | ||
| update=GeneratedImageUpdated( | ||
| image=ctx.generated_image_item.image, progress=progress | ||
| ), | ||
| ) |
Contributor
There was a problem hiding this comment.
for readability should this block be above the done handlers?
Comment on lines
834
to
840
| """ | ||
| Convert a GeneratedImageItem into input item(s) to send to the model. | ||
| Required when generated images are enabled. | ||
| """ | ||
| raise NotImplementedError( | ||
| "A GeneratedImageItem was included in a UserMessageItem but Converter.generated_image_to_message_content was not implemented" | ||
| ) |
Contributor
There was a problem hiding this comment.
Hmm is there no way for us to represent images in a response? I'm not actually sure what the right thing to do here is, but can you just add image content by URL which we have?
Collaborator
Author
There was a problem hiding this comment.
Good idea, I'll add a default that returns a ResponseInputImageParam
876c31b to
f3a2b1f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
GeneratedImageItem(thread item),GeneratedImage,GeneratedImageUpdated(thread item update)stream_agent_responsesupports Agents SDK'sImageGenerationTooloutputResponseStreamConverterto handle base64 image data string -> url conversion and partial image index -> progress conversion.