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

[BUG] request failed with Image failed in base64 through OpenAI Python SDK #337

Closed
fivejjs opened this issue Jan 25, 2025 · 1 comment
Closed

Comments

@fivejjs
Copy link

fivejjs commented Jan 25, 2025

Describe the bug

response = await self.client.chat.completions.create(
                model="deepseek-reasoner",
                messages=[
                    {
                        "role": "user",
                        "content": [
                            {
                                "type": "image_url",
                                "image_url": {
                                    "url": f"data:image/{media_type};base64,{image_data}"
                                },
                            },
                            {"type": "text", "text": prompt_text},
                        ],
                    }
                ],
                max_tokens=1000,
            )

The error:

OpenAI API error: Failed to deserialize the JSON body into the target type: messages[0]: data did not match any variant of untagged enum ChatCompletionRequestContent at line 1 column 286017

Error analyzing image: Failed to deserialize the JSON body into the target type: messages[0]: data did not match any variant of untagged enum ChatCompletionRequestContent at line 1 column 286017

To Reproduce
Try some ordinary "png" image

Expected behavior
proper response on the image content according to the prompt

** Other context **
I found a explanation in this issue: deepseek-ai/DeepSeek-R1#53.
But it is worth to have similar capability as OpenAI 's API.

@mowentian
Copy link
Contributor

thanks~
#339

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

2 participants