@ai-sdk/anthropic 2.0.50 → 2.0.52

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,17 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 2.0.52
4
+
5
+ ### Patch Changes
6
+
7
+ - 518e786: fix(anthropic): send {} as tool input when streaming tool calls without arguments
8
+
9
+ ## 2.0.51
10
+
11
+ ### Patch Changes
12
+
13
+ - a54839c: fix(anthropic): pull first chunk without async IIFE
14
+
3
15
  ## 2.0.50
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
31
31
  var import_provider_utils20 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/version.ts
34
- var VERSION = true ? "2.0.50" : "0.0.0-test";
34
+ var VERSION = true ? "2.0.52" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
@@ -2646,7 +2646,7 @@ var AnthropicMessagesLanguageModel = class {
2646
2646
  type: "tool-call",
2647
2647
  toolCallId: contentBlock.toolCallId,
2648
2648
  toolName,
2649
- input: contentBlock.input,
2649
+ input: contentBlock.input === "" ? "{}" : contentBlock.input,
2650
2650
  providerExecuted: contentBlock.providerExecuted
2651
2651
  });
2652
2652
  }
@@ -2813,22 +2813,20 @@ var AnthropicMessagesLanguageModel = class {
2813
2813
  );
2814
2814
  const [streamForFirstChunk, streamForConsumer] = transformedStream.tee();
2815
2815
  stream = streamForConsumer;
2816
- const reader = streamForFirstChunk.getReader();
2817
- (async () => {
2816
+ const firstChunkReader = streamForFirstChunk.getReader();
2817
+ try {
2818
+ const { done } = await firstChunkReader.read();
2819
+ if (!done) {
2820
+ firstChunkReader.cancel();
2821
+ }
2822
+ } catch (error) {
2818
2823
  try {
2819
- const { done } = await reader.read();
2820
- if (!done) {
2821
- await reader.cancel();
2822
- }
2823
- } catch (error) {
2824
- try {
2825
- await reader.cancel();
2826
- } catch (e) {
2827
- }
2828
- } finally {
2829
- reader.releaseLock();
2824
+ firstChunkReader.cancel();
2825
+ } catch (e) {
2830
2826
  }
2831
- })();
2827
+ } finally {
2828
+ firstChunkReader.releaseLock();
2829
+ }
2832
2830
  return returnPromise.promise;
2833
2831
  }
2834
2832
  };