@ai-sdk/openai 4.0.49 → 4.0.51

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.
@@ -3737,6 +3737,7 @@ async function convertToOpenAIResponsesInput({
3737
3737
  hasShellTool = false,
3738
3738
  hasApplyPatchTool = false,
3739
3739
  hasComputerTool = false,
3740
+ toolSearchToolName,
3740
3741
  customProviderToolNames,
3741
3742
  outputSchemaToolNames
3742
3743
  }) {
@@ -3967,7 +3968,7 @@ async function convertToOpenAIResponsesInput({
3967
3968
  const resolvedToolName = toolNameMapping.toProviderToolName(
3968
3969
  part.toolName
3969
3970
  );
3970
- if (resolvedToolName === "tool_search") {
3971
+ if (part.toolName === toolSearchToolName) {
3971
3972
  if (store && id != null) {
3972
3973
  input.push({ type: "item_reference", id });
3973
3974
  break;
@@ -4156,7 +4157,7 @@ async function convertToOpenAIResponsesInput({
4156
4157
  const resolvedResultToolName = toolNameMapping.toProviderToolName(
4157
4158
  part.toolName
4158
4159
  );
4159
- if (resolvedResultToolName === "tool_search") {
4160
+ if (part.toolName === toolSearchToolName) {
4160
4161
  const itemId = (_u = (_t = (_q = (_p = part.providerOptions) == null ? void 0 : _p[providerOptionsName]) == null ? void 0 : _q.itemId) != null ? _t : (_s = (_r = part.providerMetadata) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.itemId) != null ? _u : part.toolCallId;
4161
4162
  if (store) {
4162
4163
  input.push({ type: "item_reference", id: itemId });
@@ -4397,7 +4398,7 @@ async function convertToOpenAIResponsesInput({
4397
4398
  const resolvedToolName = toolNameMapping.toProviderToolName(
4398
4399
  part.toolName
4399
4400
  );
4400
- if (resolvedToolName === "tool_search" && output.type === "json") {
4401
+ if (part.toolName === toolSearchToolName && output.type === "json") {
4401
4402
  const parsedOutput = await validateTypes({
4402
4403
  value: output.value,
4403
4404
  schema: toolSearchOutputSchema
@@ -7029,6 +7030,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7029
7030
  hasShellTool: hasOpenAITool("openai.shell"),
7030
7031
  hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
7031
7032
  hasComputerTool: hasOpenAITool("openai.computer"),
7033
+ toolSearchToolName: getOpenAIToolName("openai.tool_search"),
7032
7034
  customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0,
7033
7035
  outputSchemaToolNames: outputSchemaToolNames.size > 0 ? outputSchemaToolNames : void 0
7034
7036
  });
@@ -7045,8 +7047,12 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
7045
7047
  include = [...include, key];
7046
7048
  }
7047
7049
  }
7050
+ function getOpenAIToolName(id) {
7051
+ var _a3;
7052
+ return (_a3 = tools == null ? void 0 : tools.find((tool) => tool.type === "provider" && tool.id === id)) == null ? void 0 : _a3.name;
7053
+ }
7048
7054
  function hasOpenAITool(id) {
7049
- return (tools == null ? void 0 : tools.find((tool) => tool.type === "provider" && tool.id === id)) != null;
7055
+ return getOpenAIToolName(id) != null;
7050
7056
  }
7051
7057
  const topLogprobs = typeof (openaiOptions == null ? void 0 : openaiOptions.logprobs) === "number" ? openaiOptions == null ? void 0 : openaiOptions.logprobs : (openaiOptions == null ? void 0 : openaiOptions.logprobs) === true ? TOP_LOGPROBS_MAX : void 0;
7052
7058
  if (topLogprobs) {