You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello I am trying to send two attachments to Calude 3.5 sonnet (modelId: nthropic.claude-3-5-sonnet-20240620-v1:0), I cant seem to make this work. I am sending them as follows.
payload = {
"modelId": "anthropic.claude-3-5-sonnet-20240620-v1:0",
"contentType": "application/json",
"accept": "application/json",
"body": json.dumps({
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 10000,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Explain the diagram from the PDF and sumamrize content from the DOCX attachments"
},
*attachments
]
}
]
})
}
my attachments are created as specified below.
attachments = []
# Add PDF file
with open(pdf_file, 'rb') as file:
mime_type, _ = mimetypes.guess_type(pdf_file)
attachments.append({
"type": "image",
"image": {
"source": {
"type": "base64",
"media_type": mime_type or "application/pdf",
"data": base64.b64encode(file.read()).decode('utf-8')
}
}
})
# Add DOCX file
with open(docx_file, 'rb') as file:
mime_type, _ = mimetypes.guess_type(docx_file)
attachments.append({
"type": "image",
"image": {
"source": {
"type": "base64",
"media_type": mime_type or "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"data": base64.b64encode(file.read()).decode('utf-8')
}
}
})
the error is raise error_class(parsed_response, operation_name)
botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the InvokeModel operation: messages.0.content.1.image.source: Field required
my invocation is
response = self.bedrock_client.invoke_model(modelId=payload["modelId"], body=payload["body"])
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello I am trying to send two attachments to Calude 3.5 sonnet (modelId: nthropic.claude-3-5-sonnet-20240620-v1:0), I cant seem to make this work. I am sending them as follows.
payload = {
"modelId": "anthropic.claude-3-5-sonnet-20240620-v1:0",
"contentType": "application/json",
"accept": "application/json",
"body": json.dumps({
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 10000,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Explain the diagram from the PDF and sumamrize content from the DOCX attachments"
},
*attachments
]
}
]
})
}
my attachments are created as specified below.
attachments = []
the error is raise error_class(parsed_response, operation_name)
botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the InvokeModel operation: messages.0.content.1.image.source: Field required
my invocation is
response = self.bedrock_client.invoke_model(modelId=payload["modelId"], body=payload["body"])
Beta Was this translation helpful? Give feedback.
All reactions