Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assistant API should support images in base64 if chat completion does. #1483

Open
1 task done
ankitmplivo opened this issue Jun 14, 2024 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@ankitmplivo
Copy link

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

I tried sending base 64 image via chat completion api, and it worked. When i tried the same via assistant api for the same model, it did not work. Looking at the implementation, since it's already supported by completions api.

To Reproduce

  1. Create a base64 image url (data:gdhf..) for any image.
  2. Pass this base64 as url in content to chat completions API it works fine and i get a response.
  3. Create an assistant.
  4. Create a thread with message containing the same base64 encoded image as url inside image_url. You get an error.

BadRequestError: Error code: 400 - {'error': {'message': "Invalid 'messages[0].content[1].image_url.url'. Expected a valid URL, but got a value with an invalid format.", 'type': 'invalid_request_error', 'param': 'messages[0].content[1].image_url.url', 'code': 'invalid_value'}}

Code snippets

[{'role': 'user',
  'content': [{'type': 'text', 'text': 'What’s in this image?'},
   {'type': 'image_url',
    'image_url': {'url': 'data:image/jpeg;base64,/9j...
}
}]
}
]

OS

MacOS

Python version

Python v3.12

Library version

latest

@ankitmplivo ankitmplivo added the bug Something isn't working label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
@ankitmplivo and others