Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/quiet-azure-web-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ai-sdk/azure': patch
---

Deprecate `azure.tools.webSearchPreview()` in favor of `azure.tools.webSearch()`.
4 changes: 2 additions & 2 deletions content/cookbook/00-guides/19-openai-responses.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
});

Expand All @@ -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',
Expand Down
10 changes: 8 additions & 2 deletions content/providers/01-ai-sdk-providers/04-azure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,12 @@ for continuation, compaction, and configuration restrictions.

The Azure OpenAI responses API supports web search through the `azure.tools.webSearch` tool.

<Note>
`azure.tools.webSearchPreview()` is deprecated. Use `azure.tools.webSearch()`
instead. The existing `searchContextSize` and `userLocation` options are
supported by both tools.
</Note>

```ts
const result = await generateText({
model: azure('gpt-5'),
Expand Down Expand Up @@ -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
},
});
Expand Down Expand Up @@ -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
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
});
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
3 changes: 3 additions & 0 deletions packages/azure/src/azure-openai-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const azureOpenaiTools: {
fileSearch: typeof fileSearch;
imageGeneration: typeof imageGeneration;
webSearch: typeof webSearch;
/**
* @deprecated Use `webSearch` instead.
*/
webSearchPreview: typeof webSearchPreview;
} = {
codeInterpreter,
Expand Down
Loading