@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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 4.0.50
4
+
5
+ ### Patch Changes
6
+
7
+ - e6a2992: Fix Responses history serialization for regular functions named `tool_search`.
8
+
3
9
  ## 4.0.49
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -4779,6 +4779,7 @@ async function convertToOpenAIResponsesInput({
4779
4779
  hasShellTool = false,
4780
4780
  hasApplyPatchTool = false,
4781
4781
  hasComputerTool = false,
4782
+ toolSearchToolName,
4782
4783
  customProviderToolNames,
4783
4784
  outputSchemaToolNames
4784
4785
  }) {
@@ -5009,7 +5010,7 @@ async function convertToOpenAIResponsesInput({
5009
5010
  const resolvedToolName = toolNameMapping.toProviderToolName(
5010
5011
  part.toolName
5011
5012
  );
5012
- if (resolvedToolName === "tool_search") {
5013
+ if (part.toolName === toolSearchToolName) {
5013
5014
  if (store && id != null) {
5014
5015
  input.push({ type: "item_reference", id });
5015
5016
  break;
@@ -5198,7 +5199,7 @@ async function convertToOpenAIResponsesInput({
5198
5199
  const resolvedResultToolName = toolNameMapping.toProviderToolName(
5199
5200
  part.toolName
5200
5201
  );
5201
- if (resolvedResultToolName === "tool_search") {
5202
+ if (part.toolName === toolSearchToolName) {
5202
5203
  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;
5203
5204
  if (store) {
5204
5205
  input.push({ type: "item_reference", id: itemId });
@@ -5439,7 +5440,7 @@ async function convertToOpenAIResponsesInput({
5439
5440
  const resolvedToolName = toolNameMapping.toProviderToolName(
5440
5441
  part.toolName
5441
5442
  );
5442
- if (resolvedToolName === "tool_search" && output.type === "json") {
5443
+ if (part.toolName === toolSearchToolName && output.type === "json") {
5443
5444
  const parsedOutput = await validateTypes({
5444
5445
  value: output.value,
5445
5446
  schema: toolSearchOutputSchema
@@ -6639,6 +6640,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
6639
6640
  hasShellTool: hasOpenAITool("openai.shell"),
6640
6641
  hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
6641
6642
  hasComputerTool: hasOpenAITool("openai.computer"),
6643
+ toolSearchToolName: getOpenAIToolName("openai.tool_search"),
6642
6644
  customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0,
6643
6645
  outputSchemaToolNames: outputSchemaToolNames.size > 0 ? outputSchemaToolNames : void 0
6644
6646
  });
@@ -6655,8 +6657,12 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
6655
6657
  include = [...include, key];
6656
6658
  }
6657
6659
  }
6660
+ function getOpenAIToolName(id) {
6661
+ var _a3;
6662
+ return (_a3 = tools == null ? void 0 : tools.find((tool) => tool.type === "provider" && tool.id === id)) == null ? void 0 : _a3.name;
6663
+ }
6658
6664
  function hasOpenAITool(id) {
6659
- return (tools == null ? void 0 : tools.find((tool) => tool.type === "provider" && tool.id === id)) != null;
6665
+ return getOpenAIToolName(id) != null;
6660
6666
  }
6661
6667
  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;
6662
6668
  if (topLogprobs) {
@@ -10606,7 +10612,7 @@ var OpenAISkills = class {
10606
10612
  };
10607
10613
 
10608
10614
  // src/version.ts
10609
- var VERSION = true ? "4.0.49" : "0.0.0-test";
10615
+ var VERSION = true ? "4.0.50" : "0.0.0-test";
10610
10616
 
10611
10617
  // src/openai-provider.ts
10612
10618
  function createOpenAI(options = {}) {