Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
No idea why, but when using the lib to give gtp-4o-mini an image in base64 it's giving me the following error:
openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid type for 'messages[0].content[1].image_url': expected an object, but got a string instead.", 'type': 'invalid_request_error', 'param': 'messages[0].content[1].image_url', 'code': 'invalid_type'}}
It's essentialy the same code provided in https://platform.openai.com/docs/guides/vision/uploading-base-64-encoded-images which works fine for me.
To Reproduce
Just run the code snippet, I guess.
Code snippets
client = OpenAI(
project='',
api_key=""
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image in a few words."},
{
"type": "image_url",
"image_url": f"data:image/jpeg;base64,{base64_image}"
},
],
}
],
max_tokens=100
)
OS
macOS
Python version
Python 3.10.14
Library version
1.40.3
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
No idea why, but when using the lib to give gtp-4o-mini an image in base64 it's giving me the following error:
It's essentialy the same code provided in https://platform.openai.com/docs/guides/vision/uploading-base-64-encoded-images which works fine for me.
To Reproduce
Just run the code snippet, I guess.
Code snippets
OS
macOS
Python version
Python 3.10.14
Library version
1.40.3