@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.
@@ -2651,7 +2651,7 @@ var AnthropicMessagesLanguageModel = class {
2651
2651
  type: "tool-call",
2652
2652
  toolCallId: contentBlock.toolCallId,
2653
2653
  toolName,
2654
- input: contentBlock.input,
2654
+ input: contentBlock.input === "" ? "{}" : contentBlock.input,
2655
2655
  providerExecuted: contentBlock.providerExecuted
2656
2656
  });
2657
2657
  }
@@ -2818,22 +2818,20 @@ var AnthropicMessagesLanguageModel = class {
2818
2818
  );
2819
2819
  const [streamForFirstChunk, streamForConsumer] = transformedStream.tee();
2820
2820
  stream = streamForConsumer;
2821
- const reader = streamForFirstChunk.getReader();
2822
- (async () => {
2821
+ const firstChunkReader = streamForFirstChunk.getReader();
2822
+ try {
2823
+ const { done } = await firstChunkReader.read();
2824
+ if (!done) {
2825
+ firstChunkReader.cancel();
2826
+ }
2827
+ } catch (error) {
2823
2828
  try {
2824
- const { done } = await reader.read();
2825
- if (!done) {
2826
- await reader.cancel();
2827
- }
2828
- } catch (error) {
2829
- try {
2830
- await reader.cancel();
2831
- } catch (e) {
2832
- }
2833
- } finally {
2834
- reader.releaseLock();
2829
+ firstChunkReader.cancel();
2830
+ } catch (e) {
2835
2831
  }
2836
- })();
2832
+ } finally {
2833
+ firstChunkReader.releaseLock();
2834
+ }
2837
2835
  return returnPromise.promise;
2838
2836
  }
2839
2837
  };