models - openai - images - b64 validate #251
Merged
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.
Description
In the OpenAI model provider, we currently expect people to pass in base64 encoded data for images. This isn't conventional. As with the other providers like Anthropic and Bedrock, we should accept raw image bytes and base64 encode on behalf of the customers.
In this PR, we put in a fix to the OpenAI model provider to allow both raw bytes and base64 encoded bytes. In the 1.0 release, we should switch to only allowing raw bytes and always perform the base64 encoding on behalf of customers.
Related Issues
No formal issue has been opened, but this is causing compatibility issues with the generate_image tool which passes through raw bytes as a result.
Type of Change
Testing
hatch run prepare
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.