-
Notifications
You must be signed in to change notification settings - Fork 505
Closed
Labels
Milestone
Description
Describe the bug
If you run an agent and pass it content that includes an input_file where file is base64-encoded data, like this...
content: [
{
type: 'input_file',
file: "data:application/pdf;base64,JVBER...snip...",
providerData: {
filename: "cool-doc.pdf"
}
}
],you hit this error:
openai-agents-js/packages/agents-openai/src/openaiChatCompletionsConverter.ts
Lines 99 to 103 in 1300121
| throw new Error( | |
| `File uploads are not supported for chat completions: ${JSON.stringify( | |
| c, | |
| )}`, | |
| ); |
even though the docs and API do support passing such an input file.
It looks like this issue also existed in the python SDK but was fixed: openai/openai-agents-python#893.
Debug information
- Agents SDK version: (e.g. `v0.3.4)
- Node 22.21.1
Repro steps
import { Agent, run } from '@openai/agents';
const agent = new Agent({
name: 'Assistant',
instructions: 'You are a helpful assistant.',
});
const result = await run(
agent,
[
{
role: 'user',
content: [
{
type: 'input_text',
text: "what does this file say?",
}
{
type: 'input_file',
file: "data:application/pdf;base64,JVBER...snip...", // replace with a valid base64-encoded pdf
providerData: {
filename: "cool-doc.pdf"
}
}
],
}
],
);`Expected behavior
I would expect this to successfully pass the file input data to the API without error.