@ai-sdk/amazon-bedrock 3.0.126 → 3.0.128
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 +13 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +52 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/amazon-bedrock
|
|
2
2
|
|
|
3
|
+
## 3.0.128
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [78a29c2]
|
|
8
|
+
- @ai-sdk/anthropic@2.0.101
|
|
9
|
+
|
|
10
|
+
## 3.0.127
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 27787e5: Add a structured output mode option and default Claude Sonnet 4.6 and Claude Haiku 4.5 to the JSON tool fallback.
|
|
15
|
+
|
|
3
16
|
## 3.0.126
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/anthropic/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
|
35
35
|
var import_aws4fetch = require("aws4fetch");
|
|
36
36
|
|
|
37
37
|
// src/version.ts
|
|
38
|
-
var VERSION = true ? "3.0.
|
|
38
|
+
var VERSION = true ? "3.0.128" : "0.0.0-test";
|
|
39
39
|
|
|
40
40
|
// src/bedrock-sigv4-fetch.ts
|
|
41
41
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
package/dist/anthropic/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { AwsV4Signer } from "aws4fetch";
|
|
25
25
|
|
|
26
26
|
// src/version.ts
|
|
27
|
-
var VERSION = true ? "3.0.
|
|
27
|
+
var VERSION = true ? "3.0.128" : "0.0.0-test";
|
|
28
28
|
|
|
29
29
|
// src/bedrock-sigv4-fetch.ts
|
|
30
30
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,11 @@ import { z } from 'zod/v4';
|
|
|
5
5
|
|
|
6
6
|
type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-sonnet-5' | 'anthropic.claude-fable-5' | 'anthropic.claude-opus-4-8' | 'anthropic.claude-opus-4-7' | 'anthropic.claude-opus-4-6-v1' | 'anthropic.claude-sonnet-4-6-v1' | 'anthropic.claude-opus-4-5-20251101-v1:0' | 'anthropic.claude-haiku-4-5-20251001-v1:0' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-sonnet-4-5-20250929-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-opus-4-1-20250805-v1:0' | 'anthropic.claude-3-7-sonnet-20250219-v1:0' | 'anthropic.claude-3-5-sonnet-20240620-v1:0' | 'anthropic.claude-3-5-sonnet-20241022-v2:0' | 'anthropic.claude-3-5-haiku-20241022-v1:0' | 'anthropic.claude-3-sonnet-20240229-v1:0' | 'anthropic.claude-3-haiku-20240307-v1:0' | 'anthropic.claude-3-opus-20240229-v1:0' | 'cohere.command-text-v14' | 'cohere.command-light-text-v14' | 'cohere.command-r-v1:0' | 'cohere.command-r-plus-v1:0' | 'meta.llama3-70b-instruct-v1:0' | 'meta.llama3-8b-instruct-v1:0' | 'meta.llama3-1-405b-instruct-v1:0' | 'meta.llama3-1-70b-instruct-v1:0' | 'meta.llama3-1-8b-instruct-v1:0' | 'meta.llama3-2-11b-instruct-v1:0' | 'meta.llama3-2-1b-instruct-v1:0' | 'meta.llama3-2-3b-instruct-v1:0' | 'meta.llama3-2-90b-instruct-v1:0' | 'mistral.mistral-7b-instruct-v0:2' | 'mistral.mixtral-8x7b-instruct-v0:1' | 'mistral.mistral-large-2402-v1:0' | 'mistral.mistral-small-2402-v1:0' | 'openai.gpt-oss-120b-1:0' | 'openai.gpt-oss-20b-1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | 'us.amazon.nova-premier-v1:0' | 'us.amazon.nova-pro-v1:0' | 'us.amazon.nova-micro-v1:0' | 'us.amazon.nova-lite-v1:0' | 'us.anthropic.claude-3-sonnet-20240229-v1:0' | 'us.anthropic.claude-3-opus-20240229-v1:0' | 'us.anthropic.claude-3-haiku-20240307-v1:0' | 'us.anthropic.claude-3-5-sonnet-20240620-v1:0' | 'us.anthropic.claude-3-5-haiku-20241022-v1:0' | 'us.anthropic.claude-3-5-sonnet-20241022-v2:0' | 'us.anthropic.claude-3-7-sonnet-20250219-v1:0' | 'us.anthropic.claude-sonnet-5' | 'us.anthropic.claude-fable-5' | 'us.anthropic.claude-opus-4-8' | 'us.anthropic.claude-opus-4-7' | 'us.anthropic.claude-opus-4-6-v1' | 'us.anthropic.claude-sonnet-4-6-v1' | 'us.anthropic.claude-opus-4-5-20251101-v1:0' | 'us.anthropic.claude-sonnet-4-5-20250929-v1:0' | 'us.anthropic.claude-sonnet-4-20250514-v1:0' | 'us.anthropic.claude-sonnet-4-5-20250929-v1:0' | 'us.anthropic.claude-opus-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-1-20250805-v1:0' | 'us.meta.llama3-2-11b-instruct-v1:0' | 'us.meta.llama3-2-3b-instruct-v1:0' | 'us.meta.llama3-2-90b-instruct-v1:0' | 'us.meta.llama3-2-1b-instruct-v1:0' | 'us.meta.llama3-1-8b-instruct-v1:0' | 'us.meta.llama3-1-70b-instruct-v1:0' | 'us.meta.llama3-3-70b-instruct-v1:0' | 'us.deepseek.r1-v1:0' | 'us.mistral.pixtral-large-2502-v1:0' | 'us.meta.llama4-scout-17b-instruct-v1:0' | 'us.meta.llama4-maverick-17b-instruct-v1:0' | (string & {});
|
|
7
7
|
declare const bedrockProviderOptions: z.ZodObject<{
|
|
8
|
+
structuredOutputMode: z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
outputFormat: "outputFormat";
|
|
10
|
+
jsonTool: "jsonTool";
|
|
11
|
+
auto: "auto";
|
|
12
|
+
}>>;
|
|
8
13
|
additionalModelRequestFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
9
14
|
reasoningConfig: z.ZodOptional<z.ZodObject<{
|
|
10
15
|
type: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">, z.ZodLiteral<"adaptive">]>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ import { z } from 'zod/v4';
|
|
|
5
5
|
|
|
6
6
|
type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-sonnet-5' | 'anthropic.claude-fable-5' | 'anthropic.claude-opus-4-8' | 'anthropic.claude-opus-4-7' | 'anthropic.claude-opus-4-6-v1' | 'anthropic.claude-sonnet-4-6-v1' | 'anthropic.claude-opus-4-5-20251101-v1:0' | 'anthropic.claude-haiku-4-5-20251001-v1:0' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-sonnet-4-5-20250929-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-opus-4-1-20250805-v1:0' | 'anthropic.claude-3-7-sonnet-20250219-v1:0' | 'anthropic.claude-3-5-sonnet-20240620-v1:0' | 'anthropic.claude-3-5-sonnet-20241022-v2:0' | 'anthropic.claude-3-5-haiku-20241022-v1:0' | 'anthropic.claude-3-sonnet-20240229-v1:0' | 'anthropic.claude-3-haiku-20240307-v1:0' | 'anthropic.claude-3-opus-20240229-v1:0' | 'cohere.command-text-v14' | 'cohere.command-light-text-v14' | 'cohere.command-r-v1:0' | 'cohere.command-r-plus-v1:0' | 'meta.llama3-70b-instruct-v1:0' | 'meta.llama3-8b-instruct-v1:0' | 'meta.llama3-1-405b-instruct-v1:0' | 'meta.llama3-1-70b-instruct-v1:0' | 'meta.llama3-1-8b-instruct-v1:0' | 'meta.llama3-2-11b-instruct-v1:0' | 'meta.llama3-2-1b-instruct-v1:0' | 'meta.llama3-2-3b-instruct-v1:0' | 'meta.llama3-2-90b-instruct-v1:0' | 'mistral.mistral-7b-instruct-v0:2' | 'mistral.mixtral-8x7b-instruct-v0:1' | 'mistral.mistral-large-2402-v1:0' | 'mistral.mistral-small-2402-v1:0' | 'openai.gpt-oss-120b-1:0' | 'openai.gpt-oss-20b-1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | 'us.amazon.nova-premier-v1:0' | 'us.amazon.nova-pro-v1:0' | 'us.amazon.nova-micro-v1:0' | 'us.amazon.nova-lite-v1:0' | 'us.anthropic.claude-3-sonnet-20240229-v1:0' | 'us.anthropic.claude-3-opus-20240229-v1:0' | 'us.anthropic.claude-3-haiku-20240307-v1:0' | 'us.anthropic.claude-3-5-sonnet-20240620-v1:0' | 'us.anthropic.claude-3-5-haiku-20241022-v1:0' | 'us.anthropic.claude-3-5-sonnet-20241022-v2:0' | 'us.anthropic.claude-3-7-sonnet-20250219-v1:0' | 'us.anthropic.claude-sonnet-5' | 'us.anthropic.claude-fable-5' | 'us.anthropic.claude-opus-4-8' | 'us.anthropic.claude-opus-4-7' | 'us.anthropic.claude-opus-4-6-v1' | 'us.anthropic.claude-sonnet-4-6-v1' | 'us.anthropic.claude-opus-4-5-20251101-v1:0' | 'us.anthropic.claude-sonnet-4-5-20250929-v1:0' | 'us.anthropic.claude-sonnet-4-20250514-v1:0' | 'us.anthropic.claude-sonnet-4-5-20250929-v1:0' | 'us.anthropic.claude-opus-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-1-20250805-v1:0' | 'us.meta.llama3-2-11b-instruct-v1:0' | 'us.meta.llama3-2-3b-instruct-v1:0' | 'us.meta.llama3-2-90b-instruct-v1:0' | 'us.meta.llama3-2-1b-instruct-v1:0' | 'us.meta.llama3-1-8b-instruct-v1:0' | 'us.meta.llama3-1-70b-instruct-v1:0' | 'us.meta.llama3-3-70b-instruct-v1:0' | 'us.deepseek.r1-v1:0' | 'us.mistral.pixtral-large-2502-v1:0' | 'us.meta.llama4-scout-17b-instruct-v1:0' | 'us.meta.llama4-maverick-17b-instruct-v1:0' | (string & {});
|
|
7
7
|
declare const bedrockProviderOptions: z.ZodObject<{
|
|
8
|
+
structuredOutputMode: z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
outputFormat: "outputFormat";
|
|
10
|
+
jsonTool: "jsonTool";
|
|
11
|
+
auto: "auto";
|
|
12
|
+
}>>;
|
|
8
13
|
additionalModelRequestFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
9
14
|
reasoningConfig: z.ZodOptional<z.ZodObject<{
|
|
10
15
|
type: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">, z.ZodLiteral<"adaptive">]>>;
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
30
30
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "3.0.
|
|
33
|
+
var VERSION = true ? "3.0.128" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/bedrock-provider.ts
|
|
36
36
|
var import_internal3 = require("@ai-sdk/anthropic/internal");
|
|
@@ -89,6 +89,14 @@ var bedrockFilePartProviderOptions = import_v4.z.object({
|
|
|
89
89
|
}).optional()
|
|
90
90
|
});
|
|
91
91
|
var bedrockProviderOptions = import_v4.z.object({
|
|
92
|
+
/**
|
|
93
|
+
* Determines how structured outputs are generated for Anthropic models.
|
|
94
|
+
*
|
|
95
|
+
* - `outputFormat`: Use the native `output_config.format` parameter.
|
|
96
|
+
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
97
|
+
* - `auto`: Use `outputFormat` when supported, otherwise use `jsonTool` (default).
|
|
98
|
+
*/
|
|
99
|
+
structuredOutputMode: import_v4.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
92
100
|
/**
|
|
93
101
|
* Additional inference parameters that the model supports,
|
|
94
102
|
* beyond the base set of inference parameters that Converse
|
|
@@ -761,7 +769,8 @@ function mapBedrockFinishReason(finishReason, isJsonResponseFromTool) {
|
|
|
761
769
|
|
|
762
770
|
// src/bedrock-chat-language-model.ts
|
|
763
771
|
var anthropicProviderOptions = import_v44.z.object({
|
|
764
|
-
disableParallelToolUse: import_v44.z.boolean().optional()
|
|
772
|
+
disableParallelToolUse: import_v44.z.boolean().optional(),
|
|
773
|
+
structuredOutputMode: import_v44.z.enum(["outputFormat", "jsonTool", "auto"]).optional()
|
|
765
774
|
});
|
|
766
775
|
var BedrockChatLanguageModel = class {
|
|
767
776
|
constructor(modelId, config) {
|
|
@@ -788,7 +797,7 @@ var BedrockChatLanguageModel = class {
|
|
|
788
797
|
toolChoice,
|
|
789
798
|
providerOptions
|
|
790
799
|
}) {
|
|
791
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
800
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
792
801
|
const bedrockOptions = (_a = await (0, import_provider_utils4.parseProviderOptions)({
|
|
793
802
|
provider: "bedrock",
|
|
794
803
|
providerOptions,
|
|
@@ -845,7 +854,24 @@ var BedrockChatLanguageModel = class {
|
|
|
845
854
|
const isOpenAIModel = openAIModelId != null;
|
|
846
855
|
const isOpenAIGptOssModel = (_c = openAIModelId == null ? void 0 : openAIModelId.startsWith("openai.gpt-oss-")) != null ? _c : false;
|
|
847
856
|
const isThinkingRequested = ((_d = bedrockOptions.reasoningConfig) == null ? void 0 : _d.type) === "enabled" || ((_e = bedrockOptions.reasoningConfig) == null ? void 0 : _e.type) === "adaptive";
|
|
848
|
-
const
|
|
857
|
+
const structuredOutputMode = (_g = (_f = bedrockOptions.structuredOutputMode) != null ? _f : anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _g : "auto";
|
|
858
|
+
if (structuredOutputMode === "jsonTool") {
|
|
859
|
+
const additionalModelRequestFields = {
|
|
860
|
+
...bedrockOptions.additionalModelRequestFields
|
|
861
|
+
};
|
|
862
|
+
const outputConfig = additionalModelRequestFields.output_config;
|
|
863
|
+
if (outputConfig != null && typeof outputConfig === "object" && !Array.isArray(outputConfig)) {
|
|
864
|
+
const outputConfigWithoutFormat = { ...outputConfig };
|
|
865
|
+
delete outputConfigWithoutFormat.format;
|
|
866
|
+
if (Object.keys(outputConfigWithoutFormat).length > 0) {
|
|
867
|
+
additionalModelRequestFields.output_config = outputConfigWithoutFormat;
|
|
868
|
+
} else {
|
|
869
|
+
delete additionalModelRequestFields.output_config;
|
|
870
|
+
}
|
|
871
|
+
bedrockOptions.additionalModelRequestFields = additionalModelRequestFields;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
const useNativeStructuredOutput = isAnthropicModel && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && (structuredOutputMode === "outputFormat" || structuredOutputMode === "auto" && supportsNativeStructuredOutput(this.modelId) && isThinkingRequested);
|
|
849
875
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useNativeStructuredOutput ? {
|
|
850
876
|
type: "function",
|
|
851
877
|
name: "json",
|
|
@@ -866,16 +892,16 @@ var BedrockChatLanguageModel = class {
|
|
|
866
892
|
};
|
|
867
893
|
}
|
|
868
894
|
if (betas.size > 0 || bedrockOptions.anthropicBeta) {
|
|
869
|
-
const existingBetas = (
|
|
895
|
+
const existingBetas = (_h = bedrockOptions.anthropicBeta) != null ? _h : [];
|
|
870
896
|
const mergedBetas = betas.size > 0 ? [...existingBetas, ...Array.from(betas)] : existingBetas;
|
|
871
897
|
bedrockOptions.additionalModelRequestFields = {
|
|
872
898
|
...bedrockOptions.additionalModelRequestFields,
|
|
873
899
|
anthropic_beta: mergedBetas
|
|
874
900
|
};
|
|
875
901
|
}
|
|
876
|
-
const thinkingType = (
|
|
877
|
-
const thinkingBudget = thinkingType === "enabled" ? (
|
|
878
|
-
const thinkingDisplay = thinkingType === "adaptive" ? (
|
|
902
|
+
const thinkingType = (_i = bedrockOptions.reasoningConfig) == null ? void 0 : _i.type;
|
|
903
|
+
const thinkingBudget = thinkingType === "enabled" ? (_j = bedrockOptions.reasoningConfig) == null ? void 0 : _j.budgetTokens : void 0;
|
|
904
|
+
const thinkingDisplay = thinkingType === "adaptive" ? (_k = bedrockOptions.reasoningConfig) == null ? void 0 : _k.display : void 0;
|
|
879
905
|
const isAnthropicThinkingEnabled = isAnthropicModel && isThinkingRequested;
|
|
880
906
|
const inferenceConfig = {
|
|
881
907
|
...maxOutputTokens != null && { maxTokens: maxOutputTokens },
|
|
@@ -908,7 +934,7 @@ var BedrockChatLanguageModel = class {
|
|
|
908
934
|
};
|
|
909
935
|
}
|
|
910
936
|
} else if (!isAnthropicModel) {
|
|
911
|
-
if (((
|
|
937
|
+
if (((_l = bedrockOptions.reasoningConfig) == null ? void 0 : _l.budgetTokens) != null) {
|
|
912
938
|
warnings.push({
|
|
913
939
|
type: "unsupported-setting",
|
|
914
940
|
setting: "budgetTokens",
|
|
@@ -923,13 +949,13 @@ var BedrockChatLanguageModel = class {
|
|
|
923
949
|
});
|
|
924
950
|
}
|
|
925
951
|
}
|
|
926
|
-
const maxReasoningEffort = (
|
|
952
|
+
const maxReasoningEffort = (_m = bedrockOptions.reasoningConfig) == null ? void 0 : _m.maxReasoningEffort;
|
|
927
953
|
if (maxReasoningEffort != null) {
|
|
928
954
|
if (isAnthropicModel) {
|
|
929
955
|
bedrockOptions.additionalModelRequestFields = {
|
|
930
956
|
...bedrockOptions.additionalModelRequestFields,
|
|
931
957
|
output_config: {
|
|
932
|
-
...(
|
|
958
|
+
...(_n = bedrockOptions.additionalModelRequestFields) == null ? void 0 : _n.output_config,
|
|
933
959
|
effort: maxReasoningEffort
|
|
934
960
|
}
|
|
935
961
|
};
|
|
@@ -940,7 +966,7 @@ var BedrockChatLanguageModel = class {
|
|
|
940
966
|
} : {
|
|
941
967
|
...bedrockOptions.additionalModelRequestFields,
|
|
942
968
|
reasoning: {
|
|
943
|
-
...(
|
|
969
|
+
...(_o = bedrockOptions.additionalModelRequestFields) == null ? void 0 : _o.reasoning,
|
|
944
970
|
effort: maxReasoningEffort
|
|
945
971
|
}
|
|
946
972
|
};
|
|
@@ -948,7 +974,7 @@ var BedrockChatLanguageModel = class {
|
|
|
948
974
|
bedrockOptions.additionalModelRequestFields = {
|
|
949
975
|
...bedrockOptions.additionalModelRequestFields,
|
|
950
976
|
reasoningConfig: {
|
|
951
|
-
...((
|
|
977
|
+
...((_p = bedrockOptions.reasoningConfig) == null ? void 0 : _p.type) != null && {
|
|
952
978
|
type: bedrockOptions.reasoningConfig.type
|
|
953
979
|
},
|
|
954
980
|
maxReasoningEffort
|
|
@@ -960,7 +986,7 @@ var BedrockChatLanguageModel = class {
|
|
|
960
986
|
bedrockOptions.additionalModelRequestFields = {
|
|
961
987
|
...bedrockOptions.additionalModelRequestFields,
|
|
962
988
|
output_config: {
|
|
963
|
-
...(
|
|
989
|
+
...(_q = bedrockOptions.additionalModelRequestFields) == null ? void 0 : _q.output_config,
|
|
964
990
|
format: {
|
|
965
991
|
type: "json_schema",
|
|
966
992
|
schema: (0, import_internal2.sanitizeJsonSchema)(responseFormat.schema)
|
|
@@ -992,7 +1018,7 @@ var BedrockChatLanguageModel = class {
|
|
|
992
1018
|
details: "topK is not supported when thinking is enabled"
|
|
993
1019
|
});
|
|
994
1020
|
}
|
|
995
|
-
const hasAnyTools = ((
|
|
1021
|
+
const hasAnyTools = ((_s = (_r = toolConfig.tools) == null ? void 0 : _r.length) != null ? _s : 0) > 0 || additionalTools;
|
|
996
1022
|
let filteredPrompt = prompt;
|
|
997
1023
|
if (!hasAnyTools) {
|
|
998
1024
|
const hasToolContent = prompt.some(
|
|
@@ -1023,6 +1049,7 @@ var BedrockChatLanguageModel = class {
|
|
|
1023
1049
|
reasoningConfig: _,
|
|
1024
1050
|
additionalModelRequestFields: __,
|
|
1025
1051
|
serviceTier: ___,
|
|
1052
|
+
structuredOutputMode: ____,
|
|
1026
1053
|
...filteredBedrockOptions
|
|
1027
1054
|
} = (providerOptions == null ? void 0 : providerOptions.bedrock) || {};
|
|
1028
1055
|
const additionalModelResponseFieldPaths = isAnthropicModel ? ["/delta/stop_sequence"] : void 0;
|
|
@@ -1489,8 +1516,17 @@ var BedrockChatLanguageModel = class {
|
|
|
1489
1516
|
return `${this.config.baseUrl()}/model/${encodedModelId}`;
|
|
1490
1517
|
}
|
|
1491
1518
|
};
|
|
1519
|
+
var MODELS_WITHOUT_RELIABLE_NATIVE_STRUCTURED_OUTPUT = [
|
|
1520
|
+
"anthropic.claude-sonnet-4-6",
|
|
1521
|
+
"anthropic.claude-haiku-4-5"
|
|
1522
|
+
];
|
|
1492
1523
|
function supportsNativeStructuredOutput(modelId) {
|
|
1493
|
-
|
|
1524
|
+
if (MODELS_WITHOUT_RELIABLE_NATIVE_STRUCTURED_OUTPUT.some(
|
|
1525
|
+
(model) => modelId.includes(model)
|
|
1526
|
+
)) {
|
|
1527
|
+
return false;
|
|
1528
|
+
}
|
|
1529
|
+
return modelId.includes("anthropic.claude-sonnet-4-5") || modelId.includes("anthropic.claude-opus-4-5") || modelId.includes("anthropic.claude-opus-4-6");
|
|
1494
1530
|
}
|
|
1495
1531
|
var BedrockStopReasonSchema = import_v44.z.union([
|
|
1496
1532
|
import_v44.z.enum(BEDROCK_STOP_REASONS),
|