diff --git a/.changeset/quiet-azure-web-search.md b/.changeset/quiet-azure-web-search.md
new file mode 100644
index 000000000000..937428128440
--- /dev/null
+++ b/.changeset/quiet-azure-web-search.md
@@ -0,0 +1,5 @@
+---
+'@ai-sdk/azure': patch
+---
+
+Deprecate `azure.tools.webSearchPreview()` in favor of `azure.tools.webSearch()`.
diff --git a/content/cookbook/00-guides/19-openai-responses.mdx b/content/cookbook/00-guides/19-openai-responses.mdx
index ebbe8d532b3e..6a9d0df5f79c 100644
--- a/content/cookbook/00-guides/19-openai-responses.mdx
+++ b/content/cookbook/00-guides/19-openai-responses.mdx
@@ -102,7 +102,7 @@ const result = await generateText({
model: openai.responses('gpt-6-luna'),
prompt: 'What happened in San Francisco last week?',
tools: {
- web_search_preview: openai.tools.webSearchPreview(),
+ web_search: openai.tools.webSearch(),
},
});
@@ -119,7 +119,7 @@ const result = await generateText({
model: openai.responses('gpt-6-luna'),
prompt: 'What happened in San Francisco last week?',
tools: {
- web_search_preview: openai.tools.webSearchPreview({
+ web_search: openai.tools.webSearch({
searchContextSize: 'high',
userLocation: {
type: 'approximate',
diff --git a/content/providers/01-ai-sdk-providers/04-azure.mdx b/content/providers/01-ai-sdk-providers/04-azure.mdx
index b82a1e7fd6b8..b1263dffdd7b 100644
--- a/content/providers/01-ai-sdk-providers/04-azure.mdx
+++ b/content/providers/01-ai-sdk-providers/04-azure.mdx
@@ -493,6 +493,12 @@ for continuation, compaction, and configuration restrictions.
The Azure OpenAI responses API supports web search through the `azure.tools.webSearch` tool.
+
+ `azure.tools.webSearchPreview()` is deprecated. Use `azure.tools.webSearch()`
+ instead. The existing `searchContextSize` and `userLocation` options are
+ supported by both tools.
+
+
```ts
const result = await generateText({
model: azure('gpt-5'),
@@ -757,7 +763,7 @@ const result = await generateText({
'Create a program that generates five random numbers between 1 and 100 with two decimal places, and show me the execution results. Also save the result to a file.',
tools: {
code_interpreter: azure.tools.codeInterpreter(),
- web_search_preview: azure.tools.webSearchPreview({}),
+ web_search: azure.tools.webSearch({}),
file_search: azure.tools.fileSearch({ vectorStoreIds: ['vs_1234'] }), // requires a configured vector store
},
});
@@ -879,7 +885,7 @@ const result = await generateText({
'Create a program that generates five random numbers between 1 and 100 with two decimal places, and show me the execution results. Also save the result to a file.',
tools: {
code_interpreter: azure.tools.codeInterpreter(),
- web_search_preview: azure.tools.webSearchPreview({}),
+ web_search: azure.tools.webSearch({}),
file_search: azure.tools.fileSearch({ vectorStoreIds: ['vs_1234'] }), // requires a configured vector store
},
});
diff --git a/examples/ai-functions/src/generate-text/azure/responses-provider-metadata-source-document-part.ts b/examples/ai-functions/src/generate-text/azure/responses-provider-metadata-source-document-part.ts
index fc02dcf4d2d4..190869b4c2f8 100644
--- a/examples/ai-functions/src/generate-text/azure/responses-provider-metadata-source-document-part.ts
+++ b/examples/ai-functions/src/generate-text/azure/responses-provider-metadata-source-document-part.ts
@@ -12,7 +12,7 @@ run(async () => {
'Create a program that generates five random numbers between 1 and 100 with two decimal places, and show me the execution results. Also save the result to a file.',
tools: {
code_interpreter: azure.tools.codeInterpreter(),
- web_search_preview: azure.tools.webSearchPreview({}),
+ web_search: azure.tools.webSearch({}),
file_search: azure.tools.fileSearch({ vectorStoreIds: ['vs_1234'] }), // requires a configured vector store
},
});
diff --git a/examples/ai-functions/src/generate-text/azure/responses-provider-metadata-text-part.ts b/examples/ai-functions/src/generate-text/azure/responses-provider-metadata-text-part.ts
index 6d8a75911f4c..f54c6aba90dd 100644
--- a/examples/ai-functions/src/generate-text/azure/responses-provider-metadata-text-part.ts
+++ b/examples/ai-functions/src/generate-text/azure/responses-provider-metadata-text-part.ts
@@ -9,7 +9,7 @@ run(async () => {
'Create a program that generates five random numbers between 1 and 100 with two decimal places, and show me the execution results. Also save the result to a file.',
tools: {
code_interpreter: azure.tools.codeInterpreter(),
- web_search_preview: azure.tools.webSearchPreview({}),
+ web_search: azure.tools.webSearch({}),
file_search: azure.tools.fileSearch({ vectorStoreIds: ['vs_1234'] }), // requires a configured vector store
},
});
diff --git a/examples/ai-functions/src/generate-text/azure/responses-web-search-preview.ts b/examples/ai-functions/src/generate-text/azure/responses-web-search-preview.ts
deleted file mode 100644
index 3c83ab9b338a..000000000000
--- a/examples/ai-functions/src/generate-text/azure/responses-web-search-preview.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { azure } from '@ai-sdk/azure';
-import { generateText } from 'ai';
-import { run } from '../../lib/run';
-
-/**
- * prepare
- * Please add parameters in your .env file for initialize Azure OpenAI..
- * AZURE_RESOURCE_NAME=""
- * AZURE_API_KEY=""
- */
-
-run(async () => {
- // Basic text generation
- const basicResult = await generateText({
- model: azure.responses('gpt-4.1-mini'),
- prompt: 'Summarize three major news stories from today.',
- tools: {
- web_search_preview: azure.tools.webSearchPreview({
- searchContextSize: 'low',
- }),
- },
- });
-
- console.log('\n=== Basic Text Generation ===');
- console.log(basicResult.text);
- console.log('\n=== Other Outputs ===');
- console.dir(basicResult.toolCalls, { depth: Infinity });
- console.dir(basicResult.toolResults, { depth: Infinity });
- console.log('\n=== Web Search Preview Annotations ===');
- for (const part of basicResult.content) {
- if (part.type === 'text') {
- const annotations = part.providerMetadata?.azure?.annotations;
- if (annotations) {
- console.dir(annotations);
- }
- }
- }
- for (const step of basicResult.steps) {
- if (step.warnings) {
- console.log(step.warnings);
- }
- }
-});
diff --git a/examples/ai-functions/src/generate-text/azure/responses-web-search.ts b/examples/ai-functions/src/generate-text/azure/responses-web-search.ts
index 7df0620af29c..d30e6d9ff8b3 100644
--- a/examples/ai-functions/src/generate-text/azure/responses-web-search.ts
+++ b/examples/ai-functions/src/generate-text/azure/responses-web-search.ts
@@ -29,7 +29,7 @@ run(async () => {
console.log('\n=== Other Outputs ===');
console.dir(basicResult.toolCalls, { depth: Infinity });
console.dir(basicResult.toolResults, { depth: Infinity });
- console.log('\n=== Web Search Preview Annotations ===');
+ console.log('\n=== Web Search Annotations ===');
for (const part of basicResult.content) {
if (part.type === 'text') {
const annotations = part.providerMetadata?.azure?.annotations;
diff --git a/examples/ai-functions/src/stream-text/azure/responses-web-search-preview.ts b/examples/ai-functions/src/stream-text/azure/responses-web-search-preview.ts
deleted file mode 100644
index bb685bf9e4ef..000000000000
--- a/examples/ai-functions/src/stream-text/azure/responses-web-search-preview.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import { azure } from '@ai-sdk/azure';
-import { streamText } from 'ai';
-import { run } from '../../lib/run';
-
-/**
- * prepare
- * Please add parameters in your .env file for initialize Azure OpenAI..
- * AZURE_RESOURCE_NAME=""
- * AZURE_API_KEY=""
- */
-
-run(async () => {
- // Basic text generation
- const result = streamText({
- model: azure.responses('gpt-4.1-mini'), // use your own deployment
- prompt: 'Summarize three major news stories from today.',
- tools: {
- web_search_preview: azure.tools.webSearchPreview({
- searchContextSize: 'low',
- }),
- },
- });
-
- console.log('\n=== Basic Text Generation ===');
- for await (const textPart of result.textStream) {
- process.stdout.write(textPart);
- }
- console.log('\n=== Other Outputs ===');
- console.log(await result.toolCalls);
- console.log(await result.toolResults);
- console.log('\n=== Web Search Preview Annotations ===');
- for await (const part of result.stream) {
- switch (part.type) {
- case 'text-end':
- {
- const annotations = part.providerMetadata?.azure?.annotations;
- if (annotations) {
- console.dir(annotations);
- }
- }
- break;
-
- case 'source':
- if (part.sourceType === 'url') {
- console.log(`\n[source: ${part.url}]`);
- }
- break;
-
- case 'error':
- console.log('error');
- console.error(part.error);
- break;
- }
- }
-});
diff --git a/examples/ai-functions/src/stream-text/azure/responses-web-search.ts b/examples/ai-functions/src/stream-text/azure/responses-web-search.ts
index 5329c4caae44..5f3ef66e6dd4 100644
--- a/examples/ai-functions/src/stream-text/azure/responses-web-search.ts
+++ b/examples/ai-functions/src/stream-text/azure/responses-web-search.ts
@@ -31,7 +31,7 @@ run(async () => {
console.log('\n=== Other Outputs ===');
console.log(await result.toolCalls);
console.log(await result.toolResults);
- console.log('\n=== Web Search Preview Annotations ===');
+ console.log('\n=== Web Search Annotations ===');
for await (const part of result.fullStream) {
switch (part.type) {
case 'text-end':
diff --git a/packages/azure/src/azure-openai-tools.ts b/packages/azure/src/azure-openai-tools.ts
index 39cff5a4c7f2..386d41d17c04 100644
--- a/packages/azure/src/azure-openai-tools.ts
+++ b/packages/azure/src/azure-openai-tools.ts
@@ -11,6 +11,9 @@ export const azureOpenaiTools: {
fileSearch: typeof fileSearch;
imageGeneration: typeof imageGeneration;
webSearch: typeof webSearch;
+ /**
+ * @deprecated Use `webSearch` instead.
+ */
webSearchPreview: typeof webSearchPreview;
} = {
codeInterpreter,