Skip to content

feat(openai): add new tool search tool#13157

Open
aayush-kapoor wants to merge 18 commits intomainfrom
aayush/openai-tool-search
Open

feat(openai): add new tool search tool#13157
aayush-kapoor wants to merge 18 commits intomainfrom
aayush/openai-tool-search

Conversation

@aayush-kapoor
Copy link
Collaborator

@aayush-kapoor aayush-kapoor commented Mar 6, 2026

Background

OpenAI introduced a new tool along with the release of GPT 5.4

https://developers.openai.com/api/docs/guides/tools-tool-search

API spec here: https://developers.openai.com/api/reference/resources/responses/methods/retrieve

Summary

  • added the new tool spec
  • ensure tool conversion takes place properly

Manual Verification

verified by running the examples:

  • examples/ai-functions/src/generate-text/openai/responses-tool-search.ts
  • examples/ai-functions/src/stream-text/openai/responses-tool-search.ts
  • ‎examples/ai-functions/src/generate-text/openai/responses-client-tool-search.ts‎
  • ‎examples/ai-functions/src/stream-text/openai/responses-client-tool-search.ts‎
  • UI examples
    • ran http://localhost:3000/chat/openai-tool-search with store:false and store:true
    • http://localhost:3000/chat/openai-tool-search-client with store:false and store:true

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)
  • I have reviewed this pull request (self-review)

@tigent tigent bot added ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label feature New feature or request provider/openai labels Mar 6, 2026
aayush-kapoor added a commit that referenced this pull request Mar 6, 2026
## Background

faced the issue while implementing #13157 - for multiturn conversation,
the item Ids weren't properly being mapped within aisdk and there was a
mismatch between what we were sending to the openai api and what was
expected.

we were attching the same tool call id as the `tool-call` object to the
`tool-result` which caused duplicate ID found errors + incorrect ids
sent for certain parts

## Summary

- since the item_id for tool_search_output is propagated via
providerMetadata - we ensure the providerMetadata is preserved through
the UI stream.
- similar change needed for generate text as well

## Manual Verification

will be done in #13157 

## Checklist

- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
vercel-ai-sdk bot pushed a commit that referenced this pull request Mar 6, 2026
## Background

faced the issue while implementing #13157 - for multiturn conversation,
the item Ids weren't properly being mapped within aisdk and there was a
mismatch between what we were sending to the openai api and what was
expected.

we were attching the same tool call id as the `tool-call` object to the
`tool-result` which caused duplicate ID found errors + incorrect ids
sent for certain parts

## Summary

- since the item_id for tool_search_output is propagated via
providerMetadata - we ensure the providerMetadata is preserved through
the UI stream.
- similar change needed for generate text as well

## Manual Verification

will be done in #13157 

## Checklist

- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

Unresolved merge conflict markers in two files cause build failure with "Unexpected <<" and "Merge conflict marker encountered" errors.

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label feature New feature or request provider/openai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant