@ai-sdk/openai 4.0.49 → 4.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/openai",
3
- "version": "4.0.49",
3
+ "version": "4.0.50",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -314,6 +314,7 @@ export async function convertToOpenAIResponsesInput({
314
314
  hasShellTool = false,
315
315
  hasApplyPatchTool = false,
316
316
  hasComputerTool = false,
317
+ toolSearchToolName,
317
318
  customProviderToolNames,
318
319
  outputSchemaToolNames,
319
320
  }: {
@@ -331,6 +332,7 @@ export async function convertToOpenAIResponsesInput({
331
332
  hasShellTool?: boolean;
332
333
  hasApplyPatchTool?: boolean;
333
334
  hasComputerTool?: boolean;
335
+ toolSearchToolName?: string;
334
336
  customProviderToolNames?: Set<string>;
335
337
  outputSchemaToolNames?: Set<string>;
336
338
  }): Promise<{
@@ -653,7 +655,7 @@ export async function convertToOpenAIResponsesInput({
653
655
  part.toolName,
654
656
  );
655
657
 
656
- if (resolvedToolName === 'tool_search') {
658
+ if (part.toolName === toolSearchToolName) {
657
659
  if (store && id != null) {
658
660
  input.push({ type: 'item_reference', id });
659
661
  break;
@@ -908,7 +910,7 @@ export async function convertToOpenAIResponsesInput({
908
910
  part.toolName,
909
911
  );
910
912
 
911
- if (resolvedResultToolName === 'tool_search') {
913
+ if (part.toolName === toolSearchToolName) {
912
914
  const itemId = (part.providerOptions?.[providerOptionsName]
913
915
  ?.itemId ??
914
916
  (
@@ -1261,7 +1263,7 @@ export async function convertToOpenAIResponsesInput({
1261
1263
  part.toolName,
1262
1264
  );
1263
1265
 
1264
- if (resolvedToolName === 'tool_search' && output.type === 'json') {
1266
+ if (part.toolName === toolSearchToolName && output.type === 'json') {
1265
1267
  const parsedOutput = await validateTypes({
1266
1268
  value: output.value,
1267
1269
  schema: toolSearchOutputSchema,
@@ -367,6 +367,7 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV4 {
367
367
  hasShellTool: hasOpenAITool('openai.shell'),
368
368
  hasApplyPatchTool: hasOpenAITool('openai.apply_patch'),
369
369
  hasComputerTool: hasOpenAITool('openai.computer'),
370
+ toolSearchToolName: getOpenAIToolName('openai.tool_search'),
370
371
  customProviderToolNames:
371
372
  customProviderToolNames.size > 0
372
373
  ? customProviderToolNames
@@ -396,10 +397,13 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV4 {
396
397
  }
397
398
  }
398
399
 
400
+ function getOpenAIToolName(id: string) {
401
+ return tools?.find(tool => tool.type === 'provider' && tool.id === id)
402
+ ?.name;
403
+ }
404
+
399
405
  function hasOpenAITool(id: string) {
400
- return (
401
- tools?.find(tool => tool.type === 'provider' && tool.id === id) != null
402
- );
406
+ return getOpenAIToolName(id) != null;
403
407
  }
404
408
 
405
409
  // when logprobs are requested, automatically include them: