@ai-sdk/openai 3.0.133 → 3.0.134

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,12 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.134
4
+
5
+ ### Patch Changes
6
+
7
+ - 84a2231: fix(openai): report unfinished web searches as tool errors
8
+ - 84a2231: Report failed and incomplete web searches as tool errors instead of successful tool results in OpenAI Responses API calls.
9
+
3
10
  ## 3.0.133
4
11
 
5
12
  ### Patch Changes
package/dist/index.js CHANGED
@@ -6657,7 +6657,7 @@ var OpenAIResponsesLanguageModel = class {
6657
6657
  toolName: toolNameMapping.toCustomToolName(
6658
6658
  webSearchToolName != null ? webSearchToolName : "web_search"
6659
6659
  ),
6660
- result: mapWebSearchOutput(part.action)
6660
+ ...mapWebSearchResult(part)
6661
6661
  });
6662
6662
  break;
6663
6663
  }
@@ -7261,7 +7261,7 @@ var OpenAIResponsesLanguageModel = class {
7261
7261
  toolName: toolNameMapping.toCustomToolName(
7262
7262
  webSearchToolName != null ? webSearchToolName : "web_search"
7263
7263
  ),
7264
- result: mapWebSearchOutput(value.item.action)
7264
+ ...mapWebSearchResult(value.item)
7265
7265
  });
7266
7266
  } else if (value.item.type === "computer_call") {
7267
7267
  ongoingToolCalls[value.output_index] = void 0;
@@ -7943,6 +7943,12 @@ function isErrorChunk(chunk) {
7943
7943
  function isResponseOutputChunk(chunk) {
7944
7944
  return !(chunk.type === "response.created" || chunk.type === "response.failed" || chunk.type === "error" || chunk.type === "unknown_chunk");
7945
7945
  }
7946
+ function mapWebSearchResult({
7947
+ action,
7948
+ status
7949
+ }) {
7950
+ return status === "completed" ? { result: mapWebSearchOutput(action) } : { isError: true, result: { status } };
7951
+ }
7946
7952
  function mapWebSearchOutput(action) {
7947
7953
  var _a2;
7948
7954
  if (action == null) {
@@ -8334,7 +8340,7 @@ var OpenAITranscriptionModel = class {
8334
8340
  };
8335
8341
 
8336
8342
  // src/version.ts
8337
- var VERSION = true ? "3.0.133" : "0.0.0-test";
8343
+ var VERSION = true ? "3.0.134" : "0.0.0-test";
8338
8344
 
8339
8345
  // src/openai-provider.ts
8340
8346
  function createOpenAI(options = {}) {