Skip to content

Conversation

@ellis-driscoll
Copy link
Contributor

@ellis-driscoll ellis-driscoll commented Oct 15, 2025

Background

There are two inaccuracies in the Multi-modal Tool Results documentation:

(1) The documentation states that "Multi-modal tool results are experimental and only supported by Anthropic.", but empirically it works for OpenAI.

(2) The toModelOutput function in the example returns an item with type: "image" which is not compatible with LanguageModelV2ToolResultOutput:

export type LanguageModelV2ToolResultOutput =
  | { type: 'text'; value: string }
  | { type: 'json'; value: JSONValue }
  | { type: 'error-text'; value: string }
  | { type: 'error-json'; value: JSONValue }
  | {
      type: 'content';
      value: Array<
        | {
            type: 'text';
            text: string;
          }
        | {
            type: 'media';
            data: string;
            mediaType: string;
          }
      >;
    };

Summary

(1) Added OpenAI as a provider with multi-modal tool result support.

(2) Replaced type: "image" with type: "media".

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • Formatting issues have been fixed (run pnpm prettier-fix in the project root)
  • I have reviewed this pull request (self-review)

@ellis-driscoll ellis-driscoll marked this pull request as ready for review October 15, 2025 16:38
@ellis-driscoll ellis-driscoll changed the title docs(tools): fix type in toModelOutput example docs(tools): update multi-modal tool results providers and example Oct 15, 2025
@lgrammel lgrammel enabled auto-merge (squash) October 16, 2025 08:56
@lgrammel
Copy link
Collaborator

please fix prettier errors

@gr2m gr2m disabled auto-merge October 16, 2025 16:54
@gr2m gr2m enabled auto-merge (squash) October 16, 2025 16:54
@gr2m gr2m disabled auto-merge October 16, 2025 16:59
@gr2m gr2m enabled auto-merge (squash) October 16, 2025 16:59
@gr2m
Copy link
Collaborator

gr2m commented Oct 16, 2025

please fix prettier errors

the automation had a bug, fixed now, sorry for that, one fix introduced another bug, story of my life ✌🏼

@gr2m gr2m merged commit 0533606 into vercel:main Oct 16, 2025
16 of 17 checks passed
vercel-ai-sdk bot pushed a commit that referenced this pull request Oct 16, 2025
…9529)

## Background

There are two inaccuracies in the [Multi-modal Tool
Results](https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling#multi-modal-tool-results)
documentation:

(1) The documentation states that "Multi-modal tool results are
experimental and only supported by Anthropic.", but empirically it works
for OpenAI.

(2) The `toModelOutput` function in the example returns an item with
`type: "image"` which is not compatible with
`LanguageModelV2ToolResultOutput`:
```
export type LanguageModelV2ToolResultOutput =
  | { type: 'text'; value: string }
  | { type: 'json'; value: JSONValue }
  | { type: 'error-text'; value: string }
  | { type: 'error-json'; value: JSONValue }
  | {
      type: 'content';
      value: Array<
        | {
            type: 'text';
            text: string;
          }
        | {
            type: 'media';
            data: string;
            mediaType: string;
          }
      >;
    };
```

## Summary

(1) Added OpenAI as a provider with multi-modal tool result support.

(2) Replaced `type: "image"` with `type: "media"`.
@vercel-ai-sdk vercel-ai-sdk bot removed the backport label Oct 16, 2025
@vercel-ai-sdk
Copy link
Contributor

vercel-ai-sdk bot commented Oct 16, 2025

✅ Backport PR created: #9570

vercel-ai-sdk bot added a commit that referenced this pull request Oct 16, 2025
…example (#9570)

This is an automated backport of #9529 to the release-v5.0 branch.

Co-authored-by: Ellis Driscoll <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants