feat(openai): forward web_search_call.action.queries from Responses API (#15656)
## Background
The OpenAI Responses API returns both `action.query` and
`action.queries` on `web_search_call` items:
```yaml
WebSearchActionSearch:
properties:
query: { type: string, description: "[DEPRECATED] The search query." }
queries: { type: array, items: { type: string }, description: "The search queries." }
required:
- type
- query
```
(from
[`openai/openai-openapi`](https://github.com/openai/openai-openapi))
The current Zod schemas in this package only parse `query`. When OpenAI
emits a multi-query search, the array is dropped on the floor before it
reaches consumers via `tool-result`. The Vercel AI Gateway hit this gap
building OpenResponses-compatible responses for Grok CLI — when a
downstream client expected the spec-current `queries` field, it had to
fabricate it from the deprecated `query` string, which is lossy for
multi-query searches.
## Changes
- Adds `queries: z.array(z.string()).nullish()` to the
`web_search_call.action.search` discriminator in both the non-streaming
response schema and the streaming `output_item.done` schema
(`openai-responses-api.ts`).
- Adds `queries?: string[]` to `webSearchOutputSchema` and the tool
factory's TypeScript output type (`tool/web-search.ts`). Marks the
existing `query` field as `@deprecated` in JSDoc, matching the upstream
API's annotation.
- Updates `mapWebSearchOutput` in `openai-responses-language-model.ts`
to forward `queries` to the tool-result when present.
- New test: asserts that `queries: ['sf news', 'bay area tech']` from
OpenAI is preserved on the resulting
`tool-result.result.action.queries`.
## Test plan
- [x] `pnpm --filter @ai-sdk/openai test:node` (715 tests pass) R
Rohan Taneja committed
cd3de8b85d2fa4dbdd67057e6742db0648a7ff69
Parent: e92fc45
Committed by GitHub <noreply@github.com>
on 5/27/2026, 9:49:25 PM