Skip to content

[BUG] Partial Image Data is lost during serialization #804

@bw-flagship

Description

@bw-flagship

Describe the bug

I noticed that partialImageBytes is not filled correctly in StreamingResponseImageGenerationCallPartialImageUpdate.

In the json, the field is "partial_image_b64"
Image

But the code is expecting a different prop:

if (prop.NameEquals("PartialImageBytes"u8))
{
    partialImageBytes = BinaryData.FromBytes(prop.Value.GetBytesFromBase64("D"));
    continue;
}

In addition, I was wondering why we transform the b64 to BinaryData in the library?
In streaming usecases, oftentimes the image stream will be passed directly from the lib via an api to some frontend, where you would use b64 anyways.

In my case, openai-dotnet transforms then b64 from openAi to BinaryData and afterwards I immediately transform it back to b64. Wouldn't it make sense to expose the b64 directly?

Steps to reproduce

  • Create a Streaming response with the image generation tool
  • Check the content of StreamingResponseImageGenerationCallPartialImageUpdate. It will have partialImageBytes = null.

Code snippets

OS

MacOs

.NET version

9.0

Library version

2.6.0

Metadata

Metadata

Assignees

Labels

area: responsesThis item is related to ResponsesbugCategory: Something isn't working and appears to be a defect in the client library.issue-addressedWorkflow: The OpenAI maintainers believe the issue to be addressed and ready to close.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions