From 8124344c51f035d4ec4f999d4fac77ccf06dd877 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Wed, 5 Nov 2025 21:24:16 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20chore:=20Update=20tool=20type=20?= =?UTF-8?q?from=20`web=5Fsearch=5Fpreview`=20to=20`web=5Fsearch`=20for=20O?= =?UTF-8?q?penAI=20(#10379)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../endpoints/openai/config.backward-compat.spec.ts | 2 +- packages/api/src/endpoints/openai/config.spec.ts | 10 +++++----- packages/api/src/endpoints/openai/llm.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/api/src/endpoints/openai/config.backward-compat.spec.ts b/packages/api/src/endpoints/openai/config.backward-compat.spec.ts index 0411fe43d5..78b854b4b0 100644 --- a/packages/api/src/endpoints/openai/config.backward-compat.spec.ts +++ b/packages/api/src/endpoints/openai/config.backward-compat.spec.ts @@ -48,7 +48,7 @@ describe('getOpenAIConfig - Backward Compatibility', () => { configOptions: {}, tools: [ { - type: 'web_search_preview', + type: 'web_search', }, ], }); diff --git a/packages/api/src/endpoints/openai/config.spec.ts b/packages/api/src/endpoints/openai/config.spec.ts index b1faac9012..fcdf0fa83d 100644 --- a/packages/api/src/endpoints/openai/config.spec.ts +++ b/packages/api/src/endpoints/openai/config.spec.ts @@ -230,7 +230,7 @@ describe('getOpenAIConfig', () => { const result = getOpenAIConfig(mockApiKey, { modelOptions }); expect(result.llmConfig.useResponsesApi).toBe(true); - expect(result.tools).toEqual([{ type: 'web_search_preview' }]); + expect(result.tools).toEqual([{ type: 'web_search' }]); }); it('should handle web_search from addParams overriding modelOptions', () => { @@ -247,7 +247,7 @@ describe('getOpenAIConfig', () => { const result = getOpenAIConfig(mockApiKey, { modelOptions, addParams }); expect(result.llmConfig.useResponsesApi).toBe(true); - expect(result.tools).toEqual([{ type: 'web_search_preview' }]); + expect(result.tools).toEqual([{ type: 'web_search' }]); // web_search should not be in modelKwargs or llmConfig expect((result.llmConfig as Record).web_search).toBeUndefined(); expect(result.llmConfig.modelKwargs).toEqual({ customParam: 'value' }); @@ -299,7 +299,7 @@ describe('getOpenAIConfig', () => { // Should keep the original web_search from modelOptions since addParams value is not boolean expect(result.llmConfig.useResponsesApi).toBe(true); - expect(result.tools).toEqual([{ type: 'web_search_preview' }]); + expect(result.tools).toEqual([{ type: 'web_search' }]); expect(result.llmConfig.temperature).toBe(0.7); // web_search should not be added to modelKwargs expect(result.llmConfig.modelKwargs).toBeUndefined(); @@ -335,7 +335,7 @@ describe('getOpenAIConfig', () => { // web_search should trigger the tool but not appear in config expect(result.llmConfig.useResponsesApi).toBe(true); - expect(result.tools).toEqual([{ type: 'web_search_preview' }]); + expect(result.tools).toEqual([{ type: 'web_search' }]); expect((result.llmConfig as Record).web_search).toBeUndefined(); expect(result.llmConfig.temperature).toBe(0.5); expect(result.llmConfig.modelKwargs).toEqual({ customParam1: 'value1' }); @@ -1164,7 +1164,7 @@ describe('getOpenAIConfig', () => { text: { verbosity: Verbosity.medium }, customParam: 'custom-value', }); - expect(result.tools).toEqual([{ type: 'web_search_preview' }]); + expect(result.tools).toEqual([{ type: 'web_search' }]); expect(result.configOptions).toMatchObject({ baseURL: 'https://api.custom.com', defaultHeaders: { 'X-Custom': 'value' }, diff --git a/packages/api/src/endpoints/openai/llm.ts b/packages/api/src/endpoints/openai/llm.ts index 4ce896e291..ee2a3da330 100644 --- a/packages/api/src/endpoints/openai/llm.ts +++ b/packages/api/src/endpoints/openai/llm.ts @@ -190,7 +190,7 @@ export function getOpenAILLMConfig({ } else if (enableWebSearch) { /** Standard OpenAI web search uses tools API */ llmConfig.useResponsesApi = true; - tools.push({ type: 'web_search_preview' }); + tools.push({ type: 'web_search' }); } /**