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

wrong type specified #3

Open
dolphinsd opened this issue Oct 11, 2024 · 1 comment
Open

wrong type specified #3

dolphinsd opened this issue Oct 11, 2024 · 1 comment

Comments

@dolphinsd
Copy link

https://docs.anthropic.com/en/api/messages
per docs you should pass base64 for type, not image:

Starting with Claude 3 models, you can also send image content blocks:

{"role": "user", "content": [
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/jpeg",
"data": "/9j/4AAQSkZJRg...",
}
},
{"type": "text", "text": "What is in this image?"}
]}

@dolphinsd
Copy link
Author

public static ContentBlock CreateImage(string mediaType, string data)
{
return new()
{
Type = "image",
Source = new()
{
MediaType = mediaType,
Data = data
}
};
}

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