Skip to content

[BUG] The result is inconsistent after serializing and deserializing ChatRequestUserMessage #40481

Description

@fairjm

Describe the bug
After serializing ChatRequestUserMessage and then deserializing it, the structure of the result returned is inconsistent with the original structure.
It seems that BinaryData directly converted the List into a string structure.

Exception or Stack Trace

To Reproduce
run the following code:

Code Snippet

        final ChatRequestUserMessage user = new ChatRequestUserMessage(List.of(
                new ChatMessageTextContentItem("text"),
                new ChatMessageImageContentItem(new ChatMessageImageUrl("testImage"))
        ));
        // log.info("user:{}", user);
        final String content = BinaryData.fromObject(user).toString();
        log.info("json content:{}", content);
        final ChatRequestUserMessage converted = BinaryData.fromString(content).toObject(ChatRequestUserMessage.class);
        // log.info("converted:{}", converted);

Expected behavior
converted should have the same structure as user.

Screenshots
the user:
image

the converted:
image

Setup (please complete the following information):

  • OS: windows 11
  • IDE: IntelliJ
  • Library/Libraries: azure-ai-openai 1.0.0-beta.8
  • Java version: 17

Metadata

Metadata

Labels

OpenAIcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions