added
Attach files directly to the model
25 days ago by Cormick Marskamp
With our latest update, you can now attach PDF files directly to Gemini and OpenAI models. Simply include the encoded file in your deployment invocation, and the model will natively process the PDF - no more manual file uploads or bloated prompts.
Why this matters
- Better File Understanding: Models can directly analyze the content and structure of your PDFs—including text, images, tables, and diagrams - improving extraction quality and structured outputs.
- Cleaner Prompts: File data is no longer dumped into your system or user message, resulting in faster, less error-prone requests.
The file_data
should be using the standard data URI scheme (data:content/type;base64). See an example API call below:
curl --request POST \
--url https://api.orq.ai/v2/deployments/invoke \
--header 'accept: application/json' \
--header 'authorization: Bearer <your_orq_key>' \
--header 'content-type: application/json' \
--data '
{
"key": "key",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "prompt"
},
{
"type": "file",
"file": {
"filename" : "<filename>",
"file_data": "data:application/pdf;base64,<base64-encoded-data>"
}
}
]
}
]
}
'
generation = client.deployments.invoke(
key="deployment_key",
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "prompt"
},
{
"type": "file",
"file": {
"file_data": "data:application/pdf;base64,<base64-encoded-data>",
"filename": "filename"
}
}
]
}
],
metadata={
"user_id": "123",
"session_id": "456",
}
)
const generation = await client.deployments.invoke({
key: 'deployment_key',
messages: [
{
role: 'user',
content: [
{
type: 'text',
text: 'prompt'
},
{
type: 'file',
file: {
file_data: 'data:application/pdf;base64,<base64-encoded-data>',
filename: 'filename.pdf'
}
}
]
}
],
metadata: {
user_id: '123',
session_id: '456'
}
});