I have a problem to pass dynamicly multiple images to the message of Claude.
I want to make a description based on the product images and Knowledge base.
My Blueprint:
blueprint (2).json (73.8 KB)
What do i need to change? or is this only possible with a API Request?
I run in the same issue with ChatGPT-Vision, when i have tried to map multiple images with JSON format.
I have tried to build the JSON body like in “messages” how Anthropic descript in the documention:
message = client.messages.create(
model="claude-3-opus-20240229",
max_tokens=1024,
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Image 1:"
},
{
"type": "image",
"source": {
"type": "base64",
"media_type": image1_media_type,
"data": image1_data,
},
},
{
"type": "text",
"text": "Image 2:"
},
{
"type": "image",
"source": {
"type": "base64",
"media_type": image2_media_type,
"data": image2_data,
},
},
{
"type": "text",
"text": "How are these images different?"
}
],
}
],
)
This is my Message in 19:
BASE64(DATA) is current only a variable to show how i parse the base64 in the step before, the content is too much to post here.
[
{
"role":"user",
"content":[
{
"type":"text",
"text":"Image 1:"
},
{
"type":"image",
"source":{
"type":"base64",
"media_type":"image/jpeg",
"data":"BASE64(DATA)"
}
},
{
"type":"text",
"text":"Image 2:"
},
{
"type":"image",
"source":{
"type":"base64",
"media_type":"image/jpeg",
"data":"BASE64(DATA)"
}
},
{
"type":"text",
"text":"Image 3:"
},
{
"type":"image",
"source":{
"type":"base64",
"media_type":"image/jpeg",
"data":"BASE64(DATA)"
}
}
]
}
]