@ai-sdk/anthropic 4.0.8 → 4.0.9

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.
@@ -2878,7 +2878,7 @@ async function convertToAnthropicPrompt({
2878
2878
  type: "tool_use",
2879
2879
  id: part.toolCallId,
2880
2880
  name: part.toolName,
2881
- input: part.input,
2881
+ input: toAnthropicToolInput(part.input),
2882
2882
  ...caller && { caller },
2883
2883
  cache_control: cacheControl
2884
2884
  });
@@ -3278,6 +3278,9 @@ function moveToolUseBlocksToEnd(content) {
3278
3278
  flushSegment();
3279
3279
  return result;
3280
3280
  }
3281
+ function toAnthropicToolInput(input) {
3282
+ return typeof input === "object" && input !== null && !Array.isArray(input) ? input : { rawInvalidInput: input };
3283
+ }
3281
3284
 
3282
3285
  // src/map-anthropic-stop-reason.ts
3283
3286
  function mapAnthropicStopReason({