@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.
@@ -2639,7 +2639,7 @@ var AnthropicMessagesLanguageModel = class {
2639
2639
  type: "tool-call",
2640
2640
  toolCallId: contentBlock.toolCallId,
2641
2641
  toolName,
2642
- input: contentBlock.input,
2642
+ input: contentBlock.input === "" ? "{}" : contentBlock.input,
2643
2643
  providerExecuted: contentBlock.providerExecuted
2644
2644
  });
2645
2645
  }
@@ -2806,22 +2806,20 @@ var AnthropicMessagesLanguageModel = class {
2806
2806
  );
2807
2807
  const [streamForFirstChunk, streamForConsumer] = transformedStream.tee();
2808
2808
  stream = streamForConsumer;
2809
- const reader = streamForFirstChunk.getReader();
2810
- (async () => {
2809
+ const firstChunkReader = streamForFirstChunk.getReader();
2810
+ try {
2811
+ const { done } = await firstChunkReader.read();
2812
+ if (!done) {
2813
+ firstChunkReader.cancel();
2814
+ }
2815
+ } catch (error) {
2811
2816
  try {
2812
- const { done } = await reader.read();
2813
- if (!done) {
2814
- await reader.cancel();
2815
- }
2816
- } catch (error) {
2817
- try {
2818
- await reader.cancel();
2819
- } catch (e) {
2820
- }
2821
- } finally {
2822
- reader.releaseLock();
2817
+ firstChunkReader.cancel();
2818
+ } catch (e) {
2823
2819
  }
2824
- })();
2820
+ } finally {
2821
+ firstChunkReader.releaseLock();
2822
+ }
2825
2823
  return returnPromise.promise;
2826
2824
  }
2827
2825
  };