Skip to content

First-party web_search_preview tool does not work with Azure OpenAI #10669

@snoozy

Description

@snoozy

Description

Repro (run a couple times, it's flakey):

import { createAzure } from "@ai-sdk/azure";

export const azureAiReasoning = createAzure({
  resourceName: "<>",
  apiKey: <>,
  apiVersion: "preview",
});

const res = await generateText({
  model: providers.azureAiReasoning.responses("gpt-5.1-codex"),
  temperature: 1,
  tools: {
    web_search_preview: azureAiReasoning.tools.webSearchPreview({}),
  },
  providerOptions: {
    openai: {
      reasoningEffort: "high",
      maxCompletionTokens: 32_000,
    },
  },
  messages: [
    {
      role: "user",
      content:
        "Make a static website for today's stock news, use web search and make sure to use open_page",
    },
  ],
});

Triggers this error:

ZodError: [
      {
        "expected": "string",
        "code": "invalid_type",
        "path": [
          "output",
          9,
          "action",
          "url"
        ],
        "message": "Invalid input: expected string, received undefined"
      }
    ]

I believe this may be related to #9308

AI SDK Version

  • "ai": "^5.0.100",
  • "@ai-sdk/azure": "^2.0.75",
  • "@ai-sdk/openai": "^2.0.73",

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions