Skip to content

Conversation

@melkamar
Copy link

@melkamar melkamar commented Sep 8, 2025

Fixes serialization of Image messages as Image
rather than its parent File.

Q A
Bug fix? yes
New feature? no
Docs? no
Issues Fix #488
License MIT

Fixes serialization of Image messages as Image
rather than its parent File.
@carsonbot carsonbot added Bug Something isn't working Status: Needs Review labels Sep 8, 2025
@carsonbot carsonbot changed the title Prepend ImageNormalizer in OpenAIContract Prepend ImageNormalizer in OpenAIContract Sep 8, 2025
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, maybe the FileNormalizer is just to abstract and should rather be a DocumentNormalizer - does that work out?

@melkamar
Copy link
Author

melkamar commented Sep 8, 2025

Narrowing down the FileNormalizer makes this work for the Image case. But I can't comment on whether the normalizer was really intended only for Document.

There is a unit test in the commit introducing it which asserts that the normalizer can also handle File instances.

@chr-hertel
Copy link
Member

Narrowing down the FileNormalizer makes this work for the Image case. But I can't comment on whether the normalizer was really intended only for Document.

There is a unit test in the commit introducing it which asserts that the normalizer can also handle File instances.

@glengemann can you comment? what was intended there?

@glengemann
Copy link
Contributor

Actually, the original intention was only to support Document.

@chr-hertel
Copy link
Member

Thanks @glengemann for the fast feedback!

Let's go with limiting the FileNormalizer to be a DocumentNormalizer for a fix than. If that works out at least.

@OskarStark
Copy link
Contributor

And renameing FileNormalizer to DocumentNormalizer, right?

@glengemann
Copy link
Contributor

Oskar, yes, that would be fine. We named it file to match the JSON key ("type": "file") in the request. However, now it seems more appropriate to call it Document.

{
    "type": "file",
    "file": {
        "file_id": "file-6F2ksmvXxt4VdoqmHRw6kL"
    }
},

@OskarStark
Copy link
Contributor

I renamed the class in
#493

@OskarStark OskarStark changed the title Prepend ImageNormalizer in OpenAIContract Prepend ImageNormalizer in OpenAIContract Sep 8, 2025
@OskarStark OskarStark added the Platform Issues & PRs about the AI Platform component label Sep 8, 2025
@carsonbot carsonbot changed the title Prepend ImageNormalizer in OpenAIContract [Platform] Prepend ImageNormalizer in OpenAIContract Sep 8, 2025
@OskarStark OskarStark changed the title [Platform] Prepend ImageNormalizer in OpenAIContract [Platform] Prepend ImageNormalizer in OpenAIContract Sep 8, 2025
@chr-hertel
Copy link
Member

Closed in favor of #496

@chr-hertel chr-hertel closed this Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Platform Issues & PRs about the AI Platform component Status: Needs Work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Platform][Azure OpenAI] Image message content serialization incorrect due to Normalizer ordering

5 participants