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

Chat Completion with Image Input is not working #3

Open
IvanVohmin opened this issue Nov 28, 2024 · 0 comments
Open

Chat Completion with Image Input is not working #3

IvanVohmin opened this issue Nov 28, 2024 · 0 comments

Comments

@IvanVohmin
Copy link

I was trying to use an image input in my chat completion, but it appears its not working at all.
My code:


client = OpenAIUnofficial()
response = client.chat.completions.create(
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What's in this image?"},
            {
                "type": "image_url",
                "image_url": {
                    "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
                }
            },
        ],
    }],
    model="gpt-4o-mini-2024-07-18"
)
print("Response:", response.choices[0].message.content)``` 


and console return this error: 


```File "C:\Users\~\AppData\Local\Programs\Python\Python310\lib\site-packages\openai_unofficial\main.py", line 256, in create
    response = self.api_handler._make_request(
  File "C:\Users\~\AppData\Local\Programs\Python\Python310\lib\site-packages\openai_unofficial\main.py", line 65, in _make_request
    getattr(e.response, 'json', lambda: None)())
  File "C:\Users\~\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 
0)```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant