Skip to content

Commit 8124344

Browse files
authored
🌐 chore: Update tool type from web_search_preview to web_search for OpenAI (danny-avila#10379)
1 parent 667e78c commit 8124344

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

packages/api/src/endpoints/openai/config.backward-compat.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('getOpenAIConfig - Backward Compatibility', () => {
4848
configOptions: {},
4949
tools: [
5050
{
51-
type: 'web_search_preview',
51+
type: 'web_search',
5252
},
5353
],
5454
});

packages/api/src/endpoints/openai/config.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ describe('getOpenAIConfig', () => {
230230
const result = getOpenAIConfig(mockApiKey, { modelOptions });
231231

232232
expect(result.llmConfig.useResponsesApi).toBe(true);
233-
expect(result.tools).toEqual([{ type: 'web_search_preview' }]);
233+
expect(result.tools).toEqual([{ type: 'web_search' }]);
234234
});
235235

236236
it('should handle web_search from addParams overriding modelOptions', () => {
@@ -247,7 +247,7 @@ describe('getOpenAIConfig', () => {
247247
const result = getOpenAIConfig(mockApiKey, { modelOptions, addParams });
248248

249249
expect(result.llmConfig.useResponsesApi).toBe(true);
250-
expect(result.tools).toEqual([{ type: 'web_search_preview' }]);
250+
expect(result.tools).toEqual([{ type: 'web_search' }]);
251251
// web_search should not be in modelKwargs or llmConfig
252252
expect((result.llmConfig as Record<string, unknown>).web_search).toBeUndefined();
253253
expect(result.llmConfig.modelKwargs).toEqual({ customParam: 'value' });
@@ -299,7 +299,7 @@ describe('getOpenAIConfig', () => {
299299

300300
// Should keep the original web_search from modelOptions since addParams value is not boolean
301301
expect(result.llmConfig.useResponsesApi).toBe(true);
302-
expect(result.tools).toEqual([{ type: 'web_search_preview' }]);
302+
expect(result.tools).toEqual([{ type: 'web_search' }]);
303303
expect(result.llmConfig.temperature).toBe(0.7);
304304
// web_search should not be added to modelKwargs
305305
expect(result.llmConfig.modelKwargs).toBeUndefined();
@@ -335,7 +335,7 @@ describe('getOpenAIConfig', () => {
335335

336336
// web_search should trigger the tool but not appear in config
337337
expect(result.llmConfig.useResponsesApi).toBe(true);
338-
expect(result.tools).toEqual([{ type: 'web_search_preview' }]);
338+
expect(result.tools).toEqual([{ type: 'web_search' }]);
339339
expect((result.llmConfig as Record<string, unknown>).web_search).toBeUndefined();
340340
expect(result.llmConfig.temperature).toBe(0.5);
341341
expect(result.llmConfig.modelKwargs).toEqual({ customParam1: 'value1' });
@@ -1164,7 +1164,7 @@ describe('getOpenAIConfig', () => {
11641164
text: { verbosity: Verbosity.medium },
11651165
customParam: 'custom-value',
11661166
});
1167-
expect(result.tools).toEqual([{ type: 'web_search_preview' }]);
1167+
expect(result.tools).toEqual([{ type: 'web_search' }]);
11681168
expect(result.configOptions).toMatchObject({
11691169
baseURL: 'https://api.custom.com',
11701170
defaultHeaders: { 'X-Custom': 'value' },

packages/api/src/endpoints/openai/llm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export function getOpenAILLMConfig({
190190
} else if (enableWebSearch) {
191191
/** Standard OpenAI web search uses tools API */
192192
llmConfig.useResponsesApi = true;
193-
tools.push({ type: 'web_search_preview' });
193+
tools.push({ type: 'web_search' });
194194
}
195195

196196
/**

0 commit comments

Comments
 (0)