@ai-sdk/anthropic 3.0.0-beta.70 → 3.0.0-beta.71
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 +9 -0
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +6 -1
- package/dist/internal/index.d.ts +6 -1
- package/dist/internal/index.js +8 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +8 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -479,6 +479,7 @@ type AnthropicTool = {
|
|
|
479
479
|
description: string | undefined;
|
|
480
480
|
input_schema: JSONSchema7;
|
|
481
481
|
cache_control: AnthropicCacheControl | undefined;
|
|
482
|
+
strict?: boolean;
|
|
482
483
|
} | {
|
|
483
484
|
type: 'code_execution_20250522';
|
|
484
485
|
name: string;
|
|
@@ -554,11 +555,15 @@ declare class CacheControlValidator {
|
|
|
554
555
|
getWarnings(): SharedV3Warning[];
|
|
555
556
|
}
|
|
556
557
|
|
|
557
|
-
declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, }: {
|
|
558
|
+
declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, }: {
|
|
558
559
|
tools: LanguageModelV3CallOptions['tools'];
|
|
559
560
|
toolChoice: LanguageModelV3CallOptions['toolChoice'] | undefined;
|
|
560
561
|
disableParallelToolUse?: boolean;
|
|
561
562
|
cacheControlValidator?: CacheControlValidator;
|
|
563
|
+
/**
|
|
564
|
+
* Whether the model supports structured output.
|
|
565
|
+
*/
|
|
566
|
+
supportsStructuredOutput: boolean;
|
|
562
567
|
}): Promise<{
|
|
563
568
|
tools: Array<AnthropicTool> | undefined;
|
|
564
569
|
toolChoice: AnthropicToolChoice | undefined;
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -479,6 +479,7 @@ type AnthropicTool = {
|
|
|
479
479
|
description: string | undefined;
|
|
480
480
|
input_schema: JSONSchema7;
|
|
481
481
|
cache_control: AnthropicCacheControl | undefined;
|
|
482
|
+
strict?: boolean;
|
|
482
483
|
} | {
|
|
483
484
|
type: 'code_execution_20250522';
|
|
484
485
|
name: string;
|
|
@@ -554,11 +555,15 @@ declare class CacheControlValidator {
|
|
|
554
555
|
getWarnings(): SharedV3Warning[];
|
|
555
556
|
}
|
|
556
557
|
|
|
557
|
-
declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, }: {
|
|
558
|
+
declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, }: {
|
|
558
559
|
tools: LanguageModelV3CallOptions['tools'];
|
|
559
560
|
toolChoice: LanguageModelV3CallOptions['toolChoice'] | undefined;
|
|
560
561
|
disableParallelToolUse?: boolean;
|
|
561
562
|
cacheControlValidator?: CacheControlValidator;
|
|
563
|
+
/**
|
|
564
|
+
* Whether the model supports structured output.
|
|
565
|
+
*/
|
|
566
|
+
supportsStructuredOutput: boolean;
|
|
562
567
|
}): Promise<{
|
|
563
568
|
tools: Array<AnthropicTool> | undefined;
|
|
564
569
|
toolChoice: AnthropicToolChoice | undefined;
|
package/dist/internal/index.js
CHANGED
|
@@ -849,7 +849,8 @@ async function prepareTools({
|
|
|
849
849
|
tools,
|
|
850
850
|
toolChoice,
|
|
851
851
|
disableParallelToolUse,
|
|
852
|
-
cacheControlValidator
|
|
852
|
+
cacheControlValidator,
|
|
853
|
+
supportsStructuredOutput
|
|
853
854
|
}) {
|
|
854
855
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
855
856
|
const toolWarnings = [];
|
|
@@ -870,7 +871,8 @@ async function prepareTools({
|
|
|
870
871
|
name: tool.name,
|
|
871
872
|
description: tool.description,
|
|
872
873
|
input_schema: tool.inputSchema,
|
|
873
|
-
cache_control: cacheControl
|
|
874
|
+
cache_control: cacheControl,
|
|
875
|
+
...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {}
|
|
874
876
|
});
|
|
875
877
|
break;
|
|
876
878
|
}
|
|
@@ -2132,12 +2134,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2132
2134
|
tools: [...tools != null ? tools : [], jsonResponseTool],
|
|
2133
2135
|
toolChoice: { type: "required" },
|
|
2134
2136
|
disableParallelToolUse: true,
|
|
2135
|
-
cacheControlValidator
|
|
2137
|
+
cacheControlValidator,
|
|
2138
|
+
supportsStructuredOutput
|
|
2136
2139
|
} : {
|
|
2137
2140
|
tools: tools != null ? tools : [],
|
|
2138
2141
|
toolChoice,
|
|
2139
2142
|
disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
|
|
2140
|
-
cacheControlValidator
|
|
2143
|
+
cacheControlValidator,
|
|
2144
|
+
supportsStructuredOutput
|
|
2141
2145
|
}
|
|
2142
2146
|
);
|
|
2143
2147
|
const cacheWarnings = cacheControlValidator.getWarnings();
|