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
When providing an external URL with a non-image contentType (e.g., text/javascript) in the experimental_attachments field of a Message, the system throws an error. However, using a Data URL for the same file type does not trigger an error. The type definitions suggest that URLs for hosted files should be supported, but this behaviour is inconsistent.
Steps to Reproduce:
Send a message using the following structure in the messages field:
Error [AI_UnsupportedFunctionalityError]: 'File content part type text/javascript in user messages' functionality not supported.
at Array.map (<anonymous>) {
cause: undefined,
functionality: 'File content part type text/javascript in user messages'
}
[TypeError: Cannot read properties of undefined (reading 'toolCalls')]
Repeat the test, but replace the url with a Data URL:
export async function POST(req: Request) {
const { messages } = await req.json();
const result = await streamText({
model: openai('gpt-4o'),
messages: {
role: 'user',
content: 'test',
experimental_attachments: [
{
name: 'test.txt',
contentType: 'text/plain',
url: 'https://pub-*******************.r2.dev/user-attachments/gP3VdxrFT9/test.txt',
},
],
},
});
return result.toDataStreamResponse();
}
### AI provider
"@ai-sdk/openai": "^1.0.11"
### Additional context
The docs and type definition states:
* The URL of the attachment. It can either be a URL to a hosted file or a [Data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs).
But unless the hosted file is an image, it throws this error.
The text was updated successfully, but these errors were encountered:
Description
When providing an external URL with a non-image contentType (e.g., text/javascript) in the experimental_attachments field of a Message, the system throws an error. However, using a Data URL for the same file type does not trigger an error. The type definitions suggest that URLs for hosted files should be supported, but this behaviour is inconsistent.
Steps to Reproduce:
Note that no error occurs for the Data URL.
Code example
The text was updated successfully, but these errors were encountered: