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
I want to implement Excel analysis via Anthropic's Code Execution tools. For this to work, I believe that I have to upload files to Anthropic's storage via the Files API. I can do that perfectly with Anthropic's SDK.
The problem is that, when I need to give the AI the file id I want it to analyze with the user's prompt, the ModelMessage type is uncompatible with the input that Anthropic requires, which is as follows:
Anthropic's expected file attachment format:
messages: [{role: "user",content: [{type: "text",text: "Please summarize this document for me."},{type: "document",source: {type: "file",file_id: "file_011CNha8iCJcU1wXNR6q4V8w"}}]}]
AI SDK's expected file attachment format:
/**File content part of a prompt. It contains a file. */interfaceFilePart{type: 'file';/** File data. Can either be: - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer - URL: a URL that points to the image */data: DataContent|URL;/** Optional filename of the file. */filename?: string;/** IANA media type of the file.@see https://www.iana.org/assignments/media-types/media-types.xhtml */mediaType: string;/** Additional provider-specific metadata. They are passed through to the provider from the AI SDK and enable provider-specific functionality that can be fully encapsulated in the provider. */providerOptions?: ProviderOptions;}
Is there anyone who knows how to solve this? I know that the AI SDK supports appending files, but I understand it applies to pdf files only.
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
Uh oh!
There was an error while loading. Please reload this page.
-
I found an obstacle with the AI SDK.
I want to implement Excel analysis via Anthropic's Code Execution tools. For this to work, I believe that I have to upload files to Anthropic's storage via the Files API. I can do that perfectly with Anthropic's SDK.
The problem is that, when I need to give the AI the file id I want it to analyze with the user's prompt, the ModelMessage type is uncompatible with the input that Anthropic requires, which is as follows:
Anthropic's expected file attachment format:
AI SDK's expected file attachment format:
Is there anyone who knows how to solve this? I know that the AI SDK supports appending files, but I understand it applies to pdf files only.
Beta Was this translation helpful? Give feedback.
All reactions