Document support for prompt passthrough
Users can upload a document in a prompt to enable a Large Language Model (LLM) to respond based on the document’s content.
Supported file types include: .doc, .docx, .csv, .xls, .xlsx, .html, .txt, .pdf, and .md.
To include a document in a prompt, convert the local file to a Base64 string. Then, provide
the input within either the api/v1/messages
or api/v1/prompt
endpoint payloads.
For api/v1/messages
endpoint, include these fields:
- Document name: Use only alphanumeric characters, whitespace, hyphens, parentheses, and square brackets.
- Document data: Provide the Base64-encoded string.
- Converse API: Set this value to True.
- File size limit: The maximum file size is 4.5 MB.
For api/v1/prompt
endpoint, include these fields:
-
Document format: Use only these file types: doc, docx, csv, xls, xlsx, html, txt, pdf, md.
-
Document name: Use only alphanumeric characters, whitespace, hyphens, parentheses, and square brackets..
-
Document Data: Provide the Base64-encoded string.
-
Converse API: Confirm that the value returns True.
-
Prompt: Establish a clear objective for how the model should utilize the document.
-
File Size Limit: The maximum file size is 4.5 MB.
Prompt request example for api/v1/messages
{
"system": "You are a math professor who helps answer math questions",
"model": "CLAUDE",
"version": "claude-3-7-sonnet-20250219-v1:0",
"useConverseApi": true,
"config": {
"max_response": 8192,
"reasoning": {
"enabled": true,
"budget_tokens": 4096
}
},
"messages": [
{
"role": "user",
"content": [
{
"type": "document",
"data": {
"format": "pdf",
"name": "FileNameNoExtension",
"data": "base64encoded string of document"
}
},
{
"type": "text",
"data": "Do something with this document"
}
]
}
]
}
Prompt request example for api/v1/prompt
{
"model": "CLAUDE",
"version": "claude-3-7-sonnet-20250219-v1:0",
"useConverseApi": true,
"config": {
"max_response": 16000,
"reasoning": {
"enabled": true,
"budget_tokens": 8000
}
},
"prompt": "Summarize the document",
"document": {
"format": "pdf",
"name": "FileNameNoExtension",
"data": "base64 encoded string of document"
}
}