No support for purpose="vision" in files API
JensMadsen opened this issue · 0 comments
JensMadsen commented
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
According to the docs in order to create a file upload of an image this should work:
file = client.files.create(
file=open("myimage.png", "rb"),
purpose="vision"
)
However, two things do not works as I expected:
- the typing of
purpose
does not includevision
- I use this API version "2024-05-01-preview". I get this error response from Azure Open AI
Error code: 400 - {'error': {'code': 'invalidPayload', 'message': 'Invalid value for the purpose.'}
To Reproduce
Run the snippet from the documentation:
file = client.files.create(
file=open("myimage.png", "rb"),
purpose="vision"
)
thread = client.beta.threads.create(
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is the difference between these images?"
},
{
"type": "image_url",
"image_url": {"url": "https://example.com/image.png"}
},
{
"type": "image_file",
"image_file": ("file_id": file.id)
},file = client.files.create(
file=open("myimage.png", "rb"),
purpose="vision"
)
Code snippets
No response
OS
linux (Ubuntu)
Python version
3.12.1
Library version
1.30.5