diff --git a/examples/bedrock-claude3-vision-example/go.mod b/examples/bedrock-claude3-vision-example/go.mod
index 5aa5397f..c12c7578 100644
--- a/examples/bedrock-claude3-vision-example/go.mod
+++ b/examples/bedrock-claude3-vision-example/go.mod
@@ -5,21 +5,22 @@ go 1.24.1
require github.com/vxcontrol/langchaingo v0.1.14-update.1
require (
- github.com/aws/aws-sdk-go-v2 v1.36.5 // indirect
- github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11 // indirect
- github.com/aws/aws-sdk-go-v2/config v1.29.4 // indirect
- github.com/aws/aws-sdk-go-v2/credentials v1.17.61 // indirect
- github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 // indirect
- github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36 // indirect
- github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36 // indirect
- github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 // indirect
- github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.31.0 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect
- github.com/aws/aws-sdk-go-v2/service/sso v1.25.0 // indirect
- github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.0 // indirect
- github.com/aws/aws-sdk-go-v2/service/sts v1.33.16 // indirect
- github.com/aws/smithy-go v1.22.4 // indirect
+ github.com/aws/aws-sdk-go-v2 v1.41.2 // indirect
+ github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 // indirect
+ github.com/aws/aws-sdk-go-v2/config v1.32.10 // indirect
+ github.com/aws/aws-sdk-go-v2/credentials v1.19.10 // indirect
+ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
+ github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 // indirect
+ github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 // indirect
+ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 // indirect
+ github.com/aws/smithy-go v1.24.1 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/pkoukk/tiktoken-go v0.1.8 // indirect
diff --git a/examples/bedrock-claude3-vision-example/go.sum b/examples/bedrock-claude3-vision-example/go.sum
index add91b0a..d4d770a3 100644
--- a/examples/bedrock-claude3-vision-example/go.sum
+++ b/examples/bedrock-claude3-vision-example/go.sum
@@ -1,33 +1,35 @@
-github.com/aws/aws-sdk-go-v2 v1.36.5 h1:0OF9RiEMEdDdZEMqF9MRjevyxAQcf6gY+E7vwBILFj0=
-github.com/aws/aws-sdk-go-v2 v1.36.5/go.mod h1:EYrzvCCN9CMUTa5+6lf6MM4tq3Zjp8UhSGR/cBsjai0=
-github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11 h1:12SpdwU8Djs+YGklkinSSlcrPyj3H4VifVsKf78KbwA=
-github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11/go.mod h1:dd+Lkp6YmMryke+qxW/VnKyhMBDTYP41Q2Bb+6gNZgY=
-github.com/aws/aws-sdk-go-v2/config v1.29.4 h1:ObNqKsDYFGr2WxnoXKOhCvTlf3HhwtoGgc+KmZ4H5yg=
-github.com/aws/aws-sdk-go-v2/config v1.29.4/go.mod h1:j2/AF7j/qxVmsNIChw1tWfsVKOayJoGRDjg1Tgq7NPk=
-github.com/aws/aws-sdk-go-v2/credentials v1.17.61 h1:Hd/uX6Wo2iUW1JWII+rmyCD7MMhOe7ALwQXN6sKDd1o=
-github.com/aws/aws-sdk-go-v2/credentials v1.17.61/go.mod h1:L7vaLkwHY1qgW0gG1zG0z/X0sQ5tpIY5iI13+j3qI80=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 h1:x793wxmUWVDhshP8WW2mlnXuFrO4cOd3HLBroh1paFw=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30/go.mod h1:Jpne2tDnYiFascUEs2AWHJL9Yp7A5ZVy3TNyxaAjD6M=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36 h1:SsytQyTMHMDPspp+spo7XwXTP44aJZZAC7fBV2C5+5s=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36/go.mod h1:Q1lnJArKRXkenyog6+Y+zr7WDpk4e6XlR6gs20bbeNo=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36 h1:i2vNHQiXUvKhs3quBR6aqlgJaiaexz/aNvdCktW/kAM=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36/go.mod h1:UdyGa7Q91id/sdyHPwth+043HhmP6yP9MBHgbZM0xo8=
-github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 h1:Pg9URiobXy85kgFev3og2CuOZ8JZUBENF+dcgWBaYNk=
-github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
-github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.31.0 h1:BbtWSM9690zWbSOuJjBm7t7SIqDWhHPhKKQLhqxL+ac=
-github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.31.0/go.mod h1:XHkvWM72+3dn5ox7yG0/yBEnQ2y0SMLCaXE/t96rv0I=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 h1:eAh2A4b5IzM/lum78bZ590jy36+d/aFLgKF/4Vd1xPE=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3/go.mod h1:0yKJC/kb8sAnmlYa6Zs3QVYqaC8ug2AbnNChv5Ox3uA=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 h1:dM9/92u2F1JbDaGooxTq18wmmFzbJRfXfVfy96/1CXM=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15/go.mod h1:SwFBy2vjtA0vZbjjaFtfN045boopadnoVPhu4Fv66vY=
-github.com/aws/aws-sdk-go-v2/service/sso v1.25.0 h1:2U9sF8nKy7UgyEeLiZTRg6ShBS22z8UnYpV6aRFL0is=
-github.com/aws/aws-sdk-go-v2/service/sso v1.25.0/go.mod h1:qs4a9T5EMLl/Cajiw2TcbNt2UNo/Hqlyp+GiuG4CFDI=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.0 h1:wjAdc85cXdQR5uLx5FwWvGIHm4OPJhTyzUHU8craXtE=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.0/go.mod h1:MlYRNmYu/fGPoxBQVvBYr9nyr948aY/WLUvwBMBJubs=
-github.com/aws/aws-sdk-go-v2/service/sts v1.33.16 h1:BHEK2Q/7CMRMCb3nySi/w8UbIcPhKvYP5s1xf8/izn0=
-github.com/aws/aws-sdk-go-v2/service/sts v1.33.16/go.mod h1:cQnB8CUnxbMU82JvlqjKR2HBOm3fe9pWorWBza6MBJ4=
-github.com/aws/smithy-go v1.22.4 h1:uqXzVZNuNexwc/xrh6Tb56u89WDlJY6HS+KC0S4QSjw=
-github.com/aws/smithy-go v1.22.4/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
+github.com/aws/aws-sdk-go-v2 v1.41.2 h1:LuT2rzqNQsauaGkPK/7813XxcZ3o3yePY0Iy891T2ls=
+github.com/aws/aws-sdk-go-v2 v1.41.2/go.mod h1:IvvlAZQXvTXznUPfRVfryiG1fbzE2NGK6m9u39YQ+S4=
+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 h1:zWFmPmgw4sveAYi1mRqG+E/g0461cJ5M4bJ8/nc6d3Q=
+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5/go.mod h1:nVUlMLVV8ycXSb7mSkcNu9e3v/1TJq2RTlrPwhYWr5c=
+github.com/aws/aws-sdk-go-v2/config v1.32.10 h1:9DMthfO6XWZYLfzZglAgW5Fyou2nRI5CuV44sTedKBI=
+github.com/aws/aws-sdk-go-v2/config v1.32.10/go.mod h1:2rUIOnA2JaiqYmSKYmRJlcMWy6qTj1vuRFscppSBMcw=
+github.com/aws/aws-sdk-go-v2/credentials v1.19.10 h1:EEhmEUFCE1Yhl7vDhNOI5OCL/iKMdkkYFTRpZXNw7m8=
+github.com/aws/aws-sdk-go-v2/credentials v1.19.10/go.mod h1:RnnlFCAlxQCkN2Q379B67USkBMu1PipEEiibzYN5UTE=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 h1:Ii4s+Sq3yDfaMLpjrJsqD6SmG/Wq/P5L/hw2qa78UAY=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18/go.mod h1:6x81qnY++ovptLE6nWQeWrpXxbnlIex+4H4eYYGcqfc=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 h1:F43zk1vemYIqPAwhjTjYIz0irU2EY7sOb/F5eJ3HuyM=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18/go.mod h1:w1jdlZXrGKaJcNoL+Nnrj+k5wlpGXqnNrKoP22HvAug=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 h1:xCeWVjj0ki0l3nruoyP2slHsGArMxeiiaoPN5QZH6YQ=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18/go.mod h1:r/eLGuGCBw6l36ZRWiw6PaZwPXb6YOj+i/7MizNl5/k=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc=
+github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0 h1:TDKR8ACRw7G+GFaQlhoy6biu+8q6ZtSddQCy9avMdMI=
+github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0/go.mod h1:XlhOh5Ax/lesqN4aZCUgj9vVJed5VoXYHHFYGAlJEwU=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 h1:CeY9LUdur+Dxoeldqoun6y4WtJ3RQtzk0JMP2gfUay0=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5/go.mod h1:AZLZf2fMaahW5s/wMRciu1sYbdsikT/UHwbUjOdEVTc=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 h1:LTRCYFlnnKFlKsyIQxKhJuDuA3ZkrDQMRYm6rXiHlLY=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18/go.mod h1:XhwkgGG6bHSd00nO/mexWTcTjgd6PjuvWQMqSn2UaEk=
+github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 h1:MzORe+J94I+hYu2a6XmV5yC9huoTv8NRcCrUNedDypQ=
+github.com/aws/aws-sdk-go-v2/service/signin v1.0.6/go.mod h1:hXzcHLARD7GeWnifd8j9RWqtfIgxj4/cAtIVIK7hg8g=
+github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 h1:7oGD8KPfBOJGXiCoRKrrrQkbvCp8N++u36hrLMPey6o=
+github.com/aws/aws-sdk-go-v2/service/sso v1.30.11/go.mod h1:0DO9B5EUJQlIDif+XJRWCljZRKsAFKh3gpFz7UnDtOo=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 h1:edCcNp9eGIUDUCrzoCu1jWAXLGFIizeqkdkKgRlJwWc=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15/go.mod h1:lyRQKED9xWfgkYC/wmmYfv7iVIM68Z5OQ88ZdcV1QbU=
+github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 h1:NITQpgo9A5NrDZ57uOWj+abvXSb83BbyggcUBVksN7c=
+github.com/aws/aws-sdk-go-v2/service/sts v1.41.7/go.mod h1:sks5UWBhEuWYDPdwlnRFn1w7xWdH29Jcpe+/PJQefEs=
+github.com/aws/smithy-go v1.24.1 h1:VbyeNfmYkWoxMVpGUAbQumkODcYmfMRfZ8yQiH30SK0=
+github.com/aws/smithy-go v1.24.1/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
diff --git a/examples/bedrock-provider-example/go.mod b/examples/bedrock-provider-example/go.mod
index e9f71184..1f1dd5d7 100644
--- a/examples/bedrock-provider-example/go.mod
+++ b/examples/bedrock-provider-example/go.mod
@@ -5,21 +5,22 @@ go 1.24.1
require github.com/vxcontrol/langchaingo v0.1.14-update.1
require (
- github.com/aws/aws-sdk-go-v2 v1.36.5 // indirect
- github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11 // indirect
- github.com/aws/aws-sdk-go-v2/config v1.29.4 // indirect
- github.com/aws/aws-sdk-go-v2/credentials v1.17.61 // indirect
- github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 // indirect
- github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36 // indirect
- github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36 // indirect
- github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 // indirect
- github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.31.0 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect
- github.com/aws/aws-sdk-go-v2/service/sso v1.25.0 // indirect
- github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.0 // indirect
- github.com/aws/aws-sdk-go-v2/service/sts v1.33.16 // indirect
- github.com/aws/smithy-go v1.22.4 // indirect
+ github.com/aws/aws-sdk-go-v2 v1.41.2 // indirect
+ github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 // indirect
+ github.com/aws/aws-sdk-go-v2/config v1.32.10 // indirect
+ github.com/aws/aws-sdk-go-v2/credentials v1.19.10 // indirect
+ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
+ github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 // indirect
+ github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 // indirect
+ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 // indirect
+ github.com/aws/smithy-go v1.24.1 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/pkoukk/tiktoken-go v0.1.8 // indirect
diff --git a/examples/bedrock-provider-example/go.sum b/examples/bedrock-provider-example/go.sum
index add91b0a..d4d770a3 100644
--- a/examples/bedrock-provider-example/go.sum
+++ b/examples/bedrock-provider-example/go.sum
@@ -1,33 +1,35 @@
-github.com/aws/aws-sdk-go-v2 v1.36.5 h1:0OF9RiEMEdDdZEMqF9MRjevyxAQcf6gY+E7vwBILFj0=
-github.com/aws/aws-sdk-go-v2 v1.36.5/go.mod h1:EYrzvCCN9CMUTa5+6lf6MM4tq3Zjp8UhSGR/cBsjai0=
-github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11 h1:12SpdwU8Djs+YGklkinSSlcrPyj3H4VifVsKf78KbwA=
-github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11/go.mod h1:dd+Lkp6YmMryke+qxW/VnKyhMBDTYP41Q2Bb+6gNZgY=
-github.com/aws/aws-sdk-go-v2/config v1.29.4 h1:ObNqKsDYFGr2WxnoXKOhCvTlf3HhwtoGgc+KmZ4H5yg=
-github.com/aws/aws-sdk-go-v2/config v1.29.4/go.mod h1:j2/AF7j/qxVmsNIChw1tWfsVKOayJoGRDjg1Tgq7NPk=
-github.com/aws/aws-sdk-go-v2/credentials v1.17.61 h1:Hd/uX6Wo2iUW1JWII+rmyCD7MMhOe7ALwQXN6sKDd1o=
-github.com/aws/aws-sdk-go-v2/credentials v1.17.61/go.mod h1:L7vaLkwHY1qgW0gG1zG0z/X0sQ5tpIY5iI13+j3qI80=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 h1:x793wxmUWVDhshP8WW2mlnXuFrO4cOd3HLBroh1paFw=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30/go.mod h1:Jpne2tDnYiFascUEs2AWHJL9Yp7A5ZVy3TNyxaAjD6M=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36 h1:SsytQyTMHMDPspp+spo7XwXTP44aJZZAC7fBV2C5+5s=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36/go.mod h1:Q1lnJArKRXkenyog6+Y+zr7WDpk4e6XlR6gs20bbeNo=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36 h1:i2vNHQiXUvKhs3quBR6aqlgJaiaexz/aNvdCktW/kAM=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36/go.mod h1:UdyGa7Q91id/sdyHPwth+043HhmP6yP9MBHgbZM0xo8=
-github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 h1:Pg9URiobXy85kgFev3og2CuOZ8JZUBENF+dcgWBaYNk=
-github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
-github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.31.0 h1:BbtWSM9690zWbSOuJjBm7t7SIqDWhHPhKKQLhqxL+ac=
-github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.31.0/go.mod h1:XHkvWM72+3dn5ox7yG0/yBEnQ2y0SMLCaXE/t96rv0I=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 h1:eAh2A4b5IzM/lum78bZ590jy36+d/aFLgKF/4Vd1xPE=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3/go.mod h1:0yKJC/kb8sAnmlYa6Zs3QVYqaC8ug2AbnNChv5Ox3uA=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 h1:dM9/92u2F1JbDaGooxTq18wmmFzbJRfXfVfy96/1CXM=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15/go.mod h1:SwFBy2vjtA0vZbjjaFtfN045boopadnoVPhu4Fv66vY=
-github.com/aws/aws-sdk-go-v2/service/sso v1.25.0 h1:2U9sF8nKy7UgyEeLiZTRg6ShBS22z8UnYpV6aRFL0is=
-github.com/aws/aws-sdk-go-v2/service/sso v1.25.0/go.mod h1:qs4a9T5EMLl/Cajiw2TcbNt2UNo/Hqlyp+GiuG4CFDI=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.0 h1:wjAdc85cXdQR5uLx5FwWvGIHm4OPJhTyzUHU8craXtE=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.0/go.mod h1:MlYRNmYu/fGPoxBQVvBYr9nyr948aY/WLUvwBMBJubs=
-github.com/aws/aws-sdk-go-v2/service/sts v1.33.16 h1:BHEK2Q/7CMRMCb3nySi/w8UbIcPhKvYP5s1xf8/izn0=
-github.com/aws/aws-sdk-go-v2/service/sts v1.33.16/go.mod h1:cQnB8CUnxbMU82JvlqjKR2HBOm3fe9pWorWBza6MBJ4=
-github.com/aws/smithy-go v1.22.4 h1:uqXzVZNuNexwc/xrh6Tb56u89WDlJY6HS+KC0S4QSjw=
-github.com/aws/smithy-go v1.22.4/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
+github.com/aws/aws-sdk-go-v2 v1.41.2 h1:LuT2rzqNQsauaGkPK/7813XxcZ3o3yePY0Iy891T2ls=
+github.com/aws/aws-sdk-go-v2 v1.41.2/go.mod h1:IvvlAZQXvTXznUPfRVfryiG1fbzE2NGK6m9u39YQ+S4=
+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 h1:zWFmPmgw4sveAYi1mRqG+E/g0461cJ5M4bJ8/nc6d3Q=
+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5/go.mod h1:nVUlMLVV8ycXSb7mSkcNu9e3v/1TJq2RTlrPwhYWr5c=
+github.com/aws/aws-sdk-go-v2/config v1.32.10 h1:9DMthfO6XWZYLfzZglAgW5Fyou2nRI5CuV44sTedKBI=
+github.com/aws/aws-sdk-go-v2/config v1.32.10/go.mod h1:2rUIOnA2JaiqYmSKYmRJlcMWy6qTj1vuRFscppSBMcw=
+github.com/aws/aws-sdk-go-v2/credentials v1.19.10 h1:EEhmEUFCE1Yhl7vDhNOI5OCL/iKMdkkYFTRpZXNw7m8=
+github.com/aws/aws-sdk-go-v2/credentials v1.19.10/go.mod h1:RnnlFCAlxQCkN2Q379B67USkBMu1PipEEiibzYN5UTE=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 h1:Ii4s+Sq3yDfaMLpjrJsqD6SmG/Wq/P5L/hw2qa78UAY=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18/go.mod h1:6x81qnY++ovptLE6nWQeWrpXxbnlIex+4H4eYYGcqfc=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 h1:F43zk1vemYIqPAwhjTjYIz0irU2EY7sOb/F5eJ3HuyM=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18/go.mod h1:w1jdlZXrGKaJcNoL+Nnrj+k5wlpGXqnNrKoP22HvAug=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 h1:xCeWVjj0ki0l3nruoyP2slHsGArMxeiiaoPN5QZH6YQ=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18/go.mod h1:r/eLGuGCBw6l36ZRWiw6PaZwPXb6YOj+i/7MizNl5/k=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc=
+github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0 h1:TDKR8ACRw7G+GFaQlhoy6biu+8q6ZtSddQCy9avMdMI=
+github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0/go.mod h1:XlhOh5Ax/lesqN4aZCUgj9vVJed5VoXYHHFYGAlJEwU=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 h1:CeY9LUdur+Dxoeldqoun6y4WtJ3RQtzk0JMP2gfUay0=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5/go.mod h1:AZLZf2fMaahW5s/wMRciu1sYbdsikT/UHwbUjOdEVTc=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 h1:LTRCYFlnnKFlKsyIQxKhJuDuA3ZkrDQMRYm6rXiHlLY=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18/go.mod h1:XhwkgGG6bHSd00nO/mexWTcTjgd6PjuvWQMqSn2UaEk=
+github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 h1:MzORe+J94I+hYu2a6XmV5yC9huoTv8NRcCrUNedDypQ=
+github.com/aws/aws-sdk-go-v2/service/signin v1.0.6/go.mod h1:hXzcHLARD7GeWnifd8j9RWqtfIgxj4/cAtIVIK7hg8g=
+github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 h1:7oGD8KPfBOJGXiCoRKrrrQkbvCp8N++u36hrLMPey6o=
+github.com/aws/aws-sdk-go-v2/service/sso v1.30.11/go.mod h1:0DO9B5EUJQlIDif+XJRWCljZRKsAFKh3gpFz7UnDtOo=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 h1:edCcNp9eGIUDUCrzoCu1jWAXLGFIizeqkdkKgRlJwWc=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15/go.mod h1:lyRQKED9xWfgkYC/wmmYfv7iVIM68Z5OQ88ZdcV1QbU=
+github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 h1:NITQpgo9A5NrDZ57uOWj+abvXSb83BbyggcUBVksN7c=
+github.com/aws/aws-sdk-go-v2/service/sts v1.41.7/go.mod h1:sks5UWBhEuWYDPdwlnRFn1w7xWdH29Jcpe+/PJQefEs=
+github.com/aws/smithy-go v1.24.1 h1:VbyeNfmYkWoxMVpGUAbQumkODcYmfMRfZ8yQiH30SK0=
+github.com/aws/smithy-go v1.24.1/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
diff --git a/go.mod b/go.mod
index 5504bbb3..73dfc353 100644
--- a/go.mod
+++ b/go.mod
@@ -56,13 +56,13 @@ require (
require (
cloud.google.com/go/aiplatform v1.85.0
cloud.google.com/go/vertexai v0.12.0
- github.com/aws/aws-sdk-go-v2 v1.36.5
- github.com/aws/aws-sdk-go-v2/config v1.29.4
- github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.44.2
- github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime v1.45.2
- github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.31.0
+ github.com/aws/aws-sdk-go-v2 v1.41.2
+ github.com/aws/aws-sdk-go-v2/config v1.32.10
+ github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.52.4
+ github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime v1.51.4
+ github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0
github.com/aws/aws-sdk-go-v2/service/s3 v1.78.2
- github.com/aws/smithy-go v1.22.4
+ github.com/aws/smithy-go v1.24.1
golang.org/x/oauth2 v0.30.0
google.golang.org/api v0.238.0
google.golang.org/grpc v1.73.0
@@ -127,20 +127,21 @@ require (
cloud.google.com/go/compute/metadata v0.7.0 // indirect
cloud.google.com/go/iam v1.5.2 // indirect
cloud.google.com/go/longrunning v0.6.7 // indirect
- github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11 // indirect
- github.com/aws/aws-sdk-go-v2/credentials v1.17.61 // indirect
- github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 // indirect
- github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36 // indirect
- github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36 // indirect
- github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 // indirect
+ github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 // indirect
+ github.com/aws/aws-sdk-go-v2/credentials v1.19.10 // indirect
+ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.34 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.7.0 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.15 // indirect
- github.com/aws/aws-sdk-go-v2/service/sso v1.25.0 // indirect
- github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.0 // indirect
- github.com/aws/aws-sdk-go-v2/service/sts v1.33.16 // indirect
+ github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 // indirect
+ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/google/s2a-go v0.1.9 // indirect
diff --git a/go.sum b/go.sum
index a4349368..9221c7a2 100644
--- a/go.sum
+++ b/go.sum
@@ -78,46 +78,82 @@ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:W
github.com/aws/aws-sdk-go v1.42.27/go.mod h1:OGr6lGMAKGlG9CVrYnWYDKIyb829c6EVBRjxqjmPepc=
github.com/aws/aws-sdk-go-v2 v1.36.5 h1:0OF9RiEMEdDdZEMqF9MRjevyxAQcf6gY+E7vwBILFj0=
github.com/aws/aws-sdk-go-v2 v1.36.5/go.mod h1:EYrzvCCN9CMUTa5+6lf6MM4tq3Zjp8UhSGR/cBsjai0=
+github.com/aws/aws-sdk-go-v2 v1.41.2 h1:LuT2rzqNQsauaGkPK/7813XxcZ3o3yePY0Iy891T2ls=
+github.com/aws/aws-sdk-go-v2 v1.41.2/go.mod h1:IvvlAZQXvTXznUPfRVfryiG1fbzE2NGK6m9u39YQ+S4=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11 h1:12SpdwU8Djs+YGklkinSSlcrPyj3H4VifVsKf78KbwA=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.11/go.mod h1:dd+Lkp6YmMryke+qxW/VnKyhMBDTYP41Q2Bb+6gNZgY=
+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 h1:zWFmPmgw4sveAYi1mRqG+E/g0461cJ5M4bJ8/nc6d3Q=
+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5/go.mod h1:nVUlMLVV8ycXSb7mSkcNu9e3v/1TJq2RTlrPwhYWr5c=
github.com/aws/aws-sdk-go-v2/config v1.29.4 h1:ObNqKsDYFGr2WxnoXKOhCvTlf3HhwtoGgc+KmZ4H5yg=
github.com/aws/aws-sdk-go-v2/config v1.29.4/go.mod h1:j2/AF7j/qxVmsNIChw1tWfsVKOayJoGRDjg1Tgq7NPk=
+github.com/aws/aws-sdk-go-v2/config v1.32.10 h1:9DMthfO6XWZYLfzZglAgW5Fyou2nRI5CuV44sTedKBI=
+github.com/aws/aws-sdk-go-v2/config v1.32.10/go.mod h1:2rUIOnA2JaiqYmSKYmRJlcMWy6qTj1vuRFscppSBMcw=
github.com/aws/aws-sdk-go-v2/credentials v1.17.61 h1:Hd/uX6Wo2iUW1JWII+rmyCD7MMhOe7ALwQXN6sKDd1o=
github.com/aws/aws-sdk-go-v2/credentials v1.17.61/go.mod h1:L7vaLkwHY1qgW0gG1zG0z/X0sQ5tpIY5iI13+j3qI80=
+github.com/aws/aws-sdk-go-v2/credentials v1.19.10 h1:EEhmEUFCE1Yhl7vDhNOI5OCL/iKMdkkYFTRpZXNw7m8=
+github.com/aws/aws-sdk-go-v2/credentials v1.19.10/go.mod h1:RnnlFCAlxQCkN2Q379B67USkBMu1PipEEiibzYN5UTE=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 h1:x793wxmUWVDhshP8WW2mlnXuFrO4cOd3HLBroh1paFw=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30/go.mod h1:Jpne2tDnYiFascUEs2AWHJL9Yp7A5ZVy3TNyxaAjD6M=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 h1:Ii4s+Sq3yDfaMLpjrJsqD6SmG/Wq/P5L/hw2qa78UAY=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18/go.mod h1:6x81qnY++ovptLE6nWQeWrpXxbnlIex+4H4eYYGcqfc=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36 h1:SsytQyTMHMDPspp+spo7XwXTP44aJZZAC7fBV2C5+5s=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36/go.mod h1:Q1lnJArKRXkenyog6+Y+zr7WDpk4e6XlR6gs20bbeNo=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 h1:F43zk1vemYIqPAwhjTjYIz0irU2EY7sOb/F5eJ3HuyM=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18/go.mod h1:w1jdlZXrGKaJcNoL+Nnrj+k5wlpGXqnNrKoP22HvAug=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36 h1:i2vNHQiXUvKhs3quBR6aqlgJaiaexz/aNvdCktW/kAM=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36/go.mod h1:UdyGa7Q91id/sdyHPwth+043HhmP6yP9MBHgbZM0xo8=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 h1:xCeWVjj0ki0l3nruoyP2slHsGArMxeiiaoPN5QZH6YQ=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18/go.mod h1:r/eLGuGCBw6l36ZRWiw6PaZwPXb6YOj+i/7MizNl5/k=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 h1:Pg9URiobXy85kgFev3og2CuOZ8JZUBENF+dcgWBaYNk=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.34 h1:ZNTqv4nIdE/DiBfUUfXcLZ/Spcuz+RjeziUtNJackkM=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.34/go.mod h1:zf7Vcd1ViW7cPqYWEHLHJkS50X0JS2IKz9Cgaj6ugrs=
github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.44.2 h1:gedxMyluRPy1ENN1dlOM7rK8Jek1wUvpA9z1Cz2s9N4=
github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.44.2/go.mod h1:8zZaELHNLx6LNNfMrzCtVVsOFFKP1905FKmsSFuhArM=
+github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.52.4 h1:i5WL+AoS/AhMscsWkH6akQfJIujCVjbWiBwW36XheVk=
+github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.52.4/go.mod h1:8bRM14bpnsP+IzbJMlW0245dDZb0BFBuy0POlammksA=
github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime v1.45.2 h1:bTaJuyz2i4XvlxMLBzXpdw9rjth9noDMKHB+lh/w3kk=
github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime v1.45.2/go.mod h1:J/EFJdG12RxcljWx7vSgfx7L5rVuKpZHmFYO/SXTxKc=
+github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime v1.51.4 h1:oeSeyDAM2KQxu9bylfGZIspla7yXa6/59+Br3IvgNvQ=
+github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime v1.51.4/go.mod h1:eF5QHzRKSt9xvuxNlXC4QgH2+9JUGUWb8KND0+f5f2E=
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.31.0 h1:BbtWSM9690zWbSOuJjBm7t7SIqDWhHPhKKQLhqxL+ac=
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.31.0/go.mod h1:XHkvWM72+3dn5ox7yG0/yBEnQ2y0SMLCaXE/t96rv0I=
+github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0 h1:TDKR8ACRw7G+GFaQlhoy6biu+8q6ZtSddQCy9avMdMI=
+github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.50.0/go.mod h1:XlhOh5Ax/lesqN4aZCUgj9vVJed5VoXYHHFYGAlJEwU=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 h1:eAh2A4b5IzM/lum78bZ590jy36+d/aFLgKF/4Vd1xPE=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3/go.mod h1:0yKJC/kb8sAnmlYa6Zs3QVYqaC8ug2AbnNChv5Ox3uA=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 h1:CeY9LUdur+Dxoeldqoun6y4WtJ3RQtzk0JMP2gfUay0=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5/go.mod h1:AZLZf2fMaahW5s/wMRciu1sYbdsikT/UHwbUjOdEVTc=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.7.0 h1:lguz0bmOoGzozP9XfRJR1QIayEYo+2vP/No3OfLF0pU=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.7.0/go.mod h1:iu6FSzgt+M2/x3Dk8zhycdIcHjEFb36IS8HVUVFoMg0=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 h1:dM9/92u2F1JbDaGooxTq18wmmFzbJRfXfVfy96/1CXM=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15/go.mod h1:SwFBy2vjtA0vZbjjaFtfN045boopadnoVPhu4Fv66vY=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 h1:LTRCYFlnnKFlKsyIQxKhJuDuA3ZkrDQMRYm6rXiHlLY=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18/go.mod h1:XhwkgGG6bHSd00nO/mexWTcTjgd6PjuvWQMqSn2UaEk=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.15 h1:moLQUoVq91LiqT1nbvzDukyqAlCv89ZmwaHw/ZFlFZg=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.15/go.mod h1:ZH34PJUc8ApjBIfgQCFvkWcUDBtl/WTD+uiYHjd8igA=
github.com/aws/aws-sdk-go-v2/service/s3 v1.78.2 h1:jIiopHEV22b4yQP2q36Y0OmwLbsxNWdWwfZRR5QRRO4=
github.com/aws/aws-sdk-go-v2/service/s3 v1.78.2/go.mod h1:U5SNqwhXB3Xe6F47kXvWihPl/ilGaEDe8HD/50Z9wxc=
+github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 h1:MzORe+J94I+hYu2a6XmV5yC9huoTv8NRcCrUNedDypQ=
+github.com/aws/aws-sdk-go-v2/service/signin v1.0.6/go.mod h1:hXzcHLARD7GeWnifd8j9RWqtfIgxj4/cAtIVIK7hg8g=
github.com/aws/aws-sdk-go-v2/service/sso v1.25.0 h1:2U9sF8nKy7UgyEeLiZTRg6ShBS22z8UnYpV6aRFL0is=
github.com/aws/aws-sdk-go-v2/service/sso v1.25.0/go.mod h1:qs4a9T5EMLl/Cajiw2TcbNt2UNo/Hqlyp+GiuG4CFDI=
+github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 h1:7oGD8KPfBOJGXiCoRKrrrQkbvCp8N++u36hrLMPey6o=
+github.com/aws/aws-sdk-go-v2/service/sso v1.30.11/go.mod h1:0DO9B5EUJQlIDif+XJRWCljZRKsAFKh3gpFz7UnDtOo=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.0 h1:wjAdc85cXdQR5uLx5FwWvGIHm4OPJhTyzUHU8craXtE=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.0/go.mod h1:MlYRNmYu/fGPoxBQVvBYr9nyr948aY/WLUvwBMBJubs=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 h1:edCcNp9eGIUDUCrzoCu1jWAXLGFIizeqkdkKgRlJwWc=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15/go.mod h1:lyRQKED9xWfgkYC/wmmYfv7iVIM68Z5OQ88ZdcV1QbU=
github.com/aws/aws-sdk-go-v2/service/sts v1.33.16 h1:BHEK2Q/7CMRMCb3nySi/w8UbIcPhKvYP5s1xf8/izn0=
github.com/aws/aws-sdk-go-v2/service/sts v1.33.16/go.mod h1:cQnB8CUnxbMU82JvlqjKR2HBOm3fe9pWorWBza6MBJ4=
+github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 h1:NITQpgo9A5NrDZ57uOWj+abvXSb83BbyggcUBVksN7c=
+github.com/aws/aws-sdk-go-v2/service/sts v1.41.7/go.mod h1:sks5UWBhEuWYDPdwlnRFn1w7xWdH29Jcpe+/PJQefEs=
github.com/aws/smithy-go v1.22.4 h1:uqXzVZNuNexwc/xrh6Tb56u89WDlJY6HS+KC0S4QSjw=
github.com/aws/smithy-go v1.22.4/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
+github.com/aws/smithy-go v1.24.1 h1:VbyeNfmYkWoxMVpGUAbQumkODcYmfMRfZ8yQiH30SK0=
+github.com/aws/smithy-go v1.24.1/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
diff --git a/llms/bedrock/README.md b/llms/bedrock/README.md
index 6052d2b9..955cb8da 100644
--- a/llms/bedrock/README.md
+++ b/llms/bedrock/README.md
@@ -1,130 +1,725 @@
# AWS Bedrock LLM Provider
-A comprehensive Go implementation for AWS Bedrock LLM models with support for multiple providers, streaming, tool calling, and multimodal capabilities.
+Production-ready Go client for AWS Bedrock with support for 40+ models from 13 providers.
-## Features
+## Architecture Overview
-### 🤖 **Extensive Model Support**
-- **AI21**: Jamba 1.5 Large/Mini, Jamba Instruct
-- **Amazon**: Nova Premier/Pro/Lite/Micro, Titan Text Premier
-- **Anthropic**: Claude 4 Opus/Sonnet, Claude 3.7 Sonnet, Claude 3.5 Haiku/Sonnet
-- **Cohere**: Command-R, Command-R+, Command Text/Light
-- **Meta**: Llama 3.3 70B, Llama 3.1 8B, Llama 3 70B/8B
-- **DeepSeek**: R1
-
-### 🚀 **Advanced Capabilities**
-- **Streaming**: Real-time response streaming for most models
-- **Tool Calling**: Full function calling support with streaming
-- **Reasoning**: Extended thinking support for Claude 3.7+ and Nova models
-- **Multimodal**: Text, image, and document processing
-- **Two APIs**: Modern Converse API + Legacy model-specific APIs
-
-## Quick Start
-
-```go
-import "github.com/vxcontrol/langchaingo/llms/bedrock"
-
-// Basic usage
-llm, err := bedrock.New()
-
-// With Converse API (recommended)
-llm, err := bedrock.New(
- bedrock.WithConverseAPI(),
- bedrock.WithModel(bedrock.ModelAnthropicClaudeSonnet4),
-)
-
-resp, err := llm.GenerateContent(ctx, messages)
+```mermaid
+graph TB
+ Client[Client Code] --> LLM[bedrock.LLM]
+ LLM --> Processing[Message Processing]
+ Processing --> Legacy[Legacy API Client]
+ Processing --> Converse[Converse API Client]
+ Legacy --> Anthropic[provider_anthropic.go]
+ Legacy --> Nova[provider_nova.go]
+ Legacy --> Others[provider_*.go]
+ Converse --> ConverseClient[ConverseClient]
+ Anthropic --> AWS[AWS SDK]
+ Nova --> AWS
+ Others --> AWS
+ ConverseClient --> AWS
```
-## Streaming
+### Three-Layer Design
+
+**Why this architecture?**
+
+1. **Public API Layer** (`bedrockllm.go`)
+ - Single entry point: `bedrock.LLM`
+ - Hides complexity of dual API support
+ - Manages automatic caching logic
+
+2. **Message Processing Layer** (`processMessages()`)
+ - Converts `llms.MessageContent` → `bedrockclient.Message`
+ - Handles tool calls, reasoning, multimodal content
+ - Applies automatic cache control insertion
+
+3. **Internal Client Layer** (`internal/bedrockclient/`)
+ - Provider-specific implementations
+ - AWS SDK interaction
+ - Response parsing and streaming
+
+## Dual API Strategy
+
+### Why Two APIs?
+
+**Legacy API** (InvokeModel/InvokeModelWithResponseStream):
+- Direct access to model-specific features
+- Anthropic cache_control format support
+- Broader model compatibility
+- **Use when**: Model not supported by Converse API
+
+**Converse API** (Converse/ConverseStream):
+- Unified interface across all models
+- Native cachePoint support (AWS SDK types)
+- Better error handling
+- **Use when**: Building new applications (recommended)
+
+**Decision Point**: `useConverseAPI` flag in `LLM` struct
+
+```mermaid
+flowchart LR
+ A[GenerateContent] --> B{useConverseAPI?}
+ B -->|true| C[generateContentWithConverseAPI]
+ B -->|false| D[generateContentWithLegacyAPI]
+ C --> E[ConverseClient]
+ D --> F[Provider Detection]
+ F --> G[createAnthropicCompletion]
+ F --> H[createNovaCompletion]
+ F --> I[create*Completion]
+```
+
+## Automatic Prompt Caching
+
+### How It Works
+
+**Challenge**: Anthropic's prompt caching requires manual cache control wrappers on client side.
+
+**Solution**: Automatic cache point insertion for Claude 4.x models.
+
+```mermaid
+sequenceDiagram
+ participant Client
+ participant LLM
+ participant Processing
+ participant API
+
+ Client->>LLM: GenerateContent(messages)
+ LLM->>LLM: supportsCaching(modelID)?
+ alt Claude 4.x model
+ LLM->>Processing: processMessagesWithCaching(autoCaching=true)
+ Processing->>Processing: applyAutomaticCaching()
+ Note over Processing: Add cache control to
last assistant/tool message
+ else Other model
+ LLM->>Processing: processMessagesWithCaching(autoCaching=false)
+ end
+ Processing->>API: Send with cache points
+ API-->>LLM: Response with cache metrics
+```
+
+**Implementation**:
+- `supportsCaching()`: Pattern matching on model ID (`claude-opus-4`, `claude-sonnet-4`, `claude-haiku-4`)
+- `applyAutomaticCaching()`: Adds `CacheControl{Type: "ephemeral", TTL: "5m"}` to last cacheable message (assistant or tool response)
+- **Why last message?** Caches conversation history before new user input
+- **TTL Options**: 5 minutes (default) or 1 hour (configurable via `EphemeralCacheOneHour()`)
+
+**Benefits**:
+- 90% cost reduction on cached tokens
+- Zero client code changes with automatic caching
+- Works with both Legacy and Converse APIs
+- Supports both manual (`WithCacheControl()`) and automatic (`WithAutomaticCaching()`) modes
+
+## Tool Calling Implementation
+
+### Provider-Specific Differences
+
+**Why different implementations?**
+
+Different providers use different formats for tool inputs in Converse API:
+
+| Provider | Input Format | Handled By |
+|----------|-------------|------------|
+| Anthropic | Native JSON objects | `map[string]any` direct |
+| Nova | Native JSON objects | `map[string]any` direct |
+| Cohere | Native JSON objects | `map[string]any` direct |
+| GLM (Z.AI) | **String-based** | Not supported |
+
+**Problems with specific models**:
+- **GLM (Z.AI)**: Backend expects tool input as string, not JSON object. This breaks Converse API spec.
+- **AI21 Jamba**: Very hard rate limits prevent extensive testing of tool calling capabilities.
+- **Meta Llama 3.3/3.1 70B/170B**: Unstable behavior when processing tool call results.
+- **Mistral Magistral Small**: Tool calling not supported.
+- **Moonshot Kimi K2-Thinking**: Unstable tool calling behavior in streaming mode.
+- **Qwen3-VL**: Unstable tool calling in streaming mode.
+
+**Solution**: Models with backend issues or instability are excluded from tool calling tests.
+
+### convertToolCallInput() Logic
+
+**Why this function exists?**
+
+AWS SDK requires Smithy-compatible types for `document.NewLazyDocument()`. Standard Go types from `json.Unmarshal` aren't always compatible.
```go
-streamingFunc := func(ctx context.Context, chunk streaming.Chunk) error {
- fmt.Print(chunk.Content)
- return nil
+func convertToolCallInput(args any) (any, error) {
+ // 1. Check Smithy compatibility (structs with `document` tags)
+ if isSmithyValidObject(args) {
+ return args, nil
+ }
+
+ // 2. Re-encode to normalize types for Smithy SDK
+ // Uses UseNumber() to preserve numeric precision during JSON roundtrip
+ jsonBytes := bytes.NewBuffer(nil)
+ json.NewEncoder(jsonBytes).Encode(args)
+
+ decoder := json.NewDecoder(jsonBytes)
+ decoder.UseNumber() // Preserves large numbers accurately
+
+ var jsonValue any
+ decoder.Decode(&jsonValue)
+ return jsonValue, nil
+}
+```
+
+**Why UseNumber()?**
+
+Preserves numeric precision for large integers that might overflow float64. The `json.Number` type is properly handled by Smithy SDK's document encoding.
+
+### Document Unmarshal for Tool Responses
+
+**Why `UnmarshalSmithyDocument()`?**
+
+When extracting tool call from response, `block.Value.Input` is `document.LazyDocument`, not plain Go type:
+
+```go
+// WRONG: json.Marshal on document - loses type info
+argsJSON, _ := json.Marshal(block.Value.Input)
+
+// CORRECT: Unmarshal document first
+var inputData any
+block.Value.Input.UnmarshalSmithyDocument(&inputData)
+argsJSON, _ := json.Marshal(inputData)
+```
+
+## Reasoning (Thinking) Support
+
+### Models Supporting Reasoning
+
+**Converse API**:
+- Claude 4.6, 4.5, 4.1, 4.0 (Opus, Sonnet, Haiku)
+- DeepSeek R1
+- OpenAI GPT OSS (120B, 20B)
+- Moonshot Kimi K2-Thinking
+
+**Legacy API**:
+- Claude 4.5, 4.1, 4.0 (Opus, Sonnet, Haiku)
+- Claude 3.7 Sonnet
+
+**Why these models?**
+
+Extended thinking/reasoning capabilities are model-specific features. DeepSeek R1, OpenAI OSS, and Moonshot models provide reasoning through Converse API, while Anthropic models support both APIs.
+
+### Message Structure with Reasoning
+
+```mermaid
+flowchart TB
+ A[AI Message with Reasoning] --> B{Legacy or Converse?}
+ B -->|Legacy API| C[Add thinking/redacted_thinking blocks
BEFORE text content]
+ B -->|Converse API| D[Add ReasoningContent blocks
with signature/redacted]
+ C --> E[anthropicTextGenerationInputContent array]
+ D --> F[types.ContentBlock array]
+```
+
+**Why order matters?**
+
+Anthropic API spec requires thinking blocks before text blocks in assistant messages.
+
+### Signature Preservation
+
+**Challenge**: Reasoning signatures must round-trip through conversations.
+
+**Solution**: Store in `reasoning.ContentReasoning.Signature` field, re-insert on next turn.
+
+```go
+// Receive
+choice.Reasoning.Signature = []byte(...)
+
+// Send back
+llms.TextPartWithReasoning(content, reasoning)
+```
+
+## Message Processing Pipeline
+
+```mermaid
+flowchart LR
+ A[llms.MessageContent] --> B[processMessagesWithCaching]
+ B --> C{autoCaching?}
+ C -->|true| D[applyAutomaticCaching]
+ C -->|false| E[bedrockclient.Message array]
+ D --> E
+ E --> F{API Type}
+ F -->|Legacy| G[Provider-specific format]
+ F -->|Converse| H[types.Message]
+ G --> I[InvokeModel]
+ H --> J[Converse]
+```
+
+### Key Transformations
+
+**llms.MessageContent → bedrockclient.Message**:
+- Role mapping (System/Human/AI/Tool → provider format)
+- Content type detection (Text/Binary/ToolCall/ToolResponse)
+- Reasoning extraction and formatting
+- Cache control attachment
+
+**bedrockclient.Message → AWS Request**:
+- Legacy: JSON serialization with provider schemas
+- Converse: AWS SDK types with document encoding
+
+## Adding New Models
+
+### Step-by-Step Process
+
+1. **Add Model Constant** (`models_list.go`)
+```go
+// Include: Description, max tokens, languages, use cases
+ModelNewProvider = "provider.model-id"
+```
+
+2. **Update Provider Detection** (if new provider)
+```go
+// bedrockclient.go
+case strings.Contains(modelID, "newprovider"):
+ return "newprovider"
+```
+
+3. **Implement Provider** (`internal/bedrockclient/provider_new.go`)
+```go
+func createNewProviderCompletion(ctx, client, modelID, messages, options) {
+ // 1. Convert messages to provider format
+ // 2. Build request payload
+ // 3. Call InvokeModel
+ // 4. Parse response
+ // 5. Return llms.ContentResponse
+}
+```
+
+4. **Register in Switch** (`bedrockclient.go`)
+```go
+case "newprovider":
+ return createNewProviderCompletion(...)
+```
+
+5. **Add Tests** (`bedrockllm_test.go`)
+- Add model to `TestAmazonOutputConverseAPI` models list (if Converse API supported)
+- Add model to `TestAmazonOutputLegacyAPI` models list (Legacy API)
+- Add model to `TestAmazonStreamingOutputConverseAPI` (if streaming supported)
+- Add model to `TestAmazonStreamingOutputLegacyAPI` (if streaming with Legacy API supported)
+- Add model to `TestAmazonToolCallingConverseAPI` (if tools supported)
+- Add model to `TestAmazonToolCallingLegacyAPI` (if tools with Legacy API supported)
+- Add model to `TestAmazonReasoningConverseAPI` (if reasoning/thinking supported)
+- Add model to `TestAmazonReasoningLegacyAPI` (if reasoning with Legacy API supported)
+
+6. **Record HTTP Interactions**
+```bash
+HTTPRR_RECORD=. go test -v -run TestNewModel
+```
+
+### Provider Implementation Checklist
+
+- [ ] Input struct with all parameters (Temperature, TopP, MaxTokens, etc.)
+- [ ] Output struct matching API response
+- [ ] Streaming struct if model supports streaming
+- [ ] Error handling for provider-specific errors
+- [ ] Token usage extraction
+- [ ] Stop reason mapping
+
+## Testing Strategy
+
+### Why httprr?
+
+**Problem**: Integration tests require AWS credentials and cost money.
+
+**Solution**: Record HTTP interactions once, replay for fast tests.
+
+```bash
+# Record new interactions
+HTTPRR_RECORD=. go test -v -run TestName
+
+# Debug during recording
+HTTPRR_RECORD=. HTTPRR_DEBUG=true go test -v -run TestName
+
+# Replay (default)
+go test -v -run TestName
+```
+
+### Test Organization
+
+**Test File**:
+
+1. **bedrockllm_test.go**: Integration tests (requires AWS credentials)
+ - Model output validation (Converse and Legacy API)
+ - Streaming behavior (Converse and Legacy API)
+ - Tool calling workflows (Converse and Legacy API, with streaming variants)
+ - Reasoning roundtrips (Converse and Legacy API, with streaming variants)
+ - Caching metrics (automatic and manual caching)
+ - Extended thinking with tool calls
+ - Multi-turn caching with tools
+ - Client creation with different credential types (long-lived, bearer token)
+
+2. **bedrockllm_unit_test.go**: Unit tests (no credentials)
+ - Message processing logic
+ - Option configuration
+ - Cache control application
+ - Provider detection
+
+**Why separate files?**
+
+- Unit tests run in CI without credentials
+- Integration tests record once, replay forever
+- Tool tests validate complex workflows
+
+### Testing Non-Deterministic Tool Calls
+
+**Challenge**: `map[string]any` serialization order is non-deterministic.
+
+```go
+// First run: {"a": 15, "b": 8}
+// Second run: {"b": 8, "a": 15} // Different order!
+```
+
+**Solution**: Skip second request in replay mode (`isReplaying` check).
+
+```go
+if isReplaying {
+ return nil // Don't send tool result
+}
+```
+
+## Error Handling
+
+### Error Mapping Strategy
+
+**Why custom mapping?**
+
+AWS errors are provider-specific strings. Need standardized codes for client logic.
+
+```go
+// errors.go
+bedrockErrorMappings = []errorMapping{
+ {patterns: []string{"throttlingexception"}, code: llms.ErrCodeRateLimit},
+ {patterns: []string{"accessdenied"}, code: llms.ErrCodeAuthentication},
+ // ...
+}
+```
+
+**Usage**:
+```go
+if llmErr, ok := err.(*llms.Error); ok {
+ switch llmErr.Code {
+ case llms.ErrCodeRateLimit:
+ // Implement backoff
+ }
+}
+```
+
+## Streaming Implementation
+
+### Event Processing Pattern
+
+**Both APIs use AWS SDK event streams**, but different event types:
+
+**Legacy API**:
+```go
+// Anthropic: streamingCompletionResponseChunk
+types: message_start, content_block_delta, message_delta, message_stop
+```
+
+**Converse API**:
+```go
+// AWS SDK types
+ConverseStreamOutputMemberContentBlockDelta
+ConverseStreamOutputMemberContentBlockStart
+ConverseStreamOutputMemberContentBlockStop
+```
+
+### Tool Call Streaming Accumulation
+
+**Why accumulation needed?**
+
+Tool arguments arrive in chunks:
+
+```go
+// Chunk 1: {"operation"
+// Chunk 2: :"multiply","a"
+// Chunk 3: :15,"b":8}
+```
+
+**Solution**: Accumulate in `streaming.ToolCall` map, send complete call at `ContentBlockStop`.
+
+## Maintenance Guidelines
+
+### When to Use Legacy vs Converse API
+
+**Use Legacy API**:
+- Model doesn't support Converse API
+- Need Anthropic-specific cache_control format
+- Debugging provider-specific issues
+
+**Use Converse API**:
+- Default for new implementations
+- Better error messages
+- Unified tool calling
+- Native cachePoint support
+
+### Adding Caching Support
+
+**Criteria**:
+1. Model must support Anthropic prompt caching (currently only Claude 4.x)
+2. Add pattern to `supportsCaching()` in `bedrockllm.go`:
+```go
+cachingPatterns := []string{
+ "claude-opus-4",
+ "claude-sonnet-4",
+ "claude-haiku-4",
+ "claude-new-4", // Add new model pattern
+}
+```
+3. Ensure model supports minimum 1024 tokens threshold for cache activation
+4. Add tests in `TestAmazonAutomaticCachingConverseAPI` and `TestAmazonAutomaticCachingLegacyAPI`
+
+### Common Pitfalls
+
+**1. Forgetting to handle nil FunctionCall**
+```go
+// BAD
+Name: part.FunctionCall.Name // Panic if nil
+
+// GOOD
+if part.FunctionCall == nil {
+ return errors.New("missing function call")
+}
+```
+
+**2. Ignoring marshal errors**
+```go
+// BAD
+argsJSON, _ := json.Marshal(data)
+
+// GOOD
+argsJSON, err := json.Marshal(data)
+if err != nil {
+ return fmt.Errorf("marshal failed: %w", err)
+}
+```
+
+**3. Not checking tool call arguments validity**
+```go
+// BAD - may pass invalid JSON to tool
+toolCall.FunctionCall.Arguments // No validation
+
+// GOOD - validate tool arguments can be parsed
+var args map[string]any
+if err := json.Unmarshal([]byte(toolCall.FunctionCall.Arguments), &args); err != nil {
+ return fmt.Errorf("invalid tool arguments: %w", err)
+}
+```
+
+## File Organization
+
+```
+llms/bedrock/
+├── bedrockllm.go # Main LLM implementation, message processing, caching
+├── bedrockllm_option.go # Configuration options
+├── bedrockllm_test.go # Integration tests (httprr recorded)
+├── bedrockllm_unit_test.go # Unit tests (no AWS required)
+├── models_list.go # Model constants and documentation
+├── errors.go # Error mapping
+├── doc.go # Package documentation
+├── tool_call_test.go # Tool call processing tests
+├── llmtest_test.go # LLM interface compliance tests
+└── internal/bedrockclient/
+ ├── bedrockclient.go # Legacy API client
+ ├── bedrockclient_converse.go # Converse API client
+ ├── bedrockclient_util.go # Smithy validation
+ ├── bedrockclient_test.go # Client tests
+ ├── bedrockclient_integration_test.go # Client integration tests
+ ├── provider_anthropic.go # Anthropic-specific implementation
+ ├── provider_nova.go # Nova-specific implementation
+ ├── provider_*.go # Other providers
+ └── *_test.go # Provider tests
+```
+
+## Key Design Decisions
+
+### Why Separate Provider Files?
+
+**Problem**: Single file would be 5000+ lines with mixed concerns.
+
+**Solution**: Each provider in separate file with consistent interface.
+
+**Benefits**:
+- Easy to add new providers
+- Clear separation of model-specific logic
+- Isolated testing
+
+### Why Two Cache Control Formats?
+
+**Legacy API**: Anthropic's `cache_control` in message content
+```json
+{
+ "type": "text",
+ "text": "...",
+ "cache_control": {"type": "ephemeral", "ttl": "5m"}
+}
+```
+
+**Converse API**: AWS's `cachePoint` blocks
+```json
+{
+ "content": [
+ {"text": "..."},
+ {"cachePoint": {"type": "default", "ttl": "fiveMinutes"}}
+ ]
+}
+```
+
+**Why support both?**
+- Legacy API: Anthropic `cache_control` format required (embedded in content blocks)
+- Converse API: AWS `cachePoint` format required (separate content block type)
+- Automatic caching abstracts the difference by using appropriate format based on API
+
+### Message Processing: Content Parts to Messages
+
+**Key Insight**: `llms.MessageContent` supports multiple content parts (text, images, tool calls), but provider APIs may require them as separate messages or flattened arrays.
+
+**Processing Flow**:
+```go
+// Input: Single MessageContent with multiple parts
+llms.MessageContent{
+ Role: llms.ChatMessageTypeHuman,
+ Parts: [TextPart("Describe"), BinaryPart(imageData)]
}
-resp, err := llm.GenerateContent(ctx, messages,
- llms.WithStreamingFunc(streamingFunc),
-)
+// Output: Flat message array for provider API
+[
+ Message{Type: "text", Content: "Describe"},
+ Message{Type: "image", Content: base64Data, MimeType: "image/jpeg"}
+]
```
-## Tool Calling
+**Why flatten?**
+- Anthropic Legacy API: Requires flat content array per message
+- Nova/other providers: Each content type is separate array element
+- Simplifies provider-specific serialization logic
-```go
-tools := []llms.Tool{{
- Type: "function",
- Function: &llms.FunctionDefinition{
- Name: "calculator",
- Description: "Perform arithmetic operations",
- Parameters: map[string]any{
- "type": "object",
- "properties": map[string]any{
- "operation": map[string]any{
- "type": "string",
- "enum": []string{"add", "subtract", "multiply", "divide"},
- },
- "a": map[string]any{"type": "number"},
- "b": map[string]any{"type": "number"},
- },
- "required": []string{"operation", "a", "b"},
- },
- },
-}}
+## Debugging Guide
-resp, err := llm.GenerateContent(ctx, messages,
- llms.WithTools(tools),
-)
-```
-
-## Configuration Options
-
-```go
-// Custom AWS client
-client := bedrockruntime.NewFromConfig(cfg)
-llm, err := bedrock.New(bedrock.WithClient(client))
-
-// Model selection
-llm, err := bedrock.New(bedrock.WithModel(bedrock.ModelAmazonNovaProV1))
-
-// Enable Converse API (recommended for new applications)
-llm, err := bedrock.New(bedrock.WithConverseAPI())
-
-// Callback handler
-llm, err := bedrock.New(bedrock.WithCallback(handler))
-```
-
-## Key Differences
-
-### Converse API vs Legacy API
-- **Converse API**: Unified interface, better tool calling, reasoning support
-- **Legacy API**: Direct model-specific implementations, broader model compatibility
-
-### Model Capabilities
-- **Tool Calling**: Nova, Anthropic Claude 4/3.7/3.5, Cohere Command-R+
-- **Reasoning**: Anthropic Claude 4/3.7, Amazon Nova models
-- **Streaming**: Most models (except AI21 Jamba series)
-- **Multimodal**: Nova Pro/Lite, Claude models
-
-## Environment Setup
+### Enable HTTP Logging
```bash
-export AWS_ACCESS_KEY_ID=your_access_key
-export AWS_SECRET_ACCESS_KEY=your_secret_key
-export AWS_REGION=us-east-1
+HTTPRR_DEBUG=true go test -v -run TestName
```
-## Testing
+### Check Cache Metrics
-```bash
-# Basic functionality
-go test -v -run TestAmazonOutput
-
-# Streaming support
-go test -v -run TestAmazonStreamingOutput
-
-# Tool calling
-go test -v -run TestAmazonToolCalling
+```go
+resp.Choices[0].GenerationInfo["CacheReadInputTokens"] // Tokens read from cache
+resp.Choices[0].GenerationInfo["CacheCreationInputTokens"] // Tokens written to cache
```
-For comprehensive examples, see the [examples directory](../../examples/) in the langchaingo repository.
+### Validate Tool Call Arguments
+
+Look for empty `Arguments` in logs - indicates parsing issue:
+```go
+if len(arguments) == 0 {
+ // Check FunctionCall.Arguments JSON validity
+}
+```
+
+### Common Errors
+
+**"unsupported message type"**
+- Added new ContentPart type without handling in processMessages()
+
+**"role not supported"**
+- Provider doesn't support message role (e.g., Function role)
+
+**"completed due to max_tokens"**
+- Increase MaxTokens in request
+
+**"cached HTTP response not found"**
+- httprr recording changed, re-record with `HTTPRR_RECORD=.`
+
+## Performance Considerations
+
+### Automatic Caching Impact
+
+**First request**: Cache creation overhead (~50ms)
+**Subsequent requests**: 90% token cost reduction, ~20% latency reduction
+
+**Best for**:
+- Long conversations (3+ turns)
+- Large system prompts (>1024 tokens)
+- Repeated context (tools, RAG documents)
+
+### Streaming Latency
+
+**Time to first token**: 200-500ms (depending on model)
+**Chunk frequency**: Every 20-50ms
+
+**Use streaming when**:
+- User-facing chat interfaces
+- Long responses (>500 tokens)
+- Real-time feedback needed
+
+## Future Enhancements
+
+### Potential Improvements
+
+1. **Converse API Migration**
+ - Move all models to Converse API
+ - Deprecate Legacy API providers
+ - Why: Simpler maintenance, better consistency
+
+2. **Smart Cache TTL Selection**
+ - 5m for short conversations
+ - 1h for long sessions
+ - Why: Optimize cost vs cache hit rate
+
+3. **Parallel Tool Calls**
+ - Support multiple simultaneous tools
+ - Why: Some models return parallel tool calls
+
+4. **Structured Output**
+ - JSON schema validation
+ - Why: Type-safe responses
+
+## Contributing
+
+### Before Adding Features
+
+1. Check if Converse API supports it natively
+2. Consider impact on both API paths
+3. Add tests for both streaming and non-streaming
+4. Update httprr recordings
+
+### Code Review Checklist
+
+- [ ] Error handling for all AWS SDK calls
+- [ ] Nil checks for optional fields
+- [ ] Cache control doesn't break non-caching models
+- [ ] Tool calling tested with real model
+- [ ] httprr recordings committed
+- [ ] Documentation updated
+
+## Supported Model Matrix
+
+| Provider | Tool Calling | Reasoning | Streaming | Multimodal | Caching |
+|----------|-------------|-----------|-----------|------------|---------|
+| Claude 4.6 | ✅ | ✅ | ✅ | ✅ | ✅ |
+| Claude 4.5 | ✅ | ✅ | ✅ | ✅ | ✅ |
+| Claude 4.1 | ✅ | ✅ | ✅ | ✅ | ✅ |
+| Claude 4.0 | ✅ | ✅ | ✅ | ✅ | ✅ |
+| Claude 3.7 | ✅ | ✅ | ✅ | ❌ | ❌ |
+| Claude 3.5 | ✅ | ❌ | ✅ | ❌ | ❌ |
+| Nova 2/Pro/Lite | ✅ | ❌ | ✅ | ✅ | ❌ |
+| Llama 4 | Limited | ❌ | ✅ | ✅ | ❌ |
+| Cohere R+ | ✅ | ❌ | ✅ | ❌ | ❌ |
+| DeepSeek V3.2 | ✅ | ❌ | ✅ | ❌ | ❌ |
+| DeepSeek R1 | ❌ | ✅ | ✅ | ❌ | ❌ |
+| AI21 Jamba | Limited* | ❌ | ✅** | ❌ | ❌ |
+| OpenAI GPT (OSS) | ✅ | ✅ | ✅ | ❌ | ❌ |
+| Qwen3 | Varies*** | ❌ | ✅ | Some | ❌ |
+| Mistral | ✅**** | ❌ | ✅ | ❌ | ❌ |
+| Moonshot Kimi | ✅***** | ✅ | ✅ | ❌ | ❌ |
+| GLM-4.7 | ❌****** | ❌ | ✅ | ❌ | ❌ |
+
+*AI21 Jamba: Rate limits prevent extensive tool calling testing
+**AI21 Jamba: Streaming supported only with Converse API
+***Qwen3: Most models support tools, except Qwen3-VL (unstable in streaming)
+****Mistral: Large3 and Large2402 support tools, MagistralSmall2509 does not
+*****Moonshot: K2.5 supports tools, K2-Thinking is unstable
+******GLM models: Backend incompatibility with Converse API tool format (requires string instead of JSON)
+
+See `models_list.go` for complete model list and detailed capabilities.
diff --git a/llms/bedrock/bedrock_tool_integration_test.go b/llms/bedrock/bedrock_tool_integration_test.go
deleted file mode 100644
index 438a6190..00000000
--- a/llms/bedrock/bedrock_tool_integration_test.go
+++ /dev/null
@@ -1,200 +0,0 @@
-package bedrock_test
-
-import (
- "context"
- "encoding/json"
- "net/http"
- "os"
- "testing"
-
- "github.com/stretchr/testify/require"
- "github.com/vxcontrol/langchaingo/internal/httprr"
- "github.com/vxcontrol/langchaingo/llms"
- "github.com/vxcontrol/langchaingo/llms/bedrock"
-)
-
-func TestBedrockAnthropicToolCalling(t *testing.T) { //nolint:funlen
- ctx := context.Background()
-
- httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID")
-
- rr := httprr.OpenForTest(t, http.DefaultTransport)
- defer rr.Close()
-
- // Only run tests in parallel when not recording (to avoid rate limits)
- if !rr.Recording() {
- t.Parallel()
- }
-
- // Configure AWS client to use httprr transport
- client, err := setUpTestWithTransport(rr)
- if err != nil {
- t.Fatal(err)
- }
-
- llm, err := bedrock.New(bedrock.WithClient(client))
- if err != nil {
- t.Fatal(err)
- }
-
- // Define a weather tool
- weatherTool := llms.Tool{
- Type: "function",
- Function: &llms.FunctionDefinition{
- Name: "get_weather",
- Description: "Get the current weather for a location",
- Parameters: map[string]any{
- "type": "object",
- "properties": map[string]any{
- "location": map[string]any{
- "type": "string",
- "description": "The city and state, e.g. San Francisco, CA",
- },
- "unit": map[string]any{
- "type": "string",
- "enum": []string{"celsius", "fahrenheit"},
- "description": "The unit of temperature",
- },
- },
- "required": []string{"location"},
- },
- },
- }
-
- t.Run("Anthropic Claude 3 with tool calling", func(t *testing.T) {
- // Skip if not recording and no credentials
- if !rr.Recording() && !hasAWSCredentials() {
- t.Skip("Skipping test: no AWS credentials and not recording")
- }
-
- msgs := []llms.MessageContent{
- llms.TextParts(llms.ChatMessageTypeHuman, "What's the weather like in New York?"),
- }
-
- resp, err := llm.GenerateContent(ctx, msgs,
- llms.WithModel(bedrock.ModelAnthropicClaudeHaiku45),
- llms.WithTools([]llms.Tool{weatherTool}),
- llms.WithMaxTokens(512),
- )
- if err != nil {
- t.Fatal(err)
- }
-
- require.NotNil(t, resp)
- require.NotEmpty(t, resp.Choices)
-
- // Check if the model wants to use the tool
- choice := resp.Choices[0]
- if len(choice.ToolCalls) > 0 {
- t.Logf("Model requested tool call: %+v", choice.ToolCalls[0])
-
- // Verify tool call structure
- toolCall := choice.ToolCalls[0]
- require.Equal(t, "function", toolCall.Type)
- require.NotNil(t, toolCall.FunctionCall)
- require.Equal(t, "get_weather", toolCall.FunctionCall.Name)
-
- // Parse arguments
- var args map[string]any
- err := json.Unmarshal([]byte(toolCall.FunctionCall.Arguments), &args)
- require.NoError(t, err)
- require.Contains(t, args, "location")
-
- // Add assistant response with tool call
- assistantResponse := llms.MessageContent{
- Role: llms.ChatMessageTypeAI,
- Parts: []llms.ContentPart{
- llms.ToolCall{
- ID: toolCall.ID,
- Type: toolCall.Type,
- FunctionCall: &llms.FunctionCall{
- Name: toolCall.FunctionCall.Name,
- Arguments: toolCall.FunctionCall.Arguments,
- },
- },
- },
- }
- msgs = append(msgs, assistantResponse)
-
- // Add tool response
- toolResponse := llms.MessageContent{
- Role: llms.ChatMessageTypeTool,
- Parts: []llms.ContentPart{
- llms.ToolCallResponse{
- ToolCallID: toolCall.ID,
- Name: "get_weather",
- Content: "It's currently 72°F and sunny in New York",
- },
- },
- }
- msgs = append(msgs, toolResponse)
-
- resp2, err := llm.GenerateContent(ctx, msgs,
- llms.WithModel(bedrock.ModelAnthropicClaudeHaiku45),
- llms.WithMaxTokens(512),
- )
- require.NoError(t, err)
- require.NotNil(t, resp2)
- require.NotEmpty(t, resp2.Choices)
-
- t.Logf("Final response: %s", resp2.Choices[0].Content)
- } else {
- t.Logf("Model response without tool call: %s", choice.Content)
- }
- })
-
- t.Run("Multiple tools", func(t *testing.T) {
- // Skip if not recording and no credentials
- if !rr.Recording() && !hasAWSCredentials() {
- t.Skip("Skipping test: no AWS credentials and not recording")
- }
-
- calculatorTool := llms.Tool{
- Type: "function",
- Function: &llms.FunctionDefinition{
- Name: "calculate",
- Description: "Perform mathematical calculations",
- Parameters: map[string]any{
- "type": "object",
- "properties": map[string]any{
- "expression": map[string]any{
- "type": "string",
- "description": "The mathematical expression to evaluate",
- },
- },
- "required": []string{"expression"},
- },
- },
- }
-
- msgs := []llms.MessageContent{
- llms.TextParts(llms.ChatMessageTypeHuman, "What's 123 * 456 and what's the weather in Paris?"),
- }
-
- resp, err := llm.GenerateContent(ctx, msgs,
- llms.WithModel(bedrock.ModelAnthropicClaudeHaiku45),
- llms.WithTools([]llms.Tool{weatherTool, calculatorTool}),
- llms.WithMaxTokens(512),
- )
- if err != nil {
- t.Fatal(err)
- }
-
- require.NotNil(t, resp)
- require.NotEmpty(t, resp.Choices)
-
- // Check for multiple tool calls
- choice := resp.Choices[0]
- t.Logf("Number of tool calls: %d", len(choice.ToolCalls))
- for i, tc := range choice.ToolCalls {
- t.Logf("Tool call %d: %s(%s)", i, tc.FunctionCall.Name, tc.FunctionCall.Arguments)
- }
- })
-}
-
-func hasAWSCredentials() bool {
- // Check if AWS credentials are available
- _, hasKey := os.LookupEnv("AWS_ACCESS_KEY_ID")
- _, hasProfile := os.LookupEnv("AWS_PROFILE")
- return hasKey || hasProfile
-}
diff --git a/llms/bedrock/bedrockllm.go b/llms/bedrock/bedrockllm.go
index fc3395ff..156f01a2 100644
--- a/llms/bedrock/bedrockllm.go
+++ b/llms/bedrock/bedrockllm.go
@@ -4,6 +4,9 @@ import (
"context"
"encoding/json"
"errors"
+ "fmt"
+ "strings"
+ "time"
"github.com/vxcontrol/langchaingo/callbacks"
"github.com/vxcontrol/langchaingo/llms"
@@ -17,11 +20,12 @@ const defaultModel = ModelAnthropicClaudeHaiku45
// LLM is a Bedrock LLM implementation.
type LLM struct {
- modelID string
- client *bedrockclient.Client
- converseClient *bedrockclient.ConverseClient
- useConverseAPI bool
- CallbacksHandler callbacks.Handler
+ modelID string
+ client *bedrockclient.Client
+ converseClient *bedrockclient.ConverseClient
+ useConverseAPI bool
+ enableAutoCaching bool
+ CallbacksHandler callbacks.Handler
}
// New creates a new Bedrock LLM implementation.
@@ -36,11 +40,12 @@ func NewWithContext(ctx context.Context, opts ...Option) (*LLM, error) {
return nil, err
}
return &LLM{
- client: c,
- converseClient: converseC,
- useConverseAPI: o.useConverseAPI,
- modelID: o.modelID,
- CallbacksHandler: o.callbackHandler,
+ client: c,
+ converseClient: converseC,
+ useConverseAPI: o.useConverseAPI,
+ enableAutoCaching: o.enableAutoCaching,
+ modelID: o.modelID,
+ CallbacksHandler: o.callbackHandler,
}, nil
}
@@ -97,11 +102,19 @@ func (l *LLM) GenerateContent(ctx context.Context, messages []llms.MessageConten
// generateContentWithConverseAPI uses the unified Converse API
func (l *LLM) generateContentWithConverseAPI(ctx context.Context, messages []llms.MessageContent, opts llms.CallOptions) (*llms.ContentResponse, error) {
- m, err := processMessages(messages)
+ // Apply automatic caching to bedrock messages if enabled
+ shouldAutoCache := l.enableAutoCaching && l.supportsCaching(opts.Model)
+ m, err := processMessagesWithCaching(messages, shouldAutoCache)
if err != nil {
return nil, err
}
+ // Check if caching should be enabled
+ // Caching is enabled if either:
+ // 1. Automatic caching is enabled and model supports it
+ // 2. Manual cache control is present in messages
+ enableCaching := shouldAutoCache || checkIfCachingRequested(messages)
+
// Build Converse input
input := &bedrockclient.ConverseInput{
ModelID: opts.Model,
@@ -109,6 +122,7 @@ func (l *LLM) generateContentWithConverseAPI(ctx context.Context, messages []llm
Tools: opts.Tools,
StreamingFunc: opts.StreamingFunc,
ReasoningConfig: opts.Reasoning,
+ EnableCaching: enableCaching,
}
// Set inference parameters
@@ -142,7 +156,9 @@ func (l *LLM) generateContentWithConverseAPI(ctx context.Context, messages []llm
// generateContentWithLegacyAPI uses the original model-specific implementations
func (l *LLM) generateContentWithLegacyAPI(ctx context.Context, messages []llms.MessageContent, opts llms.CallOptions) (*llms.ContentResponse, error) {
- m, err := processMessages(messages)
+ // Apply automatic caching to bedrock messages if enabled
+ shouldAutoCache := l.enableAutoCaching && l.supportsCaching(opts.Model)
+ m, err := processMessagesWithCaching(messages, shouldAutoCache)
if err != nil {
return nil, err
}
@@ -163,16 +179,45 @@ func (l *LLM) generateContentWithLegacyAPI(ctx context.Context, messages []llms.
}
func processMessages(messages []llms.MessageContent) ([]bedrockclient.Message, error) {
+ return processMessagesWithCaching(messages, false)
+}
+
+func processMessagesWithCaching(messages []llms.MessageContent, autoCaching bool) ([]bedrockclient.Message, error) {
bedrockMsgs := make([]bedrockclient.Message, 0, len(messages))
for _, m := range messages {
for _, part := range m.Parts {
switch part := part.(type) {
+ case CachedContent:
+ // Handle cached content with cache control
+ cacheControl := convertCacheControl(part.CacheControl)
+ // Process the wrapped content
+ switch wrapped := part.ContentPart.(type) {
+ case llms.TextContent:
+ bedrockMsgs = append(bedrockMsgs, bedrockclient.Message{
+ Role: m.Role,
+ Content: wrapped.Text,
+ Type: "text",
+ Reasoning: wrapped.Reasoning,
+ CacheControl: cacheControl,
+ })
+ case llms.BinaryContent:
+ bedrockMsgs = append(bedrockMsgs, bedrockclient.Message{
+ Role: m.Role,
+ Content: string(wrapped.Data),
+ MimeType: wrapped.MIMEType,
+ Type: "image",
+ CacheControl: cacheControl,
+ })
+ default:
+ return nil, errors.New("unsupported cached content type")
+ }
case llms.TextContent:
bedrockMsgs = append(bedrockMsgs, bedrockclient.Message{
- Role: m.Role,
- Content: part.Text,
- Type: "text",
+ Role: m.Role,
+ Content: part.Text,
+ Type: "text",
+ Reasoning: part.Reasoning,
})
case llms.BinaryContent:
bedrockMsgs = append(bedrockMsgs, bedrockclient.Message{
@@ -182,10 +227,13 @@ func processMessages(messages []llms.MessageContent) ([]bedrockclient.Message, e
Type: "image",
})
case llms.ToolCall:
+ if part.FunctionCall == nil {
+ return nil, errors.New("tool call missing function call data")
+ }
var arguments map[string]any
- if part.FunctionCall != nil {
+ if part.FunctionCall.Arguments != "" {
if err := json.Unmarshal([]byte(part.FunctionCall.Arguments), &arguments); err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to unmarshal tool call arguments: %w", err)
}
}
bedrockMsgs = append(bedrockMsgs, bedrockclient.Message{
@@ -208,11 +256,103 @@ func processMessages(messages []llms.MessageContent) ([]bedrockclient.Message, e
},
})
default:
+ // Check if it's unknown type - might be a specific provider type
return nil, errors.New("unsupported message type")
}
}
}
+
+ // Apply automatic caching if requested
+ if autoCaching {
+ applyAutomaticCaching(bedrockMsgs)
+ }
+
return bedrockMsgs, nil
}
+// applyAutomaticCaching adds cache control to the last assistant or tool message
+// to enable conversation history caching without manual intervention.
+func applyAutomaticCaching(messages []bedrockclient.Message) {
+ if len(messages) == 0 {
+ return
+ }
+
+ // Find the last assistant or tool message before the current user turn
+ lastCacheableIdx := -1
+ for i := len(messages) - 1; i >= 0; i-- {
+ // Skip the last message if it's from human (current turn)
+ if i == len(messages)-1 && messages[i].Role == llms.ChatMessageTypeHuman {
+ continue
+ }
+ // Find last assistant or tool message
+ if messages[i].Role == llms.ChatMessageTypeAI || messages[i].Role == llms.ChatMessageTypeTool {
+ lastCacheableIdx = i
+ break
+ }
+ }
+
+ if lastCacheableIdx == -1 {
+ return
+ }
+
+ // Add cache control to the selected message
+ if messages[lastCacheableIdx].CacheControl == nil {
+ messages[lastCacheableIdx].CacheControl = &bedrockclient.CacheControl{
+ Type: "ephemeral",
+ TTL: "5m",
+ }
+ }
+}
+
+// convertCacheControl converts shared llms.CacheControl to Bedrock-specific format
+func convertCacheControl(llmCache *llms.CacheControl) *bedrockclient.CacheControl {
+ if llmCache == nil {
+ return nil
+ }
+
+ bedrockCache := &bedrockclient.CacheControl{
+ Type: llmCache.Type,
+ }
+
+ // Convert duration to TTL string
+ if llmCache.Duration > 0 {
+ if llmCache.Duration >= time.Hour {
+ bedrockCache.TTL = "1h"
+ } else {
+ bedrockCache.TTL = "5m"
+ }
+ }
+
+ return bedrockCache
+}
+
+// checkIfCachingRequested checks if any messages contain CachedContent
+func checkIfCachingRequested(messages []llms.MessageContent) bool {
+ for _, msg := range messages {
+ for _, part := range msg.Parts {
+ if _, ok := part.(CachedContent); ok {
+ return true
+ }
+ }
+ }
+ return false
+}
+
+// supportsCaching checks if the model supports prompt caching
+func (l *LLM) supportsCaching(modelID string) bool {
+ // All Claude 4.x models support prompt caching (Opus, Sonnet, Haiku)
+ cachingPatterns := []string{
+ "claude-opus-4",
+ "claude-sonnet-4",
+ "claude-haiku-4",
+ }
+
+ for _, pattern := range cachingPatterns {
+ if strings.Contains(modelID, pattern) {
+ return true
+ }
+ }
+ return false
+}
+
var _ llms.Model = (*LLM)(nil)
diff --git a/llms/bedrock/bedrockllm_option.go b/llms/bedrock/bedrockllm_option.go
index 22f22e8c..26546222 100644
--- a/llms/bedrock/bedrockllm_option.go
+++ b/llms/bedrock/bedrockllm_option.go
@@ -1,7 +1,10 @@
package bedrock
import (
+ "time"
+
"github.com/vxcontrol/langchaingo/callbacks"
+ "github.com/vxcontrol/langchaingo/llms"
"github.com/aws/aws-sdk-go-v2/service/bedrockruntime"
)
@@ -10,11 +13,12 @@ import (
type Option func(*options)
type options struct {
- modelProvider string
- modelID string
- client *bedrockruntime.Client
- callbackHandler callbacks.Handler
- useConverseAPI bool
+ modelProvider string
+ modelID string
+ client *bedrockruntime.Client
+ callbackHandler callbacks.Handler
+ useConverseAPI bool
+ enableAutoCaching bool
}
// WithModel allows setting a custom modelId.
@@ -67,13 +71,95 @@ func WithCallback(callbackHandler callbacks.Handler) Option {
// - Reasoning content support for Claude 3.7+ and Nova models
// - Multimodal input support (text, images, documents)
// - Better error handling and response consistency
+// - Prompt caching support via cachePoint (requires AWS SDK types)
//
// Supported models: All Anthropic Claude, Amazon Nova, Meta Llama,
// Cohere Command, and AI21 Jamba models available through Bedrock.
//
// Note: This is the recommended approach for new applications.
+//
+// Prompt Caching:
+// - Legacy API (InvokeModel) supports Anthropic's cache_control format
+// - Converse API supports cachePoint via SystemContentBlockMemberCachePoint
+// - Cache metrics are returned in response.Usage (CacheReadInputTokens, CacheWriteInputTokens)
+// - Requires minimum tokens per checkpoint (1024 for Sonnet 4.5, 4096 for Haiku 4.5)
+// - Supports 5m and 1h TTL for Claude 4.x models
func WithConverseAPI() Option {
return func(o *options) {
o.useConverseAPI = true
}
}
+
+// WithAutomaticCaching enables automatic prompt caching for supported Anthropic models.
+//
+// When enabled, caching is automatically applied for models matching these patterns:
+// - claude-opus-4 (includes 4.6, 4.5, 4.1, 4.0)
+// - claude-sonnet-4 (includes 4.6, 4.5, 4.0)
+// - claude-haiku-4 (includes 4.5)
+//
+// The caching strategy automatically:
+// - Adds cache points to system prompts
+// - Adds cache points to conversation history (last message before new user input)
+// - Uses ephemeral 5-minute TTL by default
+//
+// Benefits:
+// - 90% cost reduction on cached input tokens
+// - No manual cache control wrapper needed on client side
+// - Transparent caching without modifying message chains
+//
+// Note: Automatic caching works with both Legacy and Converse APIs.
+func WithAutomaticCaching() Option {
+ return func(o *options) {
+ o.enableAutoCaching = true
+ }
+}
+
+// EphemeralCache creates a standard ephemeral cache control for Bedrock with 5-minute duration.
+func EphemeralCache() *llms.CacheControl {
+ return &llms.CacheControl{
+ Type: "ephemeral",
+ Duration: 5 * time.Minute,
+ }
+}
+
+// EphemeralCacheOneHour creates a 1-hour ephemeral cache control for Bedrock.
+// Supported by Claude Opus 4.5, Haiku 4.5, and Sonnet 4.5.
+func EphemeralCacheOneHour() *llms.CacheControl {
+ return &llms.CacheControl{
+ Type: "ephemeral",
+ Duration: time.Hour,
+ }
+}
+
+// CachedContent represents content with caching instructions for Bedrock.
+// This wraps any ContentPart and adds cache control metadata.
+//
+// Note: For most use cases, prefer using bedrock.WithAutomaticCaching() option
+// which automatically applies caching to supported Anthropic models (Claude 4.x).
+// This manual wrapper is only needed for fine-grained cache control.
+//
+// Automatic caching is supported in both Legacy and Converse APIs.
+type CachedContent struct {
+ llms.ContentPart
+ CacheControl *llms.CacheControl `json:"cache_control,omitempty"`
+}
+
+// WithCacheControl wraps content with cache control instructions for Bedrock.
+// This allows explicit control over what content should be cached.
+//
+// Recommended: Use bedrock.WithAutomaticCaching() option instead for transparent caching.
+//
+// Manual usage (when fine-grained control is needed):
+//
+// bedrock.WithCacheControl(
+// llms.TextPart("long context..."),
+// bedrock.EphemeralCache(),
+// )
+//
+// Supported models: Claude Opus 4, Sonnet 4, Haiku 4 and their variants.
+func WithCacheControl(content llms.ContentPart, control *llms.CacheControl) CachedContent {
+ return CachedContent{
+ ContentPart: content,
+ CacheControl: control,
+ }
+}
diff --git a/llms/bedrock/bedrockllm_test.go b/llms/bedrock/bedrockllm_test.go
index 05f5d6b4..285e3c88 100644
--- a/llms/bedrock/bedrockllm_test.go
+++ b/llms/bedrock/bedrockllm_test.go
@@ -15,7 +15,9 @@ import (
"github.com/vxcontrol/langchaingo/llms/streaming"
"github.com/aws/aws-sdk-go-v2/config"
+ "github.com/aws/aws-sdk-go-v2/credentials"
"github.com/aws/aws-sdk-go-v2/service/bedrockruntime"
+ "github.com/aws/smithy-go/auth/bearer"
)
func setUpTestWithTransport(rr *httprr.RecordReplay) (*bedrockruntime.Client, error) {
@@ -93,13 +95,15 @@ func TestAmazonOutputConverseAPI(t *testing.T) {
bedrock.ModelAmazonNovaMicroV1,
// Anthropic models
+ bedrock.ModelAnthropicClaudeOpus46,
+ bedrock.ModelAnthropicClaudeSonnet46,
bedrock.ModelAnthropicClaudeOpus45,
bedrock.ModelAnthropicClaudeHaiku45,
bedrock.ModelAnthropicClaudeSonnet45,
bedrock.ModelAnthropicClaudeOpus41,
- bedrock.ModelAnthropicClaudeOpus4,
+ // bedrock.ModelAnthropicClaudeOpus4, // Model is deprecated
bedrock.ModelAnthropicClaudeSonnet4,
- bedrock.ModelAnthropicClaude37Sonnet,
+ // bedrock.ModelAnthropicClaude37Sonnet, // Model is deprecated
bedrock.ModelAnthropicClaude35Haiku,
// Cohere models
@@ -108,18 +112,43 @@ func TestAmazonOutputConverseAPI(t *testing.T) {
// Meta models
// bedrock.ModelMetaLlama4MaverickInstructV1, // Unavailable for MENA users
- // bedrock.ModelMetaLlama4ScoutInstructV1, // Unavailable for MENA users
+ // bedrock.ModelMetaLlama4ScoutInstructV1, // Unavailable for MENA users
bedrock.ModelMetaLlama3370bInstructV1,
- // bedrock.ModelMetaLlama3211bInstructV1, // Unavailable for MENA users
- // bedrock.ModelMetaLlama3211bInstructV1, // Unavailable for MENA users
- // bedrock.ModelMetaLlama3290bInstructV1, // Unavailable for MENA users
+ // bedrock.ModelMetaLlama3211bInstructV1, // Unavailable for MENA users
+ // bedrock.ModelMetaLlama3211bInstructV1, // Unavailable for MENA users
+ // bedrock.ModelMetaLlama3290bInstructV1, // Unavailable for MENA users
bedrock.ModelMetaLlama3170bInstructV1,
- // bedrock.ModelMetaLlama318bInstructV1, // Unavailable for MENA users
+ // bedrock.ModelMetaLlama318bInstructV1, // Unavailable for MENA users
bedrock.ModelMetaLlama370bInstructV1,
bedrock.ModelMetaLlama38bInstructV1,
// DeepSeek models
bedrock.ModelDeepSeekR1V1,
+ bedrock.ModelDeepSeekV32,
+
+ // OpenAI models
+ bedrock.ModelOpenAIGptOss120BV1,
+ bedrock.ModelOpenAIGptOss20BV1,
+
+ // Qwen models
+ bedrock.ModelQwen3Next80BA3B,
+ bedrock.ModelQwen3VL235BA22B,
+ bedrock.ModelQwen332BV1,
+ bedrock.ModelQwen3Coder30BA3BV1,
+ bedrock.ModelQwen3CoderNext,
+
+ // Mistral models
+ bedrock.ModelMistralLarge3,
+ bedrock.ModelMistralMagistralSmall2509,
+ bedrock.ModelMistralLarge2402V1,
+
+ // Moonshot models
+ bedrock.ModelMoonshotKimiK25,
+ bedrock.ModelMoonshotKimiK2Thinking,
+
+ // Z.AI models
+ bedrock.ModelGLM47,
+ bedrock.ModelGLM47Flash,
}
for _, model := range models {
@@ -283,13 +312,15 @@ func TestAmazonStreamingOutputConverseAPI(t *testing.T) { //nolint:funlen
bedrock.ModelAmazonNovaMicroV1,
// Anthropic models
+ bedrock.ModelAnthropicClaudeOpus46,
+ bedrock.ModelAnthropicClaudeSonnet46,
bedrock.ModelAnthropicClaudeOpus45,
bedrock.ModelAnthropicClaudeHaiku45,
bedrock.ModelAnthropicClaudeSonnet45,
bedrock.ModelAnthropicClaudeOpus41,
- bedrock.ModelAnthropicClaudeOpus4,
+ // bedrock.ModelAnthropicClaudeOpus4, // Model is deprecated
bedrock.ModelAnthropicClaudeSonnet4,
- bedrock.ModelAnthropicClaude37Sonnet,
+ // bedrock.ModelAnthropicClaude37Sonnet, // Model is deprecated
bedrock.ModelAnthropicClaude35Haiku,
// Cohere models (only Command-R supports streaming and Converse API)
@@ -298,18 +329,43 @@ func TestAmazonStreamingOutputConverseAPI(t *testing.T) { //nolint:funlen
// Meta models
// bedrock.ModelMetaLlama4MaverickInstructV1, // Unavailable for MENA users
- // bedrock.ModelMetaLlama4ScoutInstructV1, // Unavailable for MENA users
+ // bedrock.ModelMetaLlama4ScoutInstructV1, // Unavailable for MENA users
bedrock.ModelMetaLlama3370bInstructV1,
- // bedrock.ModelMetaLlama3211bInstructV1, // Unavailable for MENA users
- // bedrock.ModelMetaLlama3211bInstructV1, // Unavailable for MENA users
- // bedrock.ModelMetaLlama3290bInstructV1, // Unavailable for MENA users
+ // bedrock.ModelMetaLlama3211bInstructV1, // Unavailable for MENA users
+ // bedrock.ModelMetaLlama3211bInstructV1, // Unavailable for MENA users
+ // bedrock.ModelMetaLlama3290bInstructV1, // Unavailable for MENA users
bedrock.ModelMetaLlama3170bInstructV1,
- // bedrock.ModelMetaLlama318bInstructV1, // Unavailable for MENA users
+ // bedrock.ModelMetaLlama318bInstructV1, // Unavailable for MENA users
bedrock.ModelMetaLlama370bInstructV1,
bedrock.ModelMetaLlama38bInstructV1,
// DeepSeek models
bedrock.ModelDeepSeekR1V1,
+ bedrock.ModelDeepSeekV32,
+
+ // OpenAI models
+ bedrock.ModelOpenAIGptOss120BV1,
+ bedrock.ModelOpenAIGptOss20BV1,
+
+ // Qwen models
+ bedrock.ModelQwen3Next80BA3B,
+ bedrock.ModelQwen3VL235BA22B,
+ bedrock.ModelQwen332BV1,
+ bedrock.ModelQwen3Coder30BA3BV1,
+ bedrock.ModelQwen3CoderNext,
+
+ // Mistral models
+ bedrock.ModelMistralLarge3,
+ bedrock.ModelMistralMagistralSmall2509,
+ bedrock.ModelMistralLarge2402V1,
+
+ // Moonshot models
+ bedrock.ModelMoonshotKimiK25,
+ bedrock.ModelMoonshotKimiK2Thinking,
+
+ // Z.AI models
+ bedrock.ModelGLM47,
+ bedrock.ModelGLM47Flash,
}
for _, model := range models {
@@ -569,7 +625,7 @@ func TestAmazonNova(t *testing.T) {
}
}
-func TestAnthropicNovaImage(t *testing.T) {
+func TestAmazonNovaImage(t *testing.T) {
httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID")
rr := httprr.OpenForTest(t, http.DefaultTransport)
@@ -672,13 +728,15 @@ func TestAmazonToolCallingConverseAPI(t *testing.T) {
bedrock.ModelAmazonNovaMicroV1,
// Anthropic models
+ bedrock.ModelAnthropicClaudeOpus46,
+ bedrock.ModelAnthropicClaudeSonnet46,
bedrock.ModelAnthropicClaudeOpus45,
bedrock.ModelAnthropicClaudeHaiku45,
bedrock.ModelAnthropicClaudeSonnet45,
// bedrock.ModelAnthropicClaudeOpus41, // Has very hard rate limits
- bedrock.ModelAnthropicClaudeOpus4,
+ // bedrock.ModelAnthropicClaudeOpus4, // Model is deprecated
bedrock.ModelAnthropicClaudeSonnet4,
- bedrock.ModelAnthropicClaude37Sonnet,
+ // bedrock.ModelAnthropicClaude37Sonnet, // Model is deprecated
bedrock.ModelAnthropicClaude35Haiku,
// Cohere models (only Command-R supports streaming and Converse API)
@@ -699,6 +757,31 @@ func TestAmazonToolCallingConverseAPI(t *testing.T) {
// DeepSeek models
// bedrock.ModelDeepSeekR1V1, // Not supported for tool calling
+ bedrock.ModelDeepSeekV32,
+
+ // OpenAI models
+ bedrock.ModelOpenAIGptOss120BV1,
+ bedrock.ModelOpenAIGptOss20BV1,
+
+ // Qwen models
+ bedrock.ModelQwen3Next80BA3B,
+ bedrock.ModelQwen3VL235BA22B,
+ bedrock.ModelQwen332BV1,
+ bedrock.ModelQwen3Coder30BA3BV1,
+ bedrock.ModelQwen3CoderNext,
+
+ // Mistral models
+ bedrock.ModelMistralLarge3,
+ // bedrock.ModelMistralMagistralSmall2509, // Not supported for tool calling
+ bedrock.ModelMistralLarge2402V1,
+
+ // Moonshot models
+ bedrock.ModelMoonshotKimiK25,
+ // bedrock.ModelMoonshotKimiK2Thinking, // Not stable for tool calling
+
+ // Z.AI models
+ // bedrock.ModelGLM47, // Tool calling not supported (backend requires string input instead of JSON)
+ // bedrock.ModelGLM47Flash, // Tool calling not supported (backend requires string input instead of JSON)
}
for _, model := range toolCallModels {
@@ -790,13 +873,15 @@ func TestAmazonToolCallingStreamingConverseAPI(t *testing.T) {
bedrock.ModelAmazonNovaMicroV1,
// Anthropic models
+ bedrock.ModelAnthropicClaudeOpus46,
+ bedrock.ModelAnthropicClaudeSonnet46,
bedrock.ModelAnthropicClaudeOpus45,
bedrock.ModelAnthropicClaudeHaiku45,
bedrock.ModelAnthropicClaudeSonnet45,
// bedrock.ModelAnthropicClaudeOpus41, // Has very hard rate limits
- bedrock.ModelAnthropicClaudeOpus4,
+ // bedrock.ModelAnthropicClaudeOpus4, // Model is deprecated
bedrock.ModelAnthropicClaudeSonnet4,
- bedrock.ModelAnthropicClaude37Sonnet,
+ // bedrock.ModelAnthropicClaude37Sonnet, // Model is deprecated
bedrock.ModelAnthropicClaude35Haiku,
// Cohere models (only Command-R supports streaming and Converse API)
@@ -817,6 +902,31 @@ func TestAmazonToolCallingStreamingConverseAPI(t *testing.T) {
// DeepSeek models
// bedrock.ModelDeepSeekR1V1, // Not supported for tool calling
+ bedrock.ModelDeepSeekV32,
+
+ // OpenAI models
+ bedrock.ModelOpenAIGptOss120BV1,
+ bedrock.ModelOpenAIGptOss20BV1,
+
+ // Qwen models
+ bedrock.ModelQwen3Next80BA3B,
+ // bedrock.ModelQwen3VL235BA22B, // Not stable for tool calling
+ bedrock.ModelQwen332BV1,
+ bedrock.ModelQwen3Coder30BA3BV1,
+ bedrock.ModelQwen3CoderNext,
+
+ // Mistral models
+ bedrock.ModelMistralLarge3,
+ // bedrock.ModelMistralMagistralSmall2509, // Not supported for tool calling
+ // bedrock.ModelMistralLarge2402V1, // Not supported for tool calling in streaming
+
+ // Moonshot models
+ bedrock.ModelMoonshotKimiK25,
+ // bedrock.ModelMoonshotKimiK2Thinking, // Not stable for tool calling
+
+ // Z.AI models
+ // bedrock.ModelGLM47, // Tool calling not supported (backend requires string input instead of JSON)
+ // bedrock.ModelGLM47Flash, // Tool calling not supported (backend requires string input instead of JSON)
}
for _, model := range streamingToolCallModels {
@@ -943,12 +1053,18 @@ func TestAmazonReasoningConverseAPI(t *testing.T) {
}
reasoningModels := []string{
+ bedrock.ModelAnthropicClaudeOpus46,
+ bedrock.ModelAnthropicClaudeSonnet46,
bedrock.ModelAnthropicClaudeOpus45,
+ bedrock.ModelAnthropicClaudeHaiku45,
bedrock.ModelAnthropicClaudeSonnet45,
- bedrock.ModelAnthropicClaudeOpus41,
- bedrock.ModelAnthropicClaudeOpus4,
+ // bedrock.ModelAnthropicClaudeOpus4, // Model is deprecated
bedrock.ModelAnthropicClaudeSonnet4,
- bedrock.ModelAnthropicClaude37Sonnet,
+ // bedrock.ModelAnthropicClaude37Sonnet, // Model is deprecated
+ bedrock.ModelDeepSeekR1V1,
+ bedrock.ModelOpenAIGptOss120BV1,
+ bedrock.ModelOpenAIGptOss20BV1,
+ bedrock.ModelMoonshotKimiK2Thinking,
}
for _, model := range reasoningModels {
@@ -1024,12 +1140,18 @@ func TestAmazonReasoningStreamingConverseAPI(t *testing.T) {
}
streamingReasoningModels := []string{
+ bedrock.ModelAnthropicClaudeOpus46,
+ bedrock.ModelAnthropicClaudeSonnet46,
bedrock.ModelAnthropicClaudeOpus45,
+ bedrock.ModelAnthropicClaudeHaiku45,
bedrock.ModelAnthropicClaudeSonnet45,
- bedrock.ModelAnthropicClaudeOpus41,
- bedrock.ModelAnthropicClaudeOpus4,
+ // bedrock.ModelAnthropicClaudeOpus4, // Model is deprecated
bedrock.ModelAnthropicClaudeSonnet4,
- bedrock.ModelAnthropicClaude37Sonnet,
+ // bedrock.ModelAnthropicClaude37Sonnet, // Model is deprecated
+ bedrock.ModelDeepSeekR1V1,
+ bedrock.ModelOpenAIGptOss120BV1,
+ bedrock.ModelOpenAIGptOss20BV1,
+ bedrock.ModelMoonshotKimiK2Thinking,
}
for _, model := range streamingReasoningModels {
@@ -1374,3 +1496,1395 @@ func testToolCallingWorkflow(
t.Logf("Tool calling workflow completed successfully for model: %s", model)
return nil
}
+
+// TestAmazonTextResponseWithThinkingConverseAPI tests text response with thinking using Converse API
+func TestAmazonTextResponseWithThinkingConverseAPI(t *testing.T) {
+ ctx := t.Context()
+
+ httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID")
+
+ rr := httprr.OpenForTest(t, http.DefaultTransport)
+ defer rr.Close()
+
+ if !rr.Recording() {
+ t.Parallel()
+ }
+
+ client, err := setUpTestWithTransport(rr)
+ if err != nil {
+ t.Fatal(err)
+ }
+ llm, err := bedrock.New(bedrock.WithClient(client), bedrock.WithConverseAPI())
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ messages := []llms.MessageContent{
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{
+ llms.TextPart("Solve: If x + 5 = 12, what is x?"),
+ },
+ },
+ }
+
+ // Request with thinking
+ resp, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithReasoning(llms.ReasoningMedium, 2048),
+ llms.WithMaxTokens(4096),
+ llms.WithTemperature(1.0),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ choice := resp.Choices[0]
+ if choice.Reasoning == nil {
+ t.Fatal("Expected reasoning in response")
+ }
+ if choice.Reasoning.Content == "" {
+ t.Error("Expected non-empty reasoning content")
+ }
+ if len(choice.Reasoning.Signature) == 0 {
+ t.Error("Expected signature in reasoning")
+ }
+ if !strings.Contains(choice.Content, "7") {
+ t.Errorf("Expected answer '7' in content, got: %s", choice.Content)
+ }
+
+ // ROUNDTRIP: Continue conversation with preserved signature
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{
+ llms.TextPartWithReasoning(choice.Content, choice.Reasoning),
+ },
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("Now solve x + 10 = 25")},
+ },
+ )
+
+ resp2, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithReasoning(llms.ReasoningMedium, 2048),
+ llms.WithMaxTokens(4096),
+ llms.WithTemperature(1.0),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !strings.Contains(resp2.Choices[0].Content, "15") {
+ t.Errorf("Expected answer '15' in roundtrip response, got: %s", resp2.Choices[0].Content)
+ }
+}
+
+// TestAmazonTextResponseWithThinkingLegacyAPI tests text response with thinking using Legacy API
+func TestAmazonTextResponseWithThinkingLegacyAPI(t *testing.T) {
+ ctx := t.Context()
+
+ httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID")
+
+ rr := httprr.OpenForTest(t, http.DefaultTransport)
+ defer rr.Close()
+
+ if !rr.Recording() {
+ t.Parallel()
+ }
+
+ client, err := setUpTestWithTransport(rr)
+ if err != nil {
+ t.Fatal(err)
+ }
+ llm, err := bedrock.New(bedrock.WithClient(client)) // Use Legacy API
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ messages := []llms.MessageContent{
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{
+ llms.TextPart("Solve: If x + 5 = 12, what is x?"),
+ },
+ },
+ }
+
+ // Request with thinking
+ resp, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithReasoning(llms.ReasoningMedium, 2048),
+ llms.WithMaxTokens(4096),
+ llms.WithTemperature(1.0),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ choice := resp.Choices[0]
+ if choice.Reasoning == nil {
+ t.Fatal("Expected reasoning in response")
+ }
+ if choice.Reasoning.Content == "" {
+ t.Error("Expected non-empty reasoning content")
+ }
+ if len(choice.Reasoning.Signature) == 0 {
+ t.Error("Expected signature in reasoning")
+ }
+ if !strings.Contains(choice.Content, "7") {
+ t.Errorf("Expected answer '7' in content, got: %s", choice.Content)
+ }
+
+ // ROUNDTRIP: Continue conversation with preserved signature
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{
+ llms.TextPartWithReasoning(choice.Content, choice.Reasoning),
+ },
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("Now solve x + 10 = 25")},
+ },
+ )
+
+ resp2, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithReasoning(llms.ReasoningMedium, 2048),
+ llms.WithMaxTokens(4096),
+ llms.WithTemperature(1.0),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !strings.Contains(resp2.Choices[0].Content, "15") {
+ t.Errorf("Expected answer '15' in roundtrip response, got: %s", resp2.Choices[0].Content)
+ }
+}
+
+// TestAmazonSingleToolCallWithThinkingConverseAPI tests single tool call with thinking
+func TestAmazonSingleToolCallWithThinkingConverseAPI(t *testing.T) {
+ ctx := t.Context()
+
+ httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID")
+
+ rr := httprr.OpenForTest(t, http.DefaultTransport)
+ defer rr.Close()
+
+ if !rr.Recording() {
+ t.Parallel()
+ }
+
+ client, err := setUpTestWithTransport(rr)
+ if err != nil {
+ t.Fatal(err)
+ }
+ llm, err := bedrock.New(bedrock.WithClient(client), bedrock.WithConverseAPI())
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ tools := []llms.Tool{{
+ Type: "function",
+ Function: &llms.FunctionDefinition{
+ Name: "get_weather",
+ Description: "Get weather for a location",
+ Parameters: map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "location": map[string]any{"type": "string"},
+ },
+ "required": []string{"location"},
+ },
+ },
+ }}
+
+ messages := []llms.MessageContent{
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("What's the weather in Boston?")},
+ },
+ }
+
+ resp, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithReasoning(llms.ReasoningMedium, 2048),
+ llms.WithMaxTokens(4096),
+ llms.WithTemperature(1.0),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if len(resp.Choices[0].ToolCalls) == 0 {
+ t.Fatal("Expected tool call in response")
+ }
+
+ choice := resp.Choices[0]
+ if choice.Reasoning == nil {
+ t.Error("Expected reasoning in response")
+ }
+ if choice.Reasoning != nil && len(choice.Reasoning.Signature) == 0 {
+ t.Error("Expected signature in reasoning")
+ }
+
+ // ROUNDTRIP: Send response back preserving reasoning
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{
+ llms.TextPartWithReasoning(choice.Content, choice.Reasoning),
+ resp.Choices[0].ToolCalls[0],
+ },
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeTool,
+ Parts: []llms.ContentPart{
+ llms.ToolCallResponse{
+ ToolCallID: resp.Choices[0].ToolCalls[0].ID,
+ Name: resp.Choices[0].ToolCalls[0].FunctionCall.Name,
+ Content: `{"temperature": 72, "condition": "sunny"}`,
+ },
+ },
+ },
+ )
+
+ resp2, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithReasoning(llms.ReasoningMedium, 2048),
+ llms.WithMaxTokens(4096),
+ llms.WithTemperature(1.0),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !strings.Contains(resp2.Choices[0].Content, "72") {
+ t.Logf("Expected '72' in final response, got: %s", resp2.Choices[0].Content)
+ }
+}
+
+// TestAmazonSequentialToolCallsWithThinkingConverseAPI tests sequential tool calls with thinking
+func TestAmazonSequentialToolCallsWithThinkingConverseAPI(t *testing.T) {
+ ctx := t.Context()
+
+ httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID")
+
+ rr := httprr.OpenForTest(t, http.DefaultTransport)
+ defer rr.Close()
+
+ if !rr.Recording() {
+ t.Parallel()
+ }
+
+ client, err := setUpTestWithTransport(rr)
+ if err != nil {
+ t.Fatal(err)
+ }
+ llm, err := bedrock.New(bedrock.WithClient(client), bedrock.WithConverseAPI())
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ tools := []llms.Tool{
+ {
+ Type: "function",
+ Function: &llms.FunctionDefinition{
+ Name: "calculate",
+ Description: "Perform a calculation",
+ Parameters: map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "expression": map[string]any{"type": "string"},
+ },
+ "required": []string{"expression"},
+ },
+ },
+ },
+ }
+
+ messages := []llms.MessageContent{
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{
+ llms.TextPart("Calculate (5 + 3) and then multiply by 2"),
+ },
+ },
+ }
+
+ // First call
+ resp1, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithReasoning(llms.ReasoningMedium, 2048),
+ llms.WithMaxTokens(4096),
+ llms.WithTemperature(1.0),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(resp1.Choices[0].ToolCalls) == 0 {
+ t.Fatal("Expected tool call in first response")
+ }
+ if resp1.Choices[0].Reasoning == nil {
+ t.Fatal("Expected reasoning in first response")
+ }
+
+ sig1 := resp1.Choices[0].Reasoning.Signature
+
+ // Execute first tool and continue
+ choice1 := resp1.Choices[0]
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{
+ llms.TextPartWithReasoning(choice1.Content, choice1.Reasoning),
+ choice1.ToolCalls[0],
+ },
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeTool,
+ Parts: []llms.ContentPart{
+ llms.ToolCallResponse{
+ ToolCallID: resp1.Choices[0].ToolCalls[0].ID,
+ Name: resp1.Choices[0].ToolCalls[0].FunctionCall.Name,
+ Content: "8",
+ },
+ },
+ },
+ )
+
+ // Second call
+ resp2, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithReasoning(llms.ReasoningMedium, 2048),
+ llms.WithMaxTokens(4096),
+ llms.WithTemperature(1.0),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if resp2.Choices[0].Reasoning != nil {
+ sig2 := resp2.Choices[0].Reasoning.Signature
+
+ // Signatures should differ (each step has unique context)
+ if len(sig1) > 0 && len(sig2) > 0 && string(sig1) == string(sig2) {
+ t.Error("Signatures should differ between turns")
+ }
+ }
+}
+
+// TestAmazonTextResponseWithThinkingStreamingConverseAPI tests streaming with thinking
+func TestAmazonTextResponseWithThinkingStreamingConverseAPI(t *testing.T) {
+ ctx := t.Context()
+
+ httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID")
+
+ rr := httprr.OpenForTest(t, http.DefaultTransport)
+ defer rr.Close()
+
+ if !rr.Recording() {
+ t.Parallel()
+ }
+
+ client, err := setUpTestWithTransport(rr)
+ if err != nil {
+ t.Fatal(err)
+ }
+ llm, err := bedrock.New(bedrock.WithClient(client), bedrock.WithConverseAPI())
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ messages := []llms.MessageContent{
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{
+ llms.TextPart("What is 5 + 3? Think step by step."),
+ },
+ },
+ }
+
+ var streamedReasoning []string
+ var streamedText []string
+
+ streamFunc := llms.WithStreamingFunc(func(ctx context.Context, chunk streaming.Chunk) error {
+ switch chunk.Type {
+ case streaming.ChunkTypeReasoning:
+ if chunk.Reasoning != nil {
+ streamedReasoning = append(streamedReasoning, chunk.Reasoning.Content)
+ }
+ case streaming.ChunkTypeText:
+ streamedText = append(streamedText, chunk.Content)
+ default:
+ }
+ return nil
+ })
+
+ resp, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithReasoning(llms.ReasoningMedium, 2048),
+ streamFunc,
+ llms.WithMaxTokens(4096),
+ llms.WithTemperature(1.0),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Verify accumulated content matches final response
+ if strings.Join(streamedText, "") != resp.Choices[0].Content {
+ t.Errorf("Streamed text doesn't match final response")
+ }
+ if len(streamedReasoning) > 0 {
+ accumulatedReasoning := strings.Join(streamedReasoning, "")
+ if resp.Choices[0].Reasoning != nil && accumulatedReasoning != resp.Choices[0].Reasoning.Content {
+ t.Errorf("Streamed reasoning doesn't match final response")
+ }
+ }
+ if resp.Choices[0].Reasoning != nil && len(resp.Choices[0].Reasoning.Signature) == 0 {
+ t.Error("Expected signature in final reasoning")
+ }
+}
+
+// TestAmazonMultiTurnCachingWithToolsLegacyAPI tests prompt caching across multi-turn conversation with tools.
+// This validates that caching works correctly for AI agent workflows using Legacy API.
+//
+// Expected behavior:
+// Turn 1: CacheCreation > 0 (conversation history cached)
+// Turn 2: CacheRead > 0 (previous turn read from cache), new content added to cache
+// Turn 3+: Cache continues to be used and extended
+func TestAmazonMultiTurnCachingWithToolsLegacyAPI(t *testing.T) {
+ ctx := t.Context()
+
+ httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID")
+
+ rr := httprr.OpenForTest(t, http.DefaultTransport)
+ defer rr.Close()
+
+ if !rr.Recording() {
+ t.Parallel()
+ }
+
+ client, err := setUpTestWithTransport(rr)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // Use Legacy API for cache_control support
+ llm, err := bedrock.New(bedrock.WithClient(client))
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Define tools for AI agent
+ tools := []llms.Tool{
+ {
+ Type: "function",
+ Function: &llms.FunctionDefinition{
+ Name: "get_weather",
+ Description: "BedrockCacheTest-v1: " + strings.Repeat("Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ", 30),
+ Parameters: map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "location": map[string]any{
+ "type": "string",
+ "description": "City and state, e.g. San Francisco, CA",
+ },
+ },
+ "required": []string{"location"},
+ },
+ },
+ },
+ {
+ Type: "function",
+ Function: &llms.FunctionDefinition{
+ Name: "book_flight",
+ Description: "BedrockCacheTest-v1: " + strings.Repeat("Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. ", 30),
+ Parameters: map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "destination": map[string]any{"type": "string", "description": "Destination city"},
+ "date": map[string]any{"type": "string", "description": "Departure date"},
+ },
+ "required": []string{"destination", "date"},
+ },
+ },
+ },
+ }
+
+ // Add system prompt to ensure sufficient tokens for caching
+ systemPrompt := "BedrockCacheTest-v1: " + strings.Repeat("You are a helpful assistant with access to weather and flight booking capabilities. ", 15)
+
+ // Turn 1: Initial request with system prompt
+ messages := []llms.MessageContent{
+ {
+ Role: llms.ChatMessageTypeSystem,
+ Parts: []llms.ContentPart{llms.TextPart(systemPrompt)},
+ },
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("What's the weather in Boston?")},
+ },
+ }
+
+ resp1, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if len(resp1.Choices[0].ToolCalls) == 0 {
+ t.Fatal("Expected tool call in first response")
+ }
+
+ // Turn 2: Add tool result - mark with cache control for conversation history caching
+ choice1 := resp1.Choices[0]
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{choice1.ToolCalls[0]},
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeTool,
+ Parts: []llms.ContentPart{
+ llms.ToolCallResponse{
+ ToolCallID: choice1.ToolCalls[0].ID,
+ Name: choice1.ToolCalls[0].FunctionCall.Name,
+ Content: `{"temperature": 72, "condition": "sunny"}`,
+ },
+ },
+ },
+ )
+
+ resp2, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ t.Logf("Turn 2 Response: %s", resp2.Choices[0].Content)
+ if !strings.Contains(resp2.Choices[0].Content, "72") && !strings.Contains(resp2.Choices[0].Content, "sunny") {
+ t.Logf("Turn 2 might not contain weather info: %s", resp2.Choices[0].Content)
+ }
+
+ // Turn 3: Continue conversation with cached previous context
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{
+ bedrock.WithCacheControl(
+ llms.TextPart(resp2.Choices[0].Content),
+ bedrock.EphemeralCache(),
+ ),
+ },
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("Now book a flight to Boston for tomorrow")},
+ },
+ )
+
+ resp3, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ t.Logf("Turn 3 Response: %s", resp3.Choices[0].Content)
+
+ // Helper function to extract cache metrics
+ getCacheMetric := func(resp *llms.ContentResponse, key string) int {
+ if resp.Choices[0].GenerationInfo != nil {
+ if val, ok := resp.Choices[0].GenerationInfo[key]; ok {
+ switch v := val.(type) {
+ case int:
+ return v
+ case int32:
+ return int(v)
+ case int64:
+ return int(v)
+ }
+ }
+ }
+ return 0
+ }
+
+ // Log cache metrics for all turns
+ t.Logf("Turn 1 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp1, "CacheCreationInputTokens"),
+ getCacheMetric(resp1, "CacheReadInputTokens"))
+ t.Logf("Turn 2 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp2, "CacheCreationInputTokens"),
+ getCacheMetric(resp2, "CacheReadInputTokens"))
+ t.Logf("Turn 3 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp3, "CacheCreationInputTokens"),
+ getCacheMetric(resp3, "CacheReadInputTokens"))
+
+ // Verify that cache was created in Turn 3 (due to cache_control on assistant message)
+ cacheCreation3 := getCacheMetric(resp3, "CacheCreationInputTokens")
+ if cacheCreation3 > 0 {
+ t.Logf("✓ Cache successfully created in Turn 3: %d tokens", cacheCreation3)
+ } else {
+ t.Logf("Cache creation: %d (may be 0 if context < 1024 tokens)", cacheCreation3)
+ }
+
+ // Turn 4: Continue conversation - cache should be read from previous turn
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{
+ bedrock.WithCacheControl(
+ llms.TextPart(resp3.Choices[0].Content),
+ bedrock.EphemeralCache(),
+ ),
+ },
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("I'm flying from New York on March 4th")},
+ },
+ )
+
+ resp4, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ t.Logf("Turn 4 Response: %s", resp4.Choices[0].Content)
+
+ cacheRead4 := getCacheMetric(resp4, "CacheReadInputTokens")
+ cacheCreation4 := getCacheMetric(resp4, "CacheCreationInputTokens")
+ t.Logf("Turn 4 - CacheCreation: %d, CacheRead: %d", cacheCreation4, cacheRead4)
+
+ // Verify cache is being utilized
+ if cacheRead4 > 0 {
+ t.Logf("✓ Cache successfully read in Turn 4: %d tokens", cacheRead4)
+ t.Logf("Cache savings: previous context reused from cache")
+ } else if cacheCreation4 > 0 {
+ t.Logf("✓ Additional cache created in Turn 4: %d tokens", cacheCreation4)
+ }
+}
+
+// TestAmazonMultiTurnCachingWithToolsConverseAPI tests prompt caching with Converse API.
+// This validates that caching works correctly for AI agent workflows using Converse API.
+//
+// Expected behavior:
+// Turn 3: CacheCreation > 0 (conversation history with cachePoint)
+// Turn 4: CacheRead > 0 (previous context read from cache)
+func TestAmazonMultiTurnCachingWithToolsConverseAPI(t *testing.T) {
+ ctx := t.Context()
+
+ httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID")
+
+ rr := httprr.OpenForTest(t, http.DefaultTransport)
+ defer rr.Close()
+
+ if !rr.Recording() {
+ t.Parallel()
+ }
+
+ client, err := setUpTestWithTransport(rr)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // Use Converse API with cachePoint support
+ llm, err := bedrock.New(bedrock.WithClient(client), bedrock.WithConverseAPI())
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Define tools with long descriptions to exceed 1024 token threshold
+ tools := []llms.Tool{
+ {
+ Type: "function",
+ Function: &llms.FunctionDefinition{
+ Name: "get_weather",
+ Description: "BedrockConverseCache-v1: " + strings.Repeat("Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ", 30),
+ Parameters: map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "location": map[string]any{
+ "type": "string",
+ "description": "City and state, e.g. San Francisco, CA",
+ },
+ },
+ "required": []string{"location"},
+ },
+ },
+ },
+ {
+ Type: "function",
+ Function: &llms.FunctionDefinition{
+ Name: "book_flight",
+ Description: "BedrockConverseCache-v1: " + strings.Repeat("Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. ", 30),
+ Parameters: map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "destination": map[string]any{"type": "string", "description": "Destination city"},
+ "date": map[string]any{"type": "string", "description": "Departure date"},
+ },
+ "required": []string{"destination", "date"},
+ },
+ },
+ },
+ }
+
+ // Add system prompt to ensure sufficient tokens
+ systemPrompt := "BedrockConverseCache-v1: " + strings.Repeat("You are a helpful assistant with access to weather and flight booking capabilities. ", 15)
+
+ // Turn 1: Initial request with system prompt
+ messages := []llms.MessageContent{
+ {
+ Role: llms.ChatMessageTypeSystem,
+ Parts: []llms.ContentPart{llms.TextPart(systemPrompt)},
+ },
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("What's the weather in Boston?")},
+ },
+ }
+
+ resp1, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if len(resp1.Choices[0].ToolCalls) == 0 {
+ t.Fatal("Expected tool call in first response")
+ }
+
+ // Turn 2: Add tool result
+ choice1 := resp1.Choices[0]
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{choice1.ToolCalls[0]},
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeTool,
+ Parts: []llms.ContentPart{
+ llms.ToolCallResponse{
+ ToolCallID: choice1.ToolCalls[0].ID,
+ Name: choice1.ToolCalls[0].FunctionCall.Name,
+ Content: `{"temperature": 72, "condition": "sunny"}`,
+ },
+ },
+ },
+ )
+
+ resp2, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ t.Logf("Turn 2 Response: %s", resp2.Choices[0].Content)
+
+ // Turn 3: Continue conversation with cachePoint (mark assistant response for caching)
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{
+ bedrock.WithCacheControl(
+ llms.TextPart(resp2.Choices[0].Content),
+ bedrock.EphemeralCache(),
+ ),
+ },
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("Now book a flight to Boston for tomorrow")},
+ },
+ )
+
+ resp3, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ t.Logf("Turn 3 Response: %s", resp3.Choices[0].Content)
+
+ // Turn 4: Continue conversation - cache should be read
+ choice3 := resp3.Choices[0]
+ var turn4Parts []llms.ContentPart
+ if len(choice3.ToolCalls) > 0 {
+ turn4Parts = append(turn4Parts, choice3.ToolCalls[0])
+ } else {
+ turn4Parts = append(turn4Parts, bedrock.WithCacheControl(
+ llms.TextPart(choice3.Content),
+ bedrock.EphemeralCache(),
+ ))
+ }
+
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: turn4Parts,
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("I'm flying from New York on March 4th")},
+ },
+ )
+
+ resp4, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ t.Logf("Turn 4 Response: %s", resp4.Choices[0].Content)
+
+ // Helper function to extract cache metrics
+ getCacheMetric := func(resp *llms.ContentResponse, key string) int {
+ if resp.Choices[0].GenerationInfo != nil {
+ if val, ok := resp.Choices[0].GenerationInfo[key]; ok {
+ switch v := val.(type) {
+ case int:
+ return v
+ case int32:
+ return int(v)
+ case int64:
+ return int(v)
+ }
+ }
+ }
+ return 0
+ }
+
+ // Log cache metrics for all turns
+ t.Logf("Turn 1 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp1, "CacheCreationInputTokens"),
+ getCacheMetric(resp1, "CacheReadInputTokens"))
+ t.Logf("Turn 2 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp2, "CacheCreationInputTokens"),
+ getCacheMetric(resp2, "CacheReadInputTokens"))
+ t.Logf("Turn 3 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp3, "CacheCreationInputTokens"),
+ getCacheMetric(resp3, "CacheReadInputTokens"))
+ t.Logf("Turn 4 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp4, "CacheCreationInputTokens"),
+ getCacheMetric(resp4, "CacheReadInputTokens"))
+
+ // Verify caching behavior
+ cacheRead4 := getCacheMetric(resp4, "CacheReadInputTokens")
+ cacheCreation3 := getCacheMetric(resp3, "CacheCreationInputTokens")
+
+ if cacheRead4 > 0 {
+ t.Logf("✓ Cache successfully read in Turn 4: %d tokens", cacheRead4)
+ }
+ if cacheCreation3 > 0 {
+ t.Logf("✓ Cache successfully created in Turn 3: %d tokens", cacheCreation3)
+ }
+}
+
+// TestAmazonAutomaticCachingLegacyAPI tests automatic prompt caching without manual cache control.
+// This validates that WithAutomaticCaching() works correctly with Legacy API.
+//
+// Expected behavior:
+// - Cache points are automatically added to conversation history
+// - No manual bedrock.WithCacheControl() wrapper needed
+// - Cache metrics show cache utilization
+func TestAmazonAutomaticCachingLegacyAPI(t *testing.T) {
+ ctx := t.Context()
+
+ httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID")
+
+ rr := httprr.OpenForTest(t, http.DefaultTransport)
+ defer rr.Close()
+
+ if !rr.Recording() {
+ t.Parallel()
+ }
+
+ client, err := setUpTestWithTransport(rr)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // Use Legacy API with automatic caching enabled
+ llm, err := bedrock.New(
+ bedrock.WithClient(client),
+ bedrock.WithAutomaticCaching(),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Define tools with long descriptions to exceed 1024 token threshold
+ tools := []llms.Tool{
+ {
+ Type: "function",
+ Function: &llms.FunctionDefinition{
+ Name: "get_weather",
+ Description: "BedrockAutoCacheTest-v1: " + strings.Repeat("Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ", 30),
+ Parameters: map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "location": map[string]any{
+ "type": "string",
+ "description": "City and state, e.g. San Francisco, CA",
+ },
+ },
+ "required": []string{"location"},
+ },
+ },
+ },
+ }
+
+ // Add system prompt to ensure sufficient tokens
+ systemPrompt := "BedrockAutoCacheTest-v1: " + strings.Repeat("You are a helpful assistant with access to weather capabilities. ", 15)
+
+ // Turn 1: Initial request with system prompt
+ messages := []llms.MessageContent{
+ {
+ Role: llms.ChatMessageTypeSystem,
+ Parts: []llms.ContentPart{llms.TextPart(systemPrompt)},
+ },
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("What's the weather in Boston?")},
+ },
+ }
+
+ resp1, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if len(resp1.Choices[0].ToolCalls) == 0 {
+ t.Fatal("Expected tool call in first response")
+ }
+
+ // Turn 2: Add tool result - NO manual cache control needed
+ choice1 := resp1.Choices[0]
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{choice1.ToolCalls[0]},
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeTool,
+ Parts: []llms.ContentPart{
+ llms.ToolCallResponse{
+ ToolCallID: choice1.ToolCalls[0].ID,
+ Name: choice1.ToolCalls[0].FunctionCall.Name,
+ Content: `{"temperature": 72, "condition": "sunny"}`,
+ },
+ },
+ },
+ )
+
+ resp2, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ t.Logf("Turn 2 Response: %s", resp2.Choices[0].Content)
+
+ // Turn 3: Continue conversation - automatic caching should apply
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{
+ llms.TextPart(resp2.Choices[0].Content),
+ },
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("What about New York?")},
+ },
+ )
+
+ resp3, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ t.Logf("Turn 3 Response: %+v", resp3.Choices[0])
+
+ // Helper function to extract cache metrics
+ getCacheMetric := func(resp *llms.ContentResponse, key string) int {
+ if resp.Choices[0].GenerationInfo != nil {
+ if val, ok := resp.Choices[0].GenerationInfo[key]; ok {
+ switch v := val.(type) {
+ case int:
+ return v
+ case int32:
+ return int(v)
+ case int64:
+ return int(v)
+ }
+ }
+ }
+ return 0
+ }
+
+ // Log cache metrics for all turns
+ t.Logf("Turn 1 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp1, "CacheCreationInputTokens"),
+ getCacheMetric(resp1, "CacheReadInputTokens"))
+ t.Logf("Turn 2 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp2, "CacheCreationInputTokens"),
+ getCacheMetric(resp2, "CacheReadInputTokens"))
+ t.Logf("Turn 3 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp3, "CacheCreationInputTokens"),
+ getCacheMetric(resp3, "CacheReadInputTokens"))
+
+ // Verify automatic caching is working
+ cacheCreation3 := getCacheMetric(resp3, "CacheCreationInputTokens")
+ cacheRead3 := getCacheMetric(resp3, "CacheReadInputTokens")
+
+ if cacheCreation3 > 0 {
+ t.Logf("✓ Automatic cache successfully created in Turn 3: %d tokens", cacheCreation3)
+ }
+ if cacheRead3 > 0 {
+ t.Logf("✓ Automatic cache successfully read in Turn 3: %d tokens", cacheRead3)
+ }
+}
+
+// TestAmazonAutomaticCachingConverseAPI tests automatic prompt caching with Converse API.
+// This validates that WithAutomaticCaching() works correctly with Converse API.
+func TestAmazonAutomaticCachingConverseAPI(t *testing.T) {
+ ctx := t.Context()
+
+ httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID")
+
+ rr := httprr.OpenForTest(t, http.DefaultTransport)
+ defer rr.Close()
+
+ if !rr.Recording() {
+ t.Parallel()
+ }
+
+ client, err := setUpTestWithTransport(rr)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // Use Converse API with automatic caching enabled
+ llm, err := bedrock.New(
+ bedrock.WithClient(client),
+ bedrock.WithConverseAPI(),
+ bedrock.WithAutomaticCaching(),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Define tools with long descriptions to exceed 1024 token threshold
+ tools := []llms.Tool{
+ {
+ Type: "function",
+ Function: &llms.FunctionDefinition{
+ Name: "get_weather",
+ Description: "BedrockConverseAutoCacheTest-v1: " + strings.Repeat("Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ", 30),
+ Parameters: map[string]any{
+ "type": "object",
+ "properties": map[string]any{
+ "location": map[string]any{
+ "type": "string",
+ "description": "City and state, e.g. San Francisco, CA",
+ },
+ },
+ "required": []string{"location"},
+ },
+ },
+ },
+ }
+
+ // Add system prompt to ensure sufficient tokens
+ systemPrompt := "BedrockConverseAutoCacheTest-v1: " + strings.Repeat("You are a helpful assistant with access to weather capabilities. ", 15)
+
+ // Turn 1: Initial request with system prompt
+ messages := []llms.MessageContent{
+ {
+ Role: llms.ChatMessageTypeSystem,
+ Parts: []llms.ContentPart{llms.TextPart(systemPrompt)},
+ },
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("What's the weather in Boston?")},
+ },
+ }
+
+ resp1, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if len(resp1.Choices[0].ToolCalls) == 0 {
+ t.Fatal("Expected tool call in first response")
+ }
+
+ // Turn 2: Add tool result - NO manual cache control needed
+ choice1 := resp1.Choices[0]
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{choice1.ToolCalls[0]},
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeTool,
+ Parts: []llms.ContentPart{
+ llms.ToolCallResponse{
+ ToolCallID: choice1.ToolCalls[0].ID,
+ Name: choice1.ToolCalls[0].FunctionCall.Name,
+ Content: `{"temperature": 72, "condition": "sunny"}`,
+ },
+ },
+ },
+ )
+
+ resp2, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ t.Logf("Turn 2 Response: %s", resp2.Choices[0].Content)
+
+ // Turn 3: Continue conversation - automatic caching should apply
+ messages = append(messages,
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{
+ llms.TextPart(resp2.Choices[0].Content),
+ },
+ },
+ llms.MessageContent{
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{llms.TextPart("What about New York?")},
+ },
+ )
+
+ resp3, err := llm.GenerateContent(ctx, messages,
+ llms.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+ llms.WithTools(tools),
+ llms.WithMaxTokens(512),
+ )
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ t.Logf("Turn 3 Response: %+v", resp3.Choices[0])
+
+ // Helper function to extract cache metrics
+ getCacheMetric := func(resp *llms.ContentResponse, key string) int {
+ if resp.Choices[0].GenerationInfo != nil {
+ if val, ok := resp.Choices[0].GenerationInfo[key]; ok {
+ switch v := val.(type) {
+ case int:
+ return v
+ case int32:
+ return int(v)
+ case int64:
+ return int(v)
+ }
+ }
+ }
+ return 0
+ }
+
+ // Log cache metrics for all turns
+ t.Logf("Turn 1 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp1, "CacheCreationInputTokens"),
+ getCacheMetric(resp1, "CacheReadInputTokens"))
+ t.Logf("Turn 2 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp2, "CacheCreationInputTokens"),
+ getCacheMetric(resp2, "CacheReadInputTokens"))
+ t.Logf("Turn 3 - CacheCreation: %d, CacheRead: %d",
+ getCacheMetric(resp3, "CacheCreationInputTokens"),
+ getCacheMetric(resp3, "CacheReadInputTokens"))
+
+ // Verify automatic caching is working
+ cacheCreation3 := getCacheMetric(resp3, "CacheCreationInputTokens")
+ cacheRead3 := getCacheMetric(resp3, "CacheReadInputTokens")
+
+ if cacheCreation3 > 0 {
+ t.Logf("✓ Automatic cache successfully created in Turn 3: %d tokens", cacheCreation3)
+ }
+ if cacheRead3 > 0 {
+ t.Logf("✓ Automatic cache successfully read in Turn 3: %d tokens", cacheRead3)
+ }
+}
+
+// TestCreateClientWithLongLeavingCredentials tests creating a client with long leaving credentials.
+func TestCreateClientWithLongLeavingCredentials(t *testing.T) {
+ ctx := t.Context()
+
+ httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_REGION")
+
+ rr := httprr.OpenForTest(t, http.DefaultTransport)
+ defer rr.Close()
+
+ if !rr.Recording() {
+ t.Parallel()
+ }
+
+ // Configure request scrubbing to remove dynamic AWS headers
+ rr.ScrubReq(func(req *http.Request) error {
+ req.Header.Del("Amz-Sdk-Invocation-Id")
+ req.Header.Del("Amz-Sdk-Request")
+ req.Header.Del("X-Amz-Date")
+ req.Header.Del("Authorization") // AWS Signature V4 is unique per request
+ return nil
+ })
+
+ httpClient := &http.Client{
+ Transport: rr,
+ }
+
+ region := os.Getenv("AWS_REGION")
+ accessKey := os.Getenv("AWS_ACCESS_KEY_ID")
+ secretKey := os.Getenv("AWS_SECRET_ACCESS_KEY")
+ sessionToken := os.Getenv("AWS_SESSION_TOKEN")
+
+ opts := []func(*config.LoadOptions) error{
+ config.WithHTTPClient(httpClient),
+ config.WithRegion(region),
+ config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(
+ accessKey,
+ secretKey,
+ sessionToken,
+ )),
+ }
+
+ cfg, err := config.LoadDefaultConfig(ctx, opts...)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ client := bedrockruntime.NewFromConfig(cfg)
+
+ llm, err := bedrock.New(bedrock.WithClient(client), bedrock.WithConverseAPI())
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ model := bedrock.ModelAnthropicClaudeSonnet45
+ resp, err := llm.Call(ctx, "Hello, how are you?", llms.WithModel(model), llms.WithMaxTokens(512))
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if resp == "" {
+ t.Fatal("Expected non-empty response")
+ }
+
+ t.Logf("Response: %s", resp)
+}
+
+// TestCreateClientWithBearerTokenCredentials tests creating a client with bearer token credentials.
+func TestCreateClientWithBearerTokenCredentials(t *testing.T) {
+ ctx := t.Context()
+
+ httprr.SkipIfNoCredentialsAndRecordingMissing(t, "AWS_BEDROCK_BEARER_TOKEN", "AWS_REGION")
+
+ rr := httprr.OpenForTest(t, http.DefaultTransport)
+ defer rr.Close()
+
+ if !rr.Recording() {
+ t.Parallel()
+ }
+
+ // Configure request scrubbing to remove dynamic AWS headers
+ rr.ScrubReq(func(req *http.Request) error {
+ req.Header.Del("Amz-Sdk-Invocation-Id")
+ req.Header.Del("Amz-Sdk-Request")
+ req.Header.Del("X-Amz-Date")
+ req.Header.Del("Authorization")
+ return nil
+ })
+
+ httpClient := &http.Client{
+ Transport: rr,
+ }
+
+ region := os.Getenv("AWS_REGION")
+ bearerToken := os.Getenv("AWS_BEDROCK_BEARER_TOKEN")
+
+ opts := []func(*config.LoadOptions) error{
+ config.WithHTTPClient(httpClient),
+ config.WithRegion(region),
+ config.WithBearerAuthTokenProvider(bearer.StaticTokenProvider{
+ Token: bearer.Token{
+ Value: bearerToken,
+ },
+ }),
+ }
+
+ cfg, err := config.LoadDefaultConfig(ctx, opts...)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ client := bedrockruntime.NewFromConfig(cfg)
+
+ llm, err := bedrock.New(bedrock.WithClient(client), bedrock.WithConverseAPI())
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ model := bedrock.ModelAnthropicClaudeSonnet45
+ resp, err := llm.Call(ctx, "Hello, how are you?", llms.WithModel(model), llms.WithMaxTokens(512))
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if resp == "" {
+ t.Fatal("Expected non-empty response")
+ }
+
+ t.Logf("Response: %s", resp)
+}
diff --git a/llms/bedrock/bedrockllm_unit_test.go b/llms/bedrock/bedrockllm_unit_test.go
index 19b45496..04f40102 100644
--- a/llms/bedrock/bedrockllm_unit_test.go
+++ b/llms/bedrock/bedrockllm_unit_test.go
@@ -177,6 +177,14 @@ func TestOptions(t *testing.T) {
t.Error("WithConverseAPI() did not enable Converse API")
}
})
+
+ t.Run("WithAutomaticCaching", func(t *testing.T) {
+ opts := &options{}
+ WithAutomaticCaching()(opts)
+ if !opts.enableAutoCaching {
+ t.Error("WithAutomaticCaching() did not enable automatic caching")
+ }
+ })
}
func TestModelConstants(t *testing.T) {
@@ -189,6 +197,8 @@ func TestModelConstants(t *testing.T) {
ModelAmazonNovaProV1,
ModelAmazonNovaLiteV1,
ModelAmazonNovaMicroV1,
+ ModelAnthropicClaudeOpus46,
+ ModelAnthropicClaudeSonnet46,
ModelAnthropicClaudeOpus45,
ModelAnthropicClaudeHaiku45,
ModelAnthropicClaudeSonnet45,
@@ -248,3 +258,260 @@ func (h *testCallbackHandler) HandleRetrieverStart(ctx context.Context, query st
func (h *testCallbackHandler) HandleRetrieverEnd(ctx context.Context, query string, documents []schema.Document) {
}
func (h *testCallbackHandler) HandleStreamingFunc(ctx context.Context, chunk streaming.Chunk) {}
+
+// TestSupportsCaching tests the supportsCaching method
+func TestSupportsCaching(t *testing.T) {
+ llm := &LLM{}
+
+ tests := []struct {
+ name string
+ modelID string
+ expected bool
+ }{
+ {
+ name: "Claude Opus 4.6 supports caching",
+ modelID: ModelAnthropicClaudeOpus46,
+ expected: true,
+ },
+ {
+ name: "Claude Sonnet 4.6 supports caching",
+ modelID: ModelAnthropicClaudeSonnet46,
+ expected: true,
+ },
+ {
+ name: "Claude Opus 4.5 supports caching",
+ modelID: ModelAnthropicClaudeOpus45,
+ expected: true,
+ },
+ {
+ name: "Claude Haiku 4.5 supports caching",
+ modelID: ModelAnthropicClaudeHaiku45,
+ expected: true,
+ },
+ {
+ name: "Claude Sonnet 4.5 supports caching",
+ modelID: ModelAnthropicClaudeSonnet45,
+ expected: true,
+ },
+ {
+ name: "Claude Opus 4.1 supports caching",
+ modelID: ModelAnthropicClaudeOpus41,
+ expected: true,
+ },
+ {
+ name: "Claude Opus 4 supports caching",
+ modelID: ModelAnthropicClaudeOpus4,
+ expected: true,
+ },
+ {
+ name: "Claude Sonnet 4 supports caching",
+ modelID: ModelAnthropicClaudeSonnet4,
+ expected: true,
+ },
+ {
+ name: "Claude 3.7 Sonnet does not support caching",
+ modelID: ModelAnthropicClaude37Sonnet,
+ expected: false,
+ },
+ {
+ name: "Claude 3.5 Haiku does not support caching",
+ modelID: ModelAnthropicClaude35Haiku,
+ expected: false,
+ },
+ {
+ name: "Amazon Nova does not support caching",
+ modelID: ModelAmazonNovaProV1,
+ expected: false,
+ },
+ {
+ name: "Meta Llama does not support caching",
+ modelID: ModelMetaLlama3370bInstructV1,
+ expected: false,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ result := llm.supportsCaching(tt.modelID)
+ if result != tt.expected {
+ t.Errorf("supportsCaching(%s) = %v, want %v", tt.modelID, result, tt.expected)
+ }
+ })
+ }
+}
+
+// TestApplyAutomaticCaching tests the applyAutomaticCaching function
+func TestApplyAutomaticCaching(t *testing.T) {
+ tests := []struct {
+ name string
+ messages []bedrockclient.Message
+ expectedCacheIdx int
+ expectNoCaching bool
+ }{
+ {
+ name: "cache applied to last assistant message",
+ messages: []bedrockclient.Message{
+ {Role: llms.ChatMessageTypeHuman, Type: "text", Content: "Hello"},
+ {Role: llms.ChatMessageTypeAI, Type: "text", Content: "Hi there"},
+ {Role: llms.ChatMessageTypeHuman, Type: "text", Content: "How are you?"},
+ },
+ expectedCacheIdx: 1,
+ },
+ {
+ name: "cache applied to tool result before human message",
+ messages: []bedrockclient.Message{
+ {Role: llms.ChatMessageTypeHuman, Type: "text", Content: "What's the weather?"},
+ {Role: llms.ChatMessageTypeAI, Type: "tool_use"},
+ {Role: llms.ChatMessageTypeTool, Type: "tool_result", Content: "72F"},
+ {Role: llms.ChatMessageTypeHuman, Type: "text", Content: "Thanks"},
+ },
+ expectedCacheIdx: 2,
+ },
+ {
+ name: "no caching for single human message",
+ messages: []bedrockclient.Message{
+ {Role: llms.ChatMessageTypeHuman, Type: "text", Content: "Hello"},
+ },
+ expectNoCaching: true,
+ },
+ {
+ name: "no caching when last message is system",
+ messages: []bedrockclient.Message{
+ {Role: llms.ChatMessageTypeSystem, Type: "text", Content: "You are helpful"},
+ },
+ expectNoCaching: true,
+ },
+ {
+ name: "cache applied to assistant message before final human",
+ messages: []bedrockclient.Message{
+ {Role: llms.ChatMessageTypeSystem, Type: "text", Content: "System"},
+ {Role: llms.ChatMessageTypeHuman, Type: "text", Content: "Hello"},
+ {Role: llms.ChatMessageTypeAI, Type: "text", Content: "Hi"},
+ {Role: llms.ChatMessageTypeHuman, Type: "text", Content: "Tell me more"},
+ },
+ expectedCacheIdx: 2,
+ },
+ {
+ name: "empty messages",
+ messages: []bedrockclient.Message{},
+ expectNoCaching: true,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ // Make a copy to avoid modifying test data
+ messages := make([]bedrockclient.Message, len(tt.messages))
+ copy(messages, tt.messages)
+
+ applyAutomaticCaching(messages)
+
+ if tt.expectNoCaching {
+ // Verify no cache control was added
+ for i, msg := range messages {
+ if msg.CacheControl != nil {
+ t.Errorf("Expected no cache control, but found at index %d", i)
+ }
+ }
+ } else {
+ // Verify cache control was added to expected message
+ if messages[tt.expectedCacheIdx].CacheControl == nil {
+ t.Errorf("Expected cache control at index %d, but not found", tt.expectedCacheIdx)
+ } else {
+ if messages[tt.expectedCacheIdx].CacheControl.Type != "ephemeral" {
+ t.Errorf("Expected cache type 'ephemeral', got '%s'", messages[tt.expectedCacheIdx].CacheControl.Type)
+ }
+ if messages[tt.expectedCacheIdx].CacheControl.TTL != "5m" {
+ t.Errorf("Expected TTL '5m', got '%s'", messages[tt.expectedCacheIdx].CacheControl.TTL)
+ }
+ }
+
+ // Verify no other messages have cache control
+ for i := range messages {
+ if i != tt.expectedCacheIdx && messages[i].CacheControl != nil {
+ t.Errorf("Unexpected cache control at index %d (expected only at %d)", i, tt.expectedCacheIdx)
+ }
+ }
+ }
+ })
+ }
+}
+
+// TestProcessMessagesWithCaching tests the processMessagesWithCaching function
+func TestProcessMessagesWithCaching(t *testing.T) {
+ tests := []struct {
+ name string
+ messages []llms.MessageContent
+ autoCaching bool
+ expectCache bool
+ cacheAtIndex int
+ }{
+ {
+ name: "automatic caching enabled",
+ messages: []llms.MessageContent{
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{
+ llms.TextContent{Text: "Hello"},
+ },
+ },
+ {
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{
+ llms.TextContent{Text: "Hi there"},
+ },
+ },
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{
+ llms.TextContent{Text: "How are you?"},
+ },
+ },
+ },
+ autoCaching: true,
+ expectCache: true,
+ cacheAtIndex: 1,
+ },
+ {
+ name: "automatic caching disabled",
+ messages: []llms.MessageContent{
+ {
+ Role: llms.ChatMessageTypeHuman,
+ Parts: []llms.ContentPart{
+ llms.TextContent{Text: "Hello"},
+ },
+ },
+ {
+ Role: llms.ChatMessageTypeAI,
+ Parts: []llms.ContentPart{
+ llms.TextContent{Text: "Hi there"},
+ },
+ },
+ },
+ autoCaching: false,
+ expectCache: false,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ result, err := processMessagesWithCaching(tt.messages, tt.autoCaching)
+ if err != nil {
+ t.Errorf("processMessagesWithCaching() error = %v", err)
+ return
+ }
+
+ if tt.expectCache {
+ if result[tt.cacheAtIndex].CacheControl == nil {
+ t.Errorf("Expected cache control at index %d, but not found", tt.cacheAtIndex)
+ }
+ } else {
+ for i, msg := range result {
+ if msg.CacheControl != nil {
+ t.Errorf("Unexpected cache control at index %d", i)
+ }
+ }
+ }
+ })
+ }
+}
diff --git a/llms/bedrock/doc.go b/llms/bedrock/doc.go
new file mode 100644
index 00000000..b4c532ca
--- /dev/null
+++ b/llms/bedrock/doc.go
@@ -0,0 +1,208 @@
+// Package bedrock provides AWS Bedrock integration for LangChainGo.
+//
+// # Overview
+//
+// This package implements LLM client for AWS Bedrock, supporting multiple model providers
+// including Anthropic Claude, Amazon Nova, Meta Llama, Cohere, AI21, and DeepSeek.
+//
+// # Architecture
+//
+// The package consists of three layers:
+//
+// 1. Public API Layer (bedrockllm.go): Exposes bedrock.LLM and bedrock.New() constructor
+// 2. Message Processing Layer: Converts llms.MessageContent to provider-specific formats
+// 3. Internal Client Layer (internal/bedrockclient): Handles AWS SDK interactions
+//
+// Two API modes are supported:
+//
+// - Legacy API: Model-specific implementations via InvokeModel/InvokeModelWithResponseStream
+// - Converse API: Unified implementation via Converse/ConverseStream (recommended)
+//
+// # Basic Usage
+//
+// Create a Bedrock client:
+//
+// import "github.com/vxcontrol/langchaingo/llms/bedrock"
+//
+// llm, err := bedrock.New(
+// bedrock.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+// bedrock.WithConverseAPI(),
+// )
+//
+// Generate content:
+//
+// messages := []llms.MessageContent{
+// llms.TextParts(llms.ChatMessageTypeHuman, "Hello!"),
+// }
+// resp, err := llm.GenerateContent(ctx, messages,
+// llms.WithMaxTokens(1024),
+// )
+//
+// # Automatic Prompt Caching
+//
+// For Claude 4.x models (Opus 4, Sonnet 4, Haiku 4), automatic caching is available:
+//
+// llm, err := bedrock.New(
+// bedrock.WithModel(bedrock.ModelAnthropicClaudeSonnet45),
+// bedrock.WithConverseAPI(),
+// bedrock.WithAutomaticCaching(), // Enable automatic caching
+// )
+//
+// When enabled, the client automatically:
+// - Detects Claude 4.x models by model ID patterns (anthropic.claude-opus-4, sonnet-4, haiku-4)
+// - Adds cache points to the last assistant or tool message before new user input
+// - Uses ephemeral 5-minute TTL by default
+// - Works transparently without modifying client code
+//
+// Benefits:
+// - 90% cost reduction on cached input tokens
+// - No manual cache control wrappers needed
+// - Automatic conversation history caching
+//
+// Manual caching (for fine-grained control):
+//
+// messages := []llms.MessageContent{
+// {
+// Role: llms.ChatMessageTypeAI,
+// Parts: []llms.ContentPart{
+// bedrock.WithCacheControl(
+// llms.TextPart("long context..."),
+// bedrock.EphemeralCache(),
+// ),
+// },
+// },
+// }
+//
+// # Tool Calling
+//
+// Both APIs support tool calling for compatible models:
+//
+// tools := []llms.Tool{
+// {
+// Type: "function",
+// Function: &llms.FunctionDefinition{
+// Name: "get_weather",
+// Description: "Get weather for location",
+// Parameters: map[string]any{...},
+// },
+// },
+// }
+//
+// resp, err := llm.GenerateContent(ctx, messages,
+// llms.WithTools(tools),
+// )
+//
+// # Reasoning Support
+//
+// Claude 4.x and 3.7 models support reasoning (thinking) mode:
+//
+// resp, err := llm.GenerateContent(ctx, messages,
+// llms.WithReasoning(llms.ReasoningMedium, 2048),
+// )
+//
+// // Access reasoning content
+// if resp.Choices[0].Reasoning != nil {
+// fmt.Println(resp.Choices[0].Reasoning.Content)
+// }
+//
+// # Streaming
+//
+// Both APIs support streaming responses:
+//
+// streamFunc := func(ctx context.Context, chunk streaming.Chunk) error {
+// switch chunk.Type {
+// case streaming.ChunkTypeText:
+// fmt.Print(chunk.Content)
+// case streaming.ChunkTypeReasoning:
+// fmt.Println("Thinking:", chunk.Reasoning.Content)
+// case streaming.ChunkTypeToolCall:
+// fmt.Println("Tool:", chunk.ToolCall.Name)
+// }
+// return nil
+// }
+//
+// resp, err := llm.GenerateContent(ctx, messages,
+// llms.WithStreamingFunc(streamFunc),
+// )
+//
+// # Supported Models
+//
+// See models_list.go for complete list. Major providers:
+//
+// - Anthropic: Claude 4.6 (Opus, Sonnet), Claude 4.5, 4.1, 4, 3.7, 3.5
+// - Amazon: Nova 2 Lite, Nova Premier, Nova Pro, Nova Lite, Nova Micro
+// - Meta: Llama 4, Llama 3.3, 3.2, 3.1, 3
+// - Cohere: Command R, Command R+
+// - AI21: Jamba 1.5 Large, Mini
+// - DeepSeek: R1
+// - OpenAI: GPT-OSS-120B, GPT-OSS-20B
+// - Qwen: Qwen3 Next, Qwen3 VL, Qwen3 32B, Qwen3 Coder (30B, Next)
+// - Mistral: Large 3, Magistral Small
+// - Moonshot: Kimi K2.5, Kimi K2 Thinking
+// - Z.AI: GLM-4.7, GLM-4.7-Flash
+//
+// # Error Handling
+//
+// Provider-specific errors are mapped to standardized error codes:
+//
+// resp, err := llm.GenerateContent(ctx, messages)
+// if err != nil {
+// if llmErr, ok := err.(*llms.Error); ok {
+// switch llmErr.Code {
+// case llms.ErrCodeRateLimit:
+// // Handle rate limiting
+// case llms.ErrCodeAuthentication:
+// // Handle auth errors
+// }
+// }
+// }
+//
+// See errors.go for complete error mapping.
+//
+// # AWS Configuration
+//
+// The client uses AWS SDK v2 configuration:
+//
+// - Credentials: From environment (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) or AWS config
+// - Region: From environment (AWS_REGION) or default config
+// - Custom configuration: Use bedrock.WithClient() with pre-configured bedrockruntime.Client
+//
+// # Performance Considerations
+//
+// - Converse API is recommended for new applications (unified, better error handling)
+// - Automatic caching reduces costs by 90% for cached tokens (Claude 4.x only)
+// - Streaming reduces latency for interactive applications
+// - Minimum cache checkpoint: 1024 tokens (Sonnet 4.5), 4096 tokens (Haiku 4.5)
+//
+// # Maintenance
+//
+// When adding new models:
+// 1. Add model constant to models_list.go with documentation
+// 2. Update provider detection in internal/bedrockclient/bedrockclient.go if needed
+// 3. Add provider-specific implementation in internal/bedrockclient/provider_*.go
+// 4. Update tests in bedrockllm_test.go to include new model
+// 5. For caching support, add pattern to supportsCaching() method
+//
+// When updating API:
+// 1. Converse API changes go to internal/bedrockclient/bedrockclient_converse.go
+// 2. Legacy API changes go to internal/bedrockclient/provider_*.go
+// 3. Message processing changes go to bedrockllm.go (processMessages, processMessagesWithCaching)
+// 4. Always maintain backward compatibility
+// 5. Add integration tests with httprr recording
+//
+// # Testing
+//
+// Tests use httprr for HTTP recording/replay:
+//
+// - Integration tests: bedrockllm_test.go (requires AWS credentials)
+// - Unit tests: bedrockllm_unit_test.go (no credentials needed)
+// - Tool calling: bedrock_tool_integration_test.go
+//
+// Recording new HTTP interactions:
+//
+// HTTPRR_RECORD=. go test -v -run TestName ./llms/bedrock/
+//
+// Debug HTTP interactions:
+//
+// HTTPRR_RECORD=. HTTPRR_DEBUG=true go test -v -run TestName ./llms/bedrock/
+package bedrock
diff --git a/llms/bedrock/internal/bedrockclient/bedrockclient.go b/llms/bedrock/internal/bedrockclient/bedrockclient.go
index 1070d5ba..301c6498 100644
--- a/llms/bedrock/internal/bedrockclient/bedrockclient.go
+++ b/llms/bedrock/internal/bedrockclient/bedrockclient.go
@@ -6,6 +6,7 @@ import (
"strings"
"github.com/vxcontrol/langchaingo/llms"
+ "github.com/vxcontrol/langchaingo/llms/reasoning"
"github.com/aws/aws-sdk-go-v2/service/bedrockruntime"
)
@@ -31,6 +32,16 @@ type Message struct {
// Tool calling fields
ToolCall *ToolCall `json:"tool_call,omitempty"`
ToolResult *ToolResult `json:"tool_result,omitempty"`
+ // Reasoning contains thinking content for AI messages
+ Reasoning *reasoning.ContentReasoning `json:"reasoning,omitempty"`
+ // CacheControl for prompt caching (used by Legacy Anthropic API)
+ CacheControl *CacheControl `json:"cache_control,omitempty"`
+}
+
+// CacheControl represents cache configuration for prompt caching
+type CacheControl struct {
+ Type string `json:"type"`
+ TTL string `json:"ttl,omitempty"`
}
// ToolCall represents a function call request from the model
diff --git a/llms/bedrock/internal/bedrockclient/bedrockclient_converse.go b/llms/bedrock/internal/bedrockclient/bedrockclient_converse.go
index c1fbc75e..ace91e42 100644
--- a/llms/bedrock/internal/bedrockclient/bedrockclient_converse.go
+++ b/llms/bedrock/internal/bedrockclient/bedrockclient_converse.go
@@ -60,6 +60,7 @@ type ConverseInput struct {
Tools []llms.Tool
StreamingFunc streaming.Callback
ReasoningConfig *llms.ReasoningConfig
+ EnableCaching bool
}
type converseThinkingPayload struct {
@@ -94,6 +95,11 @@ func (c *ConverseClient) buildConverseInput(input *ConverseInput) (*bedrockrunti
inferenceConfig.StopSequences = input.StopSequences
}
+ // Add cachePoint to messages if caching is enabled
+ if input.EnableCaching && len(converseMessages) > 0 {
+ c.addCachePointToMessages(converseMessages)
+ }
+
converseInput := &bedrockruntime.ConverseInput{
ModelId: aws.String(input.ModelID),
Messages: converseMessages,
@@ -102,6 +108,15 @@ func (c *ConverseClient) buildConverseInput(input *ConverseInput) (*bedrockrunti
// Add system prompts if any
if len(systemPrompts) > 0 {
+ // Add cachePoint after system if caching is enabled
+ if input.EnableCaching {
+ systemPrompts = append(systemPrompts, &types.SystemContentBlockMemberCachePoint{
+ Value: types.CachePointBlock{
+ Type: types.CachePointTypeDefault,
+ Ttl: types.CacheTTLFiveMinutes,
+ },
+ })
+ }
converseInput.System = systemPrompts
}
@@ -152,6 +167,20 @@ func (c *ConverseClient) convertMessages(messages []Message) ([]types.Message, [
if err != nil {
return nil, nil, err
}
+ // Add cachePoint if message has cache control
+ if msg.CacheControl != nil {
+ cacheBlock := types.CachePointBlock{
+ Type: types.CachePointTypeDefault,
+ }
+ if msg.CacheControl.TTL == "1h" {
+ cacheBlock.Ttl = types.CacheTTLOneHour
+ } else {
+ cacheBlock.Ttl = types.CacheTTLFiveMinutes
+ }
+ converseMsg.Content = append(converseMsg.Content, &types.ContentBlockMemberCachePoint{
+ Value: cacheBlock,
+ })
+ }
converseMessages = append(converseMessages, converseMsg)
case llms.ChatMessageTypeTool:
converseMsg, err := c.convertToolMessage(msg)
@@ -165,6 +194,22 @@ func (c *ConverseClient) convertMessages(messages []Message) ([]types.Message, [
return converseMessages, systemPrompts, nil
}
+// addCachePointToMessages adds cachePoint to the last message for conversation history caching
+func (c *ConverseClient) addCachePointToMessages(messages []types.Message) {
+ if len(messages) == 0 {
+ return
+ }
+
+ // Add cachePoint to the last message's content
+ lastMsg := &messages[len(messages)-1]
+ lastMsg.Content = append(lastMsg.Content, &types.ContentBlockMemberCachePoint{
+ Value: types.CachePointBlock{
+ Type: types.CachePointTypeDefault,
+ Ttl: types.CacheTTLFiveMinutes,
+ },
+ })
+}
+
// convertUserOrAssistantMessage converts user or assistant messages
func (c *ConverseClient) convertUserOrAssistantMessage(msg Message) (types.Message, error) {
var role types.ConversationRole
@@ -176,6 +221,31 @@ func (c *ConverseClient) convertUserOrAssistantMessage(msg Message) (types.Messa
var contentBlocks []types.ContentBlock
+ // For AI messages with reasoning, add reasoning blocks first
+ if msg.Role == llms.ChatMessageTypeAI && msg.Reasoning != nil {
+ // Add thinking block if present
+ if msg.Reasoning.Content != "" || len(msg.Reasoning.Signature) > 0 {
+ reasoningBlock := types.ReasoningContentBlockMemberReasoningText{
+ Value: types.ReasoningTextBlock{
+ Text: ptrStringOrNil(msg.Reasoning.Content),
+ Signature: ptrStringOrNil(string(msg.Reasoning.Signature)),
+ },
+ }
+ contentBlocks = append(contentBlocks, &types.ContentBlockMemberReasoningContent{
+ Value: &reasoningBlock,
+ })
+ }
+ // Add redacted thinking block if present
+ if len(msg.Reasoning.RedactedContent) > 0 {
+ redactedBlock := types.ReasoningContentBlockMemberRedactedContent{
+ Value: msg.Reasoning.RedactedContent,
+ }
+ contentBlocks = append(contentBlocks, &types.ContentBlockMemberReasoningContent{
+ Value: &redactedBlock,
+ })
+ }
+ }
+
// Handle text content
if msg.Content != "" {
contentBlocks = append(contentBlocks, &types.ContentBlockMemberText{
@@ -205,9 +275,11 @@ func (c *ConverseClient) convertToolCallInput(args any) (any, error) {
return args, nil
}
+ // Convert to Smithy-compatible format by re-encoding through JSON
+ // This handles types like map[string]any with interface{} values
jsonBytes := bytes.NewBuffer(nil)
if err := json.NewEncoder(jsonBytes).Encode(args); err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to encode arguments: %w", err)
}
jsonDecoder := json.NewDecoder(jsonBytes)
@@ -215,7 +287,7 @@ func (c *ConverseClient) convertToolCallInput(args any) (any, error) {
var jsonValue any
if err := jsonDecoder.Decode(&jsonValue); err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to decode arguments: %w", err)
}
return jsonValue, nil
@@ -315,6 +387,8 @@ func (c *ConverseClient) handleStreamingResponse(ctx context.Context, input *bed
func (c *ConverseClient) processStreamingResponse(ctx context.Context, response *bedrockruntime.ConverseStreamOutput, callback streaming.Callback) (*llms.ContentResponse, error) {
var fullContent strings.Builder
var reasoningContent strings.Builder
+ var signature bytes.Buffer
+ var redactedContent bytes.Buffer
var toolCalls []llms.ToolCall
currentToolCalls := make(map[string]*streaming.ToolCall) // Track streaming tool calls by ID
@@ -352,9 +426,13 @@ func (c *ConverseClient) processStreamingResponse(ctx context.Context, response
return nil, err
}
case *types.ReasoningContentBlockDeltaMemberRedactedContent:
- // TODO: not supported yet
+ if len(block.Value) > 0 {
+ redactedContent.Write(block.Value)
+ }
case *types.ReasoningContentBlockDeltaMemberSignature:
- // TODO: not supported yet
+ if len(block.Value) > 0 {
+ signature.WriteString(block.Value)
+ }
}
}
case *types.ContentBlockDeltaMemberToolUse:
@@ -433,11 +511,20 @@ func (c *ConverseClient) processStreamingResponse(ctx context.Context, response
return nil, fmt.Errorf("stream error: %w", err)
}
+ var sig []byte
+ if signature.Len() > 0 {
+ sig = signature.Bytes()
+ }
+ var redacted []byte
+ if redactedContent.Len() > 0 {
+ redacted = redactedContent.Bytes()
+ }
+
choice := &llms.ContentChoice{
Content: fullContent.String(),
ToolCalls: toolCalls,
GenerationInfo: make(map[string]any),
- Reasoning: c.processReasoning(reasoningContent.String()),
+ Reasoning: c.processReasoning(reasoningContent.String(), sig, redacted),
}
result := &llms.ContentResponse{
@@ -447,13 +534,15 @@ func (c *ConverseClient) processStreamingResponse(ctx context.Context, response
return result, nil
}
-func (c *ConverseClient) processReasoning(reasoningContent string) *reasoning.ContentReasoning {
- if reasoningContent == "" {
+func (c *ConverseClient) processReasoning(reasoningContent string, signature []byte, redactedContent []byte) *reasoning.ContentReasoning {
+ if reasoningContent == "" && len(signature) == 0 && len(redactedContent) == 0 {
return nil
}
return &reasoning.ContentReasoning{
- Content: reasoningContent,
+ Content: reasoningContent,
+ Signature: signature,
+ RedactedContent: redactedContent,
}
}
@@ -477,7 +566,17 @@ func (c *ConverseClient) convertConverseResponse(response *bedrockruntime.Conver
choice.Content += block.Value
case *types.ContentBlockMemberToolUse:
// Convert tool use to ToolCall
- argsJSON, _ := json.Marshal(block.Value.Input)
+ // Extract input from document.LazyDocument
+ var inputData any
+ if block.Value.Input != nil {
+ if err := block.Value.Input.UnmarshalSmithyDocument(&inputData); err != nil {
+ return nil, fmt.Errorf("failed to unmarshal tool input document: %w", err)
+ }
+ }
+ argsJSON, err := json.Marshal(inputData)
+ if err != nil {
+ return nil, fmt.Errorf("failed to marshal tool input to JSON: %w", err)
+ }
toolCall := llms.ToolCall{
ID: *block.Value.ToolUseId,
Type: "function",
@@ -488,14 +587,28 @@ func (c *ConverseClient) convertConverseResponse(response *bedrockruntime.Conver
}
choice.ToolCalls = append(choice.ToolCalls, toolCall)
case *types.ContentBlockMemberReasoningContent:
- // The block.Value is of type ReasoningContentBlock, not string
- // TODO: Extract text from reasoning block when AWS SDK exposes it
+ // The block.Value is of type ReasoningContentBlock
switch content := block.Value.(type) {
case *types.ReasoningContentBlockMemberReasoningText:
- choice.Reasoning = c.processReasoning(*content.Value.Text)
- _ = content.Value.Signature // TODO: not supported yet
+ reasoningText := ""
+ if content.Value.Text != nil {
+ reasoningText = *content.Value.Text
+ }
+ var sig []byte
+ if content.Value.Signature != nil {
+ sig = []byte(*content.Value.Signature)
+ }
+ choice.Reasoning = c.processReasoning(reasoningText, sig, nil)
case *types.ReasoningContentBlockMemberRedactedContent:
- // TODO: not supported yet
+ var redacted []byte
+ if len(content.Value) > 0 {
+ redacted = content.Value
+ }
+ if choice.Reasoning == nil {
+ choice.Reasoning = c.processReasoning("", nil, redacted)
+ } else {
+ choice.Reasoning.RedactedContent = redacted
+ }
}
}
}
@@ -508,12 +621,25 @@ func (c *ConverseClient) convertConverseResponse(response *bedrockruntime.Conver
if response.Usage != nil {
if response.Usage.InputTokens != nil {
choice.GenerationInfo["input_tokens"] = *response.Usage.InputTokens
+ choice.GenerationInfo["PromptTokens"] = *response.Usage.InputTokens
}
if response.Usage.OutputTokens != nil {
choice.GenerationInfo["output_tokens"] = *response.Usage.OutputTokens
+ choice.GenerationInfo["CompletionTokens"] = *response.Usage.OutputTokens
}
if response.Usage.TotalTokens != nil {
choice.GenerationInfo["total_tokens"] = *response.Usage.TotalTokens
+ choice.GenerationInfo["TotalTokens"] = *response.Usage.TotalTokens
+ }
+ // Add cache metrics if available
+ if response.Usage.CacheReadInputTokens != nil {
+ choice.GenerationInfo["cacheReadInputTokens"] = *response.Usage.CacheReadInputTokens
+ choice.GenerationInfo["CacheReadInputTokens"] = *response.Usage.CacheReadInputTokens
+ choice.GenerationInfo["PromptCachedTokens"] = *response.Usage.CacheReadInputTokens
+ }
+ if response.Usage.CacheWriteInputTokens != nil {
+ choice.GenerationInfo["cacheWriteInputTokens"] = *response.Usage.CacheWriteInputTokens
+ choice.GenerationInfo["CacheCreationInputTokens"] = *response.Usage.CacheWriteInputTokens
}
}
@@ -530,7 +656,11 @@ func (c *ConverseClient) supportsReasoning(modelID string) bool {
reasoningModels := []string{
"anthropic.claude-opus-4-",
"anthropic.claude-sonnet-4-",
+ "anthropic.claude-haiku-4-",
"anthropic.claude-3-7-",
+ "openai.gpt-oss-120b",
+ "openai.gpt-oss-20b",
+ "moonshot.kimi-k2-thinking",
}
for _, model := range reasoningModels {
@@ -540,3 +670,10 @@ func (c *ConverseClient) supportsReasoning(modelID string) bool {
}
return false
}
+
+func ptrStringOrNil(s string) *string {
+ if s == "" {
+ return nil
+ }
+ return &s
+}
diff --git a/llms/bedrock/internal/bedrockclient/bedrockclient_integration_test.go b/llms/bedrock/internal/bedrockclient/bedrockclient_integration_test.go
index 48b2e32a..678699d4 100644
--- a/llms/bedrock/internal/bedrockclient/bedrockclient_integration_test.go
+++ b/llms/bedrock/internal/bedrockclient/bedrockclient_integration_test.go
@@ -176,8 +176,14 @@ func TestClient_CreateCompletion(t *testing.T) {
},
StopReason: AnthropicCompletionReasonEndTurn,
Usage: struct {
- InputTokens int32 `json:"input_tokens"`
- OutputTokens int32 `json:"output_tokens"`
+ InputTokens int32 `json:"input_tokens"`
+ OutputTokens int32 `json:"output_tokens"`
+ CacheCreationInputTokens int32 `json:"cache_creation_input_tokens,omitempty"`
+ CacheReadInputTokens int32 `json:"cache_read_input_tokens,omitempty"`
+ CacheCreation struct {
+ Ephemeral5mInputTokens int32 `json:"ephemeral_5m_input_tokens,omitempty"`
+ Ephemeral1hInputTokens int32 `json:"ephemeral_1h_input_tokens,omitempty"`
+ } `json:"cache_creation,omitempty"`
}{
InputTokens: 10,
OutputTokens: 5,
@@ -470,6 +476,7 @@ func TestClient_CreateCompletion_Streaming(t *testing.T) {
StopReason string `json:"stop_reason"`
StopSequence any `json:"stop_sequence"`
Thinking string `json:"thinking,omitempty"`
+ Signature string `json:"signature,omitempty"`
}{
Type: "text_delta",
Text: "Once upon a time, ",
@@ -485,6 +492,7 @@ func TestClient_CreateCompletion_Streaming(t *testing.T) {
StopReason string `json:"stop_reason"`
StopSequence any `json:"stop_sequence"`
Thinking string `json:"thinking,omitempty"`
+ Signature string `json:"signature,omitempty"`
}{
Type: "text_delta",
Text: "there was a brave knight.",
@@ -499,6 +507,7 @@ func TestClient_CreateCompletion_Streaming(t *testing.T) {
StopReason string `json:"stop_reason"`
StopSequence any `json:"stop_sequence"`
Thinking string `json:"thinking,omitempty"`
+ Signature string `json:"signature,omitempty"`
}{
StopReason: AnthropicCompletionReasonEndTurn,
},
@@ -792,6 +801,7 @@ func TestClient_CreateCompletion_StreamingCancellation(t *testing.T) {
StopReason string `json:"stop_reason"`
StopSequence any `json:"stop_sequence"`
Thinking string `json:"thinking,omitempty"`
+ Signature string `json:"signature,omitempty"`
}{
Type: "text_delta",
Text: fmt.Sprintf("Chunk %d ", i),
diff --git a/llms/bedrock/internal/bedrockclient/bedrockclient_test.go b/llms/bedrock/internal/bedrockclient/bedrockclient_test.go
index 5c42d675..ea9c01a5 100644
--- a/llms/bedrock/internal/bedrockclient/bedrockclient_test.go
+++ b/llms/bedrock/internal/bedrockclient/bedrockclient_test.go
@@ -675,8 +675,14 @@ func TestAnthropicResponseParsing(t *testing.T) {
StopReason: AnthropicCompletionReasonEndTurn,
StopSequence: "",
Usage: struct {
- InputTokens int32 `json:"input_tokens"`
- OutputTokens int32 `json:"output_tokens"`
+ InputTokens int32 `json:"input_tokens"`
+ OutputTokens int32 `json:"output_tokens"`
+ CacheCreationInputTokens int32 `json:"cache_creation_input_tokens,omitempty"`
+ CacheReadInputTokens int32 `json:"cache_read_input_tokens,omitempty"`
+ CacheCreation struct {
+ Ephemeral5mInputTokens int32 `json:"ephemeral_5m_input_tokens,omitempty"`
+ Ephemeral1hInputTokens int32 `json:"ephemeral_1h_input_tokens,omitempty"`
+ } `json:"cache_creation,omitempty"`
}{
InputTokens: 10,
OutputTokens: 15,
@@ -777,6 +783,7 @@ func TestAnthropicStreamingResponseChunk(t *testing.T) {
StopReason string `json:"stop_reason"`
StopSequence any `json:"stop_sequence"`
Thinking string `json:"thinking,omitempty"`
+ Signature string `json:"signature,omitempty"`
}{
Type: "text_delta",
Text: "Hello, how can I help you today?",
@@ -794,6 +801,7 @@ func TestAnthropicStreamingResponseChunk(t *testing.T) {
StopReason string `json:"stop_reason"`
StopSequence any `json:"stop_sequence"`
Thinking string `json:"thinking,omitempty"`
+ Signature string `json:"signature,omitempty"`
}{
StopReason: AnthropicCompletionReasonEndTurn,
},
diff --git a/llms/bedrock/internal/bedrockclient/provider_anthropic.go b/llms/bedrock/internal/bedrockclient/provider_anthropic.go
index ee96dcab..ae4dae3d 100644
--- a/llms/bedrock/internal/bedrockclient/provider_anthropic.go
+++ b/llms/bedrock/internal/bedrockclient/provider_anthropic.go
@@ -37,7 +37,7 @@ type anthropicBinGenerationInputSource struct {
// anthropicTextGenerationInputContent is a single message in the input.
type anthropicTextGenerationInputContent struct {
// The type of the content. Required.
- // One of: "text", "image", "tool_use", "tool_result"
+ // One of: "text", "image", "tool_use", "tool_result", "thinking", "redacted_thinking"
Type string `json:"type"`
// The source of the content. Required if type is "image"
Source *anthropicBinGenerationInputSource `json:"source,omitempty"`
@@ -50,6 +50,17 @@ type anthropicTextGenerationInputContent struct {
// Tool result fields
ToolUseID string `json:"tool_use_id,omitempty"`
Content string `json:"content,omitempty"`
+ // Thinking fields
+ Thinking string `json:"thinking,omitempty"`
+ Signature string `json:"signature,omitempty"`
+ Data string `json:"data,omitempty"`
+ // Cache control for prompt caching (Bedrock supports Anthropic cache_control format)
+ CacheControl *anthropicCacheControl `json:"cache_control,omitempty"`
+}
+
+type anthropicCacheControl struct {
+ Type string `json:"type"`
+ TTL string `json:"ttl,omitempty"`
}
type anthropicTextGenerationInputMessage struct {
@@ -68,7 +79,8 @@ type anthropicTextGenerationInput struct {
// The maximum number of tokens to generate per result. Required
MaxTokens int `json:"max_tokens"`
// The system prompt to use. Optional
- System string `json:"system,omitempty"`
+ // Can be string or []anthropicTextGenerationInputContent for caching support
+ System any `json:"system,omitempty"`
// The messages to use. Required
Messages []*anthropicTextGenerationInputMessage `json:"messages"`
// The amount of randomness injected into the response. Optional, default = 1
@@ -88,9 +100,10 @@ type anthropicTextGenerationInput struct {
}
type anthropicTool struct {
- Name string `json:"name"`
- Description string `json:"description,omitempty"`
- InputSchema any `json:"input_schema,omitempty"`
+ Name string `json:"name"`
+ Description string `json:"description,omitempty"`
+ InputSchema any `json:"input_schema,omitempty"`
+ CacheControl *anthropicCacheControl `json:"cache_control,omitempty"`
}
type anthropicThinkingPayload struct {
@@ -114,19 +127,27 @@ type anthropicTextGenerationOutput struct {
StopReason string `json:"stop_reason"`
// Which custom stop sequence was matched, if any.
StopSequence string `json:"stop_sequence"`
- Usage struct {
- InputTokens int32 `json:"input_tokens"`
- OutputTokens int32 `json:"output_tokens"`
+ Usage struct {
+ InputTokens int32 `json:"input_tokens"`
+ OutputTokens int32 `json:"output_tokens"`
+ CacheCreationInputTokens int32 `json:"cache_creation_input_tokens,omitempty"`
+ CacheReadInputTokens int32 `json:"cache_read_input_tokens,omitempty"`
+ CacheCreation struct {
+ Ephemeral5mInputTokens int32 `json:"ephemeral_5m_input_tokens,omitempty"`
+ Ephemeral1hInputTokens int32 `json:"ephemeral_1h_input_tokens,omitempty"`
+ } `json:"cache_creation,omitempty"`
} `json:"usage"`
}
type anthropicContentBlock struct {
- Type string `json:"type"`
- Text string `json:"text,omitempty"`
- ID string `json:"id,omitempty"`
- Name string `json:"name,omitempty"`
- Input map[string]any `json:"input,omitempty"`
- Thinking string `json:"thinking,omitempty"`
+ Type string `json:"type"`
+ Text string `json:"text,omitempty"`
+ ID string `json:"id,omitempty"`
+ Name string `json:"name,omitempty"`
+ Input map[string]any `json:"input,omitempty"`
+ Thinking string `json:"thinking,omitempty"`
+ Signature string `json:"signature,omitempty"`
+ Data string `json:"data,omitempty"`
}
// Finish reason for the completion of the generation.
@@ -176,10 +197,16 @@ func createAnthropicCompletion(ctx context.Context,
}
}
+ // Prepare system prompt - omit if empty
+ var system any
+ if systemPrompt != "" {
+ system = systemPrompt
+ }
+
input := anthropicTextGenerationInput{
AnthropicVersion: AnthropicLatestVersion,
MaxTokens: getMaxTokens(options.MaxTokens, 2048),
- System: systemPrompt,
+ System: system,
Messages: inputContents,
Temperature: options.Temperature,
TopP: options.TopP,
@@ -244,6 +271,8 @@ func createAnthropicCompletion(ctx context.Context,
// Group content blocks by type for this choice
var textContent string
var reasoningContent string
+ var signature []byte
+ var redactedContent []byte
var toolCalls []llms.ToolCall
for _, c := range output.Content {
@@ -252,6 +281,13 @@ func createAnthropicCompletion(ctx context.Context,
textContent += c.Text
case "thinking":
reasoningContent += c.Thinking
+ if len(c.Signature) > 0 {
+ signature = []byte(c.Signature)
+ }
+ case "redacted_thinking":
+ if len(c.Data) > 0 {
+ redactedContent = []byte(c.Data)
+ }
case "tool_use":
argumentsJSON, err := json.Marshal(c.Input)
if err != nil {
@@ -271,16 +307,21 @@ func createAnthropicCompletion(ctx context.Context,
// Create single choice with all content
choice := &llms.ContentChoice{
Content: textContent,
- Reasoning: processReasoning(reasoningContent),
+ Reasoning: processReasoning(reasoningContent, signature, redactedContent),
ToolCalls: toolCalls,
StopReason: output.StopReason,
GenerationInfo: map[string]any{
- "input_tokens": output.Usage.InputTokens,
- "output_tokens": output.Usage.OutputTokens,
- // Standardized field names for cross-provider compatibility
+ "input_tokens": output.Usage.InputTokens,
+ "output_tokens": output.Usage.OutputTokens,
"PromptTokens": output.Usage.InputTokens,
"CompletionTokens": output.Usage.OutputTokens,
"TotalTokens": output.Usage.InputTokens + output.Usage.OutputTokens,
+ // Cache metrics
+ "CacheReadInputTokens": output.Usage.CacheReadInputTokens,
+ "CacheCreationInputTokens": output.Usage.CacheCreationInputTokens,
+ "CacheCreationEphemeral5mInputTokens": output.Usage.CacheCreation.Ephemeral5mInputTokens,
+ "CacheCreationEphemeral1hInputTokens": output.Usage.CacheCreation.Ephemeral1hInputTokens,
+ "PromptCachedTokens": output.Usage.CacheReadInputTokens,
},
}
Contentchoices = append(Contentchoices, choice)
@@ -290,13 +331,15 @@ func createAnthropicCompletion(ctx context.Context,
}, nil
}
-func processReasoning(reasoningContent string) *reasoning.ContentReasoning {
- if reasoningContent == "" {
+func processReasoning(reasoningContent string, signature []byte, redactedContent []byte) *reasoning.ContentReasoning {
+ if reasoningContent == "" && len(signature) == 0 && len(redactedContent) == 0 {
return nil
}
return &reasoning.ContentReasoning{
- Content: reasoningContent,
+ Content: reasoningContent,
+ Signature: signature,
+ RedactedContent: redactedContent,
}
}
@@ -310,6 +353,7 @@ type streamingCompletionResponseChunk struct {
StopReason string `json:"stop_reason"`
StopSequence any `json:"stop_sequence"`
Thinking string `json:"thinking,omitempty"`
+ Signature string `json:"signature,omitempty"`
} `json:"delta"`
ContentBlock struct {
Type string `json:"type"`
@@ -356,6 +400,7 @@ func parseStreamingCompletionResponse(ctx context.Context, client *bedrockruntim
contentchoices := []*llms.ContentChoice{{GenerationInfo: map[string]any{}}}
var currentToolCall *streaming.ToolCall
var toolCalls []llms.ToolCall
+ var signature strings.Builder
for e := range stream.Events() {
if err = stream.Err(); err != nil {
@@ -399,6 +444,13 @@ func parseStreamingCompletionResponse(ctx context.Context, client *bedrockruntim
}
contentchoices[0].Reasoning = appendReasoning(contentchoices[0].Reasoning, resp.Delta.Thinking)
}
+ if resp.Delta.Signature != "" {
+ signature.WriteString(resp.Delta.Signature)
+ }
+ case "signature_delta":
+ if resp.Delta.Signature != "" {
+ signature.WriteString(resp.Delta.Signature)
+ }
case "input_json_delta":
if currentToolCall != nil {
// Bedrock already sends deltas in PartialJSON, not full accumulated JSON
@@ -451,6 +503,11 @@ func parseStreamingCompletionResponse(ctx context.Context, client *bedrockruntim
// Add tool calls to the final response
contentchoices[0].ToolCalls = toolCalls
+ // Add signature to reasoning if accumulated
+ if signature.Len() > 0 && contentchoices[0].Reasoning != nil {
+ contentchoices[0].Reasoning.Signature = []byte(signature.String())
+ }
+
return &llms.ContentResponse{
Choices: contentchoices,
}, nil
@@ -458,7 +515,7 @@ func parseStreamingCompletionResponse(ctx context.Context, client *bedrockruntim
func appendReasoning(reasoning *reasoning.ContentReasoning, reasoningContent string) *reasoning.ContentReasoning {
if reasoning == nil {
- return processReasoning(reasoningContent)
+ return processReasoning(reasoningContent, nil, nil)
}
reasoning.Content += reasoningContent
@@ -507,6 +564,29 @@ func processInputMessagesAnthropic(messages []Message) ([]*anthropicTextGenerati
}
content := make([]anthropicTextGenerationInputContent, 0, len(chunk))
for _, message := range chunk {
+ // For AI messages with reasoning, add thinking blocks before text
+ if message.Role == llms.ChatMessageTypeAI && message.Reasoning != nil {
+ // Add thinking block if present
+ if message.Reasoning.Content != "" || len(message.Reasoning.Signature) > 0 {
+ thinkingBlock := anthropicTextGenerationInputContent{
+ Type: "thinking",
+ Thinking: message.Reasoning.Content,
+ }
+ if len(message.Reasoning.Signature) > 0 {
+ thinkingBlock.Signature = string(message.Reasoning.Signature)
+ }
+ content = append(content, thinkingBlock)
+ }
+ // Add redacted_thinking block if present
+ if len(message.Reasoning.RedactedContent) > 0 {
+ redactedBlock := anthropicTextGenerationInputContent{
+ Type: "redacted_thinking",
+ Data: string(message.Reasoning.RedactedContent),
+ }
+ content = append(content, redactedBlock)
+ }
+ }
+ // Add regular content (text, tool_use, tool_result, etc.)
content = append(content, getAnthropicInputContent(message))
}
inputContents = append(inputContents, &anthropicTextGenerationInputMessage{
@@ -547,6 +627,12 @@ func getAnthropicInputContent(message Message) anthropicTextGenerationInputConte
Type: message.Type,
Text: message.Content,
}
+ if message.CacheControl != nil {
+ c.CacheControl = &anthropicCacheControl{
+ Type: message.CacheControl.Type,
+ TTL: message.CacheControl.TTL,
+ }
+ }
case AnthropicMessageTypeImage:
c = anthropicTextGenerationInputContent{
Type: message.Type,
@@ -572,6 +658,12 @@ func getAnthropicInputContent(message Message) anthropicTextGenerationInputConte
ToolUseID: message.ToolResult.ToolCallID,
Content: message.ToolResult.Content,
}
+ if message.CacheControl != nil {
+ c.CacheControl = &anthropicCacheControl{
+ Type: message.CacheControl.Type,
+ TTL: message.CacheControl.TTL,
+ }
+ }
}
}
return c
diff --git a/llms/bedrock/models_list.go b/llms/bedrock/models_list.go
index 0a1d3a9a..51ecf4ce 100644
--- a/llms/bedrock/models_list.go
+++ b/llms/bedrock/models_list.go
@@ -65,6 +65,24 @@ const (
// Languages: 200+ languages.
ModelAmazonNovaMicroV1 = "us.amazon.nova-micro-v1:0"
+ // Claude Opus 4.6 is the world's best model for coding, enterprise agents, and professional work.
+ // It excels at agentic workflows, orchestrating complex tasks across dozens of tools with industry-leading
+ // reliability. It handles the full lifecycle from architecture to deployment, delivers the deepest reasoning
+ // for security workflows, and is Anthropic's most capable model for financial workflows and computer use.
+ //
+ // Max tokens: 1M (beta)
+ // Languages: English, French, Modern Standard Arabic, Mandarin Chinese, Hindi, Spanish, Portuguese, Korean, Japanese, German, Russian, Polish, and other languages.
+ ModelAnthropicClaudeOpus46 = "us.anthropic.claude-opus-4-6-v1"
+
+ // Claude Sonnet 4.6 delivers frontier intelligence at scale—built for coding, agents, and enterprise workflows.
+ // It excels at complex, multi-step tasks requiring sustained reasoning and adaptive decision-making, handles
+ // iterative development work with complex codebases, and brings professional-grade analysis with memory to
+ // maintain context across files. Step-change improvement in creating spreadsheets, slides, and docs.
+ //
+ // Max tokens: 1M (beta)
+ // Languages: English, French, Modern Standard Arabic, Mandarin Chinese, Hindi, Spanish, Portuguese, Korean, Japanese, German, Russian, Polish, and other languages.
+ ModelAnthropicClaudeSonnet46 = "us.anthropic.claude-sonnet-4-6"
+
// Claude Opus 4.5 is the next generation of Anthropic's most intelligent model, an industry leader
// across coding, agents, computer use, and enterprise workflows. It can confidently deliver multi-day
// software development projects in hours, working independently with technical depth.
@@ -219,6 +237,17 @@ const (
// Languages: English.
ModelMetaLlama38bInstructV1 = "meta.llama3-8b-instruct-v1:0"
+ // DeepSeek-V3.2 harmonizes high computational efficiency with superior reasoning and agent performance.
+ // It builds on DeepSeek Sparse Attention for long-context efficiency, a scalable reinforcement learning framework,
+ // and a large-scale agentic task synthesis pipeline. This model excels at long-context reasoning and agentic tasks,
+ // efficiently handling extended inputs while maintaining strong accuracy. Its sparse attention design enables it to
+ // process complex, multi-step workflows without excessive compute costs. Targets long-context reasoning,
+ // tool-using agents, and efficient deployment in production environments.
+ //
+ // Max tokens: 164k
+ // Languages: English, Chinese.
+ ModelDeepSeekV32 = "deepseek.v3.2"
+
// DeepSeek-R1 provides customers a state-of-the-art reasoning model, optimized for general reasoning tasks,
// math, science, and code generation. This model is created by DeepSeek and developed through a combination
// of cold-start data and reinforcement learning. DeepSeek-R1 is a text-only model supporting English and Chinese.
@@ -243,38 +272,54 @@ const (
// Languages: English.
ModelOpenAIGptOss20BV1 = "openai.gpt-oss-20b-1:0"
- // Qwen3 Next 80B A3B is an 80B-parameter MixtureOfExperts (MOE) language model (3B active) optimized
- // for instruction following and ultra-long-context tasks. It delivers flagship-level reasoning, coding,
- // and agent performance with only 3B active parameters per token.
+ // Qwen3 Next 80B A3B turns cutting-edge MoE and hybrid attention into a practical, ultra-long-context assistant
+ // that scales from everyday chat to million-token workflows. It delivers flagship-level reasoning, coding,
+ // and agent performance with only 3B active parameters per token. Ideal for long-context summarization,
+ // code generation/refactoring, enterprise knowledge QA, and stable agentic workflows with tools.
//
// Max tokens: 256k
// Languages: English, Chinese.
ModelQwen3Next80BA3B = "qwen.qwen3-next-80b-a3b"
- // Qwen3 VL 235B A22B is a 235B-parameter MoE vision-language flagship model (about 22B active) for
- // high-end multimodal tasks, combining strong text generation with advanced visual perception,
- // 2D/3D spatial grounding, long-context document/video understanding, and multilingual OCR over very long contexts.
+ // Qwen3 VL 235B A22B is a frontier vision-language model that sees, reads, and reasons across images, documents,
+ // and long videos at massive scale. Its 235B-parameter MoE architecture (≈22B active) delivers state-of-the-art
+ // multimodal understanding, OCR, and spatial reasoning over contexts reaching hundreds of thousands of tokens.
+ // Ideal for document intelligence (OCR + layout), multimodal RAG, visual QA, and UI/scene understanding.
//
// Max tokens: 256k
// Languages: English, Chinese.
ModelQwen3VL235BA22B = "qwen.qwen3-vl-235b-a22b"
- // Qwen3 32B (dense) is a balanced dense model offering strong reasoning and general-purpose performance
- // with simple, predictable deployment across standard infra. It delivers performance that surpasses many
- // larger models and proves highly versatile across reasoning, coding, and research use cases.
+ // Qwen3 32B is a balanced dense model that offers strong reasoning and general-purpose performance with
+ // straightforward deployment on standard infrastructure. Despite its smaller size compared to frontier-scale
+ // models, Qwen3-32B delivers performance that surpasses many larger models, and proves highly versatile across
+ // reasoning, coding, and research use cases. Its balance of capability, cost efficiency, and operational
+ // simplicity has made it one of the most practical and widely deployable models in the Qwen3 family.
//
// Max tokens: 16384
// Languages: English, Chinese.
ModelQwen332BV1 = "qwen.qwen3-32b-v1:0"
- // Qwen3-Coder-30B-A3B-Instruct delivers strong coding and reasoning performance in a compact MoE design.
- // It excels at "vibe coding," natural-language-first programming, debugging, SQL generation, and other
- // development workflows, while being lightweight enough to run on single high-memory GPUs or small clusters.
+ // Qwen3-Coder-30B-A3B-Instruct delivers strong coding and reasoning performance in a compact MoE design, making
+ // it one of the most widely adopted models in the Qwen3-Coder series. It has become a favorite among developers
+ // and enterprises seeking a practical balance between cost and capability. The model excels at "vibe coding,"
+ // natural-language-first programming, debugging, SQL generation, and other development workflows, while being
+ // lightweight enough to run on single high-memory GPUs or small clusters.
//
// Max tokens: 262144
// Languages: English, Chinese.
ModelQwen3Coder30BA3BV1 = "qwen.qwen3-coder-30b-a3b-v1:0"
+ // Qwen3-Coder-Next is an open-weight language model built specifically for coding, with strong performance
+ // on large-scale software engineering and agentic coding benchmarks. It uses a hybrid Mixture-of-Experts
+ // architecture to offer high capability at relatively modest active parameter counts, improving efficiency
+ // for real-world deployments. Optimized for tool use and function calling, making it suitable as the core
+ // of coding agents that interact with shells, editors, issue trackers, and other developer tools.
+ //
+ // Max tokens: 256k
+ // Languages: English, Chinese.
+ ModelQwen3CoderNext = "qwen.qwen3-coder-next"
+
// Mistral Large 3 is Mistral's most advanced open-weight multimodal model, combining a granular
// Mixture-of-Experts architecture (673B total parameters with 39B active, plus a 2.5B vision encoder)
// and a 256k context window to deliver state-of-the-art reliability, long-context reasoning, and
@@ -299,11 +344,43 @@ const (
// Languages: English, French, German, Spanish, Chinese, Japanese, and multiple other languages.
ModelMistralLarge2402V1 = "mistral.mistral-large-2402-v1:0"
+ // Kimi K2.5 brings together strong vision, language, and code capabilities in a single natively multimodal
+ // architecture. It handles complex tasks that mix images and text—such as generating code from UI mockups
+ // or analyzing visual documents—with high accuracy. The model's "thinking" mode enables deep, deliberate reasoning,
+ // while "instant" mode provides fast responses for interactive use. Its built-in support for tool use and agent
+ // orchestration makes it highly effective for building sophisticated multimodal assistants.
+ //
+ // Max tokens: 256k
+ // Languages: English, Chinese.
+ ModelMoonshotKimiK25 = "moonshotai.kimi-k2.5"
+
// Kimi K2 Thinking is Moonshot AI's flagship "thinking agent" model, designed for deep, tool-augmented reasoning.
- // Its 1T-parameter MoE architecture (32B active) powers state-of-the-art performance on long-horizon tasks.
- // Native INT4 quantization and a 256K context window enable serious research- and agent-style workloads with practical hardware.
+ // Its 1T-parameter MoE architecture (32B active) powers state-of-the-art performance on long-horizon tasks like
+ // HLE and BrowseComp. Native INT4 quantization and a 256K context window enable serious research- and agent-style
+ // workloads with practical hardware. Ideal for long-horizon planning with tools, complex coding and debugging,
+ // research agents over large corpora, and workflows needing 200-300-step stable tool orchestration.
//
// Max tokens: 256k
// Languages: Multilingual (including Chinese and English).
ModelMoonshotKimiK2Thinking = "moonshot.kimi-k2-thinking"
+
+ // GLM-4.7 is a general-purpose language model in the GLM family with a focus on generating clean, modern
+ // front-end code and web interfaces. It can turn natural-language descriptions into structured HTML, CSS,
+ // and JavaScript while also supporting standard text and reasoning tasks. The model is positioned for developers
+ // who want high-quality UI outputs alongside general conversational and coding abilities. It remains compatible
+ // with typical LLM use cases such as question answering, summarization, and dialogue.
+ //
+ // Max tokens: 203k
+ // Languages: English, Chinese.
+ ModelGLM47 = "zai.glm-4.7"
+
+ // GLM-4.7-Flash is a lightweight variant of GLM-4.7, using a mixture-of-experts architecture to reduce
+ // resource requirements while maintaining strong output quality. It is designed for scenarios where low latency
+ // and cost efficiency are important, such as interactive assistants or high-traffic services. The model retains
+ // the core text and code generation capabilities of GLM-4.7 in a smaller active-parameter footprint.
+ // A practical choice when deployment constraints limit the use of larger models.
+ //
+ // Max tokens: 203k
+ // Languages: English, Chinese.
+ ModelGLM47Flash = "zai.glm-4.7-flash"
)
diff --git a/llms/bedrock/testdata/TestAmazonAutomaticCachingConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonAutomaticCachingConverseAPI.httprr
new file mode 100644
index 00000000..0e9e0d24
--- /dev/null
+++ b/llms/bedrock/testdata/TestAmazonAutomaticCachingConverseAPI.httprr
@@ -0,0 +1,44 @@
+httprr trace v1
+5775 654
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 5470
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"What's the weather in Boston?"},{"cachePoint":{"ttl":"5m","type":"default"}}],"role":"user"}],"system":[{"text":"BedrockConverseAutoCacheTest-v1: You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. "},{"cachePoint":{"ttl":"5m","type":"default"}}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"BedrockConverseAutoCacheTest-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","inputSchema":{"json":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}},"name":"get_weather"}}]}}HTTP/2.0 200 OK
+Content-Length: 489
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:48:45 GMT
+X-Amzn-Requestid: 5ef614ca-5045-4baf-995e-e27fb4cad3a7
+
+{"metrics":{"latencyMs":2618},"output":{"message":{"content":[{"toolUse":{"input":{"location":"Boston, MA"},"name":"get_weather","toolUseId":"tooluse_1ncUndhOL9u3hhFVuhOwlP","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheDetails":[{"inputTokens":1365,"ttl":"5m"}],"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":1365,"cacheWriteInputTokens":1365,"inputTokens":3,"outputTokens":55,"serverToolUsage":{},"totalTokens":1423}}6083 629
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 5778
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"What's the weather in Boston?"}],"role":"user"},{"content":[{"toolUse":{"input":{"location":"Boston, MA"},"name":"get_weather","toolUseId":"tooluse_1ncUndhOL9u3hhFVuhOwlP"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"{\"temperature\": 72, \"condition\": \"sunny\"}"}],"toolUseId":"tooluse_1ncUndhOL9u3hhFVuhOwlP"}},{"cachePoint":{"ttl":"5m","type":"default"}}],"role":"user"}],"system":[{"text":"BedrockConverseAutoCacheTest-v1: You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. "},{"cachePoint":{"ttl":"5m","type":"default"}}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"BedrockConverseAutoCacheTest-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","inputSchema":{"json":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}},"name":"get_weather"}}]}}HTTP/2.0 200 OK
+Content-Length: 464
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:48:48 GMT
+X-Amzn-Requestid: ba5d0941-90f6-4e82-ac10-2c5a953f3227
+
+{"metrics":{"latencyMs":2275},"output":{"message":{"content":[{"text":"The weather in Boston, MA is currently sunny with a temperature of 72°F. It's a beautiful day!"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheDetails":[{"inputTokens":77,"ttl":"5m"}],"cacheReadInputTokenCount":1365,"cacheReadInputTokens":1365,"cacheWriteInputTokenCount":77,"cacheWriteInputTokens":77,"inputTokens":6,"outputTokens":27,"serverToolUsage":{},"totalTokens":1475}}6328 656
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 6023
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"What's the weather in Boston?"}],"role":"user"},{"content":[{"toolUse":{"input":{"location":"Boston, MA"},"name":"get_weather","toolUseId":"tooluse_1ncUndhOL9u3hhFVuhOwlP"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"{\"temperature\": 72, \"condition\": \"sunny\"}"}],"toolUseId":"tooluse_1ncUndhOL9u3hhFVuhOwlP"}}],"role":"user"},{"content":[{"text":"The weather in Boston, MA is currently sunny with a temperature of 72°F. It's a beautiful day!"},{"cachePoint":{"ttl":"5m","type":"default"}}],"role":"assistant"},{"content":[{"text":"What about New York?"},{"cachePoint":{"ttl":"5m","type":"default"}}],"role":"user"}],"system":[{"text":"BedrockConverseAutoCacheTest-v1: You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. "},{"cachePoint":{"ttl":"5m","type":"default"}}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"BedrockConverseAutoCacheTest-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","inputSchema":{"json":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}},"name":"get_weather"}}]}}HTTP/2.0 200 OK
+Content-Length: 491
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:48:51 GMT
+X-Amzn-Requestid: e7fb5f6b-35d0-4e8e-85c3-5bc916ba5fd3
+
+{"metrics":{"latencyMs":2392},"output":{"message":{"content":[{"toolUse":{"input":{"location":"New York, NY"},"name":"get_weather","toolUseId":"tooluse_aeSvV8u2CNRzTPCTwjgT4x","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheDetails":[{"inputTokens":38,"ttl":"5m"}],"cacheReadInputTokenCount":1442,"cacheReadInputTokens":1442,"cacheWriteInputTokenCount":38,"cacheWriteInputTokens":38,"inputTokens":3,"outputTokens":56,"serverToolUsage":{},"totalTokens":1539}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestAmazonAutomaticCachingLegacyAPI.httprr b/llms/bedrock/testdata/TestAmazonAutomaticCachingLegacyAPI.httprr
new file mode 100644
index 00000000..3368064b
--- /dev/null
+++ b/llms/bedrock/testdata/TestAmazonAutomaticCachingLegacyAPI.httprr
@@ -0,0 +1,62 @@
+httprr trace v1
+5644 861
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/invoke HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 5328
+Accept: */*
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"anthropic_version":"bedrock-2023-05-31","max_tokens":512,"system":"BedrockAutoCacheTest-v1: You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. ","messages":[{"role":"user","content":[{"type":"text","text":"What's the weather in Boston?"}]}],"tools":[{"name":"get_weather","description":"BedrockAutoCacheTest-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","input_schema":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}}]}HTTP/2.0 200 OK
+Content-Length: 479
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 12:08:21 GMT
+X-Amzn-Bedrock-Cache-Read-Input-Token-Count: 0
+X-Amzn-Bedrock-Cache-Write-Input-Token-Count: 0
+X-Amzn-Bedrock-Input-Token-Count: 1364
+X-Amzn-Bedrock-Invocation-Latency: 2316
+X-Amzn-Bedrock-Output-Token-Count: 55
+X-Amzn-Requestid: cac76811-ff21-4b4b-a4ab-b898881b8ac1
+
+{"model":"claude-sonnet-4-5-20250929","id":"msg_bdrk_018XN9z43PbbVj1CpSArUwwy","type":"message","role":"assistant","content":[{"type":"tool_use","id":"toolu_bdrk_018mXNtJeAPtSRUF5fA81SCg","name":"get_weather","input":{"location":"Boston, MA"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":1364,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":55}}6006 894
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/invoke HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 5690
+Accept: */*
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"anthropic_version":"bedrock-2023-05-31","max_tokens":512,"system":"BedrockAutoCacheTest-v1: You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. ","messages":[{"role":"user","content":[{"type":"text","text":"What's the weather in Boston?"}]},{"role":"assistant","content":[{"type":"tool_use","id":"toolu_bdrk_018mXNtJeAPtSRUF5fA81SCg","name":"get_weather","input":{"location":"Boston, MA"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_bdrk_018mXNtJeAPtSRUF5fA81SCg","content":"{\"temperature\": 72, \"condition\": \"sunny\"}","cache_control":{"type":"ephemeral","ttl":"5m"}}]}],"tools":[{"name":"get_weather","description":"BedrockAutoCacheTest-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","input_schema":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}}]}HTTP/2.0 200 OK
+Content-Length: 512
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 12:08:24 GMT
+X-Amzn-Bedrock-Cache-Read-Input-Token-Count: 0
+X-Amzn-Bedrock-Cache-Write-Input-Token-Count: 1438
+X-Amzn-Bedrock-Input-Token-Count: 6
+X-Amzn-Bedrock-Invocation-Latency: 2013
+X-Amzn-Bedrock-Output-Token-Count: 38
+X-Amzn-Requestid: e078dfdc-a32c-43e9-b857-ac78786862a8
+
+{"model":"claude-sonnet-4-5-20250929","id":"msg_bdrk_01N4Zp8XkWCrnmFY1rrCVdqx","type":"message","role":"assistant","content":[{"type":"text","text":"The current weather in Boston, MA is:\n- **Temperature**: 72°F\n- **Condition**: Sunny\n\nIt's a beautiful day in Boston!"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":6,"cache_creation_input_tokens":1438,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":1438,"ephemeral_1h_input_tokens":0},"output_tokens":38}}6261 868
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/invoke HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 5945
+Accept: */*
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"anthropic_version":"bedrock-2023-05-31","max_tokens":512,"system":"BedrockAutoCacheTest-v1: You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. You are a helpful assistant with access to weather capabilities. ","messages":[{"role":"user","content":[{"type":"text","text":"What's the weather in Boston?"}]},{"role":"assistant","content":[{"type":"tool_use","id":"toolu_bdrk_018mXNtJeAPtSRUF5fA81SCg","name":"get_weather","input":{"location":"Boston, MA"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_bdrk_018mXNtJeAPtSRUF5fA81SCg","content":"{\"temperature\": 72, \"condition\": \"sunny\"}"}]},{"role":"assistant","content":[{"type":"text","text":"The current weather in Boston, MA is:\n- **Temperature**: 72°F\n- **Condition**: Sunny\n\nIt's a beautiful day in Boston!","cache_control":{"type":"ephemeral","ttl":"5m"}}]},{"role":"user","content":[{"type":"text","text":"What about New York?"}]}],"tools":[{"name":"get_weather","description":"BedrockAutoCacheTest-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","input_schema":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}}]}HTTP/2.0 200 OK
+Content-Length: 484
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 12:08:28 GMT
+X-Amzn-Bedrock-Cache-Read-Input-Token-Count: 1438
+X-Amzn-Bedrock-Cache-Write-Input-Token-Count: 41
+X-Amzn-Bedrock-Input-Token-Count: 11
+X-Amzn-Bedrock-Invocation-Latency: 2445
+X-Amzn-Bedrock-Output-Token-Count: 56
+X-Amzn-Requestid: 4e835349-c4fe-45b3-9146-ceb02826a891
+
+{"model":"claude-sonnet-4-5-20250929","id":"msg_bdrk_01FpNQeFvCSh7SoJtHwPDP6d","type":"message","role":"assistant","content":[{"type":"tool_use","id":"toolu_bdrk_01G58eVVMGER3xvhAMk8ZaEu","name":"get_weather","input":{"location":"New York, NY"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":11,"cache_creation_input_tokens":41,"cache_read_input_tokens":1438,"cache_creation":{"ephemeral_5m_input_tokens":41,"ephemeral_1h_input_tokens":0},"output_tokens":56}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestAmazonMultiTurnCachingWithToolsConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonMultiTurnCachingWithToolsConverseAPI.httprr
new file mode 100644
index 00000000..86685c46
--- /dev/null
+++ b/llms/bedrock/testdata/TestAmazonMultiTurnCachingWithToolsConverseAPI.httprr
@@ -0,0 +1,58 @@
+httprr trace v1
+10113 602
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 9808
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"What's the weather in Boston?"}],"role":"user"}],"system":[{"text":"BedrockConverseCache-v1: You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. "}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"BedrockConverseCache-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","inputSchema":{"json":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}},"name":"get_weather"}},{"toolSpec":{"description":"BedrockConverseCache-v1: Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. ","inputSchema":{"json":{"properties":{"date":{"description":"Departure date","type":"string"},"destination":{"description":"Destination city","type":"string"}},"required":["destination","date"],"type":"object"}},"name":"book_flight"}}]}}HTTP/2.0 200 OK
+Content-Length: 437
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:48:25 GMT
+X-Amzn-Requestid: d9fc318c-4f76-41ad-bf53-bf56c7c38d58
+
+{"metrics":{"latencyMs":2319},"output":{"message":{"content":[{"toolUse":{"input":{"location":"Boston, MA"},"name":"get_weather","toolUseId":"tooluse_hLq2QJgO5f0H7WyOdLMyOx","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":2094,"outputTokens":55,"serverToolUsage":{},"totalTokens":2149}}10422 577
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 10116
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"What's the weather in Boston?"}],"role":"user"},{"content":[{"toolUse":{"input":{"location":"Boston, MA"},"name":"get_weather","toolUseId":"tooluse_hLq2QJgO5f0H7WyOdLMyOx"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"{\"temperature\": 72, \"condition\": \"sunny\"}"}],"toolUseId":"tooluse_hLq2QJgO5f0H7WyOdLMyOx"}}],"role":"user"}],"system":[{"text":"BedrockConverseCache-v1: You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. "}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"BedrockConverseCache-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","inputSchema":{"json":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}},"name":"get_weather"}},{"toolSpec":{"description":"BedrockConverseCache-v1: Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. ","inputSchema":{"json":{"properties":{"date":{"description":"Departure date","type":"string"},"destination":{"description":"Destination city","type":"string"}},"required":["destination","date"],"type":"object"}},"name":"book_flight"}}]}}HTTP/2.0 200 OK
+Content-Length: 412
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:48:29 GMT
+X-Amzn-Requestid: 67b89095-6b61-4a77-879c-3169194c331e
+
+{"metrics":{"latencyMs":2746},"output":{"message":{"content":[{"text":"The weather in Boston, MA is currently sunny with a temperature of 72°F. It's a beautiful day!"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":2174,"outputTokens":27,"serverToolUsage":{},"totalTokens":2201}}10777 908
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 10471
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"What's the weather in Boston?"}],"role":"user"},{"content":[{"toolUse":{"input":{"location":"Boston, MA"},"name":"get_weather","toolUseId":"tooluse_hLq2QJgO5f0H7WyOdLMyOx"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"{\"temperature\": 72, \"condition\": \"sunny\"}"}],"toolUseId":"tooluse_hLq2QJgO5f0H7WyOdLMyOx"}}],"role":"user"},{"content":[{"text":"The weather in Boston, MA is currently sunny with a temperature of 72°F. It's a beautiful day!"},{"cachePoint":{"ttl":"5m","type":"default"}}],"role":"assistant"},{"content":[{"text":"Now book a flight to Boston for tomorrow"},{"cachePoint":{"ttl":"5m","type":"default"}}],"role":"user"}],"system":[{"text":"BedrockConverseCache-v1: You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. "},{"cachePoint":{"ttl":"5m","type":"default"}}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"BedrockConverseCache-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","inputSchema":{"json":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}},"name":"get_weather"}},{"toolSpec":{"description":"BedrockConverseCache-v1: Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. ","inputSchema":{"json":{"properties":{"date":{"description":"Departure date","type":"string"},"destination":{"description":"Destination city","type":"string"}},"required":["destination","date"],"type":"object"}},"name":"book_flight"}}]}}HTTP/2.0 200 OK
+Content-Length: 743
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:48:33 GMT
+X-Amzn-Requestid: cbcb4f5a-6d35-4121-9061-5c1a4bc8dad5
+
+{"metrics":{"latencyMs":3199},"output":{"message":{"content":[{"text":"I can help you book a flight to Boston for tomorrow! However, I need a bit more information:\n\n1. **Where are you departing from?** (Which city will you be flying from?)\n2. **What is tomorrow's date?** (Please provide the specific date in a format like \"2024-01-15\" or \"January 15, 2024\")\n\nOnce you provide these details, I'll be able to book your flight to Boston."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheDetails":[{"inputTokens":2209,"ttl":"5m"}],"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":2209,"cacheWriteInputTokens":2209,"inputTokens":3,"outputTokens":102,"serverToolUsage":{},"totalTokens":2314}}11317 675
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 11011
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"What's the weather in Boston?"}],"role":"user"},{"content":[{"toolUse":{"input":{"location":"Boston, MA"},"name":"get_weather","toolUseId":"tooluse_hLq2QJgO5f0H7WyOdLMyOx"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"{\"temperature\": 72, \"condition\": \"sunny\"}"}],"toolUseId":"tooluse_hLq2QJgO5f0H7WyOdLMyOx"}}],"role":"user"},{"content":[{"text":"The weather in Boston, MA is currently sunny with a temperature of 72°F. It's a beautiful day!"},{"cachePoint":{"ttl":"5m","type":"default"}}],"role":"assistant"},{"content":[{"text":"Now book a flight to Boston for tomorrow"}],"role":"user"},{"content":[{"text":"I can help you book a flight to Boston for tomorrow! However, I need a bit more information:\n\n1. **Where are you departing from?** (Which city will you be flying from?)\n2. **What is tomorrow's date?** (Please provide the specific date in a format like \"2024-01-15\" or \"January 15, 2024\")\n\nOnce you provide these details, I'll be able to book your flight to Boston."},{"cachePoint":{"ttl":"5m","type":"default"}}],"role":"assistant"},{"content":[{"text":"I'm flying from New York on March 4th"},{"cachePoint":{"ttl":"5m","type":"default"}}],"role":"user"}],"system":[{"text":"BedrockConverseCache-v1: You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. "},{"cachePoint":{"ttl":"5m","type":"default"}}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"BedrockConverseCache-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","inputSchema":{"json":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}},"name":"get_weather"}},{"toolSpec":{"description":"BedrockConverseCache-v1: Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. ","inputSchema":{"json":{"properties":{"date":{"description":"Departure date","type":"string"},"destination":{"description":"Destination city","type":"string"}},"required":["destination","date"],"type":"object"}},"name":"book_flight"}}]}}HTTP/2.0 200 OK
+Content-Length: 510
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:48:37 GMT
+X-Amzn-Requestid: 0ba50972-8c2f-433a-8e35-e53445779aa2
+
+{"metrics":{"latencyMs":2462},"output":{"message":{"content":[{"toolUse":{"input":{"destination":"Boston","date":"March 4th"},"name":"book_flight","toolUseId":"tooluse_IAcLRbQIVFWWhNj83mN6vM","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheDetails":[{"inputTokens":116,"ttl":"5m"}],"cacheReadInputTokenCount":2209,"cacheReadInputTokens":2209,"cacheWriteInputTokenCount":116,"cacheWriteInputTokens":116,"inputTokens":3,"outputTokens":73,"serverToolUsage":{},"totalTokens":2401}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestAmazonMultiTurnCachingWithToolsLegacyAPI.httprr b/llms/bedrock/testdata/TestAmazonMultiTurnCachingWithToolsLegacyAPI.httprr
new file mode 100644
index 00000000..580b5940
--- /dev/null
+++ b/llms/bedrock/testdata/TestAmazonMultiTurnCachingWithToolsLegacyAPI.httprr
@@ -0,0 +1,82 @@
+httprr trace v1
+10055 861
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/invoke HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 9739
+Accept: */*
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"anthropic_version":"bedrock-2023-05-31","max_tokens":512,"system":"BedrockCacheTest-v1: You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. ","messages":[{"role":"user","content":[{"type":"text","text":"What's the weather in Boston?"}]}],"tools":[{"name":"get_weather","description":"BedrockCacheTest-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","input_schema":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}},{"name":"book_flight","description":"BedrockCacheTest-v1: Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. ","input_schema":{"properties":{"date":{"description":"Departure date","type":"string"},"destination":{"description":"Destination city","type":"string"}},"required":["destination","date"],"type":"object"}}]}HTTP/2.0 200 OK
+Content-Length: 479
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 10:53:28 GMT
+X-Amzn-Bedrock-Cache-Read-Input-Token-Count: 0
+X-Amzn-Bedrock-Cache-Write-Input-Token-Count: 0
+X-Amzn-Bedrock-Input-Token-Count: 2094
+X-Amzn-Bedrock-Invocation-Latency: 2115
+X-Amzn-Bedrock-Output-Token-Count: 55
+X-Amzn-Requestid: 388e09c9-86d6-4067-baa6-c16f06bc5ff6
+
+{"model":"claude-sonnet-4-5-20250929","id":"msg_bdrk_013Z93U34yWxKWQeVwArGst6","type":"message","role":"assistant","content":[{"type":"tool_use","id":"toolu_bdrk_015MyHjGcqrBnR6psxATkrZb","name":"get_weather","input":{"location":"Boston, MA"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":2094,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":55}}10370 860
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/invoke HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 10053
+Accept: */*
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"anthropic_version":"bedrock-2023-05-31","max_tokens":512,"system":"BedrockCacheTest-v1: You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. ","messages":[{"role":"user","content":[{"type":"text","text":"What's the weather in Boston?"}]},{"role":"assistant","content":[{"type":"tool_use","id":"toolu_bdrk_015MyHjGcqrBnR6psxATkrZb","name":"get_weather","input":{"location":"Boston, MA"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_bdrk_015MyHjGcqrBnR6psxATkrZb","content":"{\"temperature\": 72, \"condition\": \"sunny\"}"}]}],"tools":[{"name":"get_weather","description":"BedrockCacheTest-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","input_schema":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}},{"name":"book_flight","description":"BedrockCacheTest-v1: Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. ","input_schema":{"properties":{"date":{"description":"Departure date","type":"string"},"destination":{"description":"Destination city","type":"string"}},"required":["destination","date"],"type":"object"}}]}HTTP/2.0 200 OK
+Content-Length: 478
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 10:53:31 GMT
+X-Amzn-Bedrock-Cache-Read-Input-Token-Count: 0
+X-Amzn-Bedrock-Cache-Write-Input-Token-Count: 0
+X-Amzn-Bedrock-Input-Token-Count: 2174
+X-Amzn-Bedrock-Invocation-Latency: 1951
+X-Amzn-Bedrock-Output-Token-Count: 25
+X-Amzn-Requestid: dac236d6-593c-4196-871b-e02d0745a796
+
+{"model":"claude-sonnet-4-5-20250929","id":"msg_bdrk_01M8DgnwHAG4oGhYnpP2heEr","type":"message","role":"assistant","content":[{"type":"text","text":"The weather in Boston is currently sunny with a temperature of 72°F. It's a beautiful day!"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":2174,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":25}}10662 1140
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/invoke HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 10345
+Accept: */*
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"anthropic_version":"bedrock-2023-05-31","max_tokens":512,"system":"BedrockCacheTest-v1: You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. ","messages":[{"role":"user","content":[{"type":"text","text":"What's the weather in Boston?"}]},{"role":"assistant","content":[{"type":"tool_use","id":"toolu_bdrk_015MyHjGcqrBnR6psxATkrZb","name":"get_weather","input":{"location":"Boston, MA"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_bdrk_015MyHjGcqrBnR6psxATkrZb","content":"{\"temperature\": 72, \"condition\": \"sunny\"}"}]},{"role":"assistant","content":[{"type":"text","text":"The weather in Boston is currently sunny with a temperature of 72°F. It's a beautiful day!","cache_control":{"type":"ephemeral","ttl":"5m"}}]},{"role":"user","content":[{"type":"text","text":"Now book a flight to Boston for tomorrow"}]}],"tools":[{"name":"get_weather","description":"BedrockCacheTest-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","input_schema":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}},{"name":"book_flight","description":"BedrockCacheTest-v1: Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. ","input_schema":{"properties":{"date":{"description":"Departure date","type":"string"},"destination":{"description":"Destination city","type":"string"}},"required":["destination","date"],"type":"object"}}]}HTTP/2.0 200 OK
+Content-Length: 756
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 10:53:35 GMT
+X-Amzn-Bedrock-Cache-Read-Input-Token-Count: 0
+X-Amzn-Bedrock-Cache-Write-Input-Token-Count: 2196
+X-Amzn-Bedrock-Input-Token-Count: 14
+X-Amzn-Bedrock-Invocation-Latency: 2659
+X-Amzn-Bedrock-Output-Token-Count: 101
+X-Amzn-Requestid: 2c4b3131-e5d6-47df-8b1c-560c06e1cbed
+
+{"model":"claude-sonnet-4-5-20250929","id":"msg_bdrk_01QxskBAVjdmbAbTbYipD8gK","type":"message","role":"assistant","content":[{"type":"text","text":"I can help you book a flight to Boston for tomorrow! However, I need a bit more information:\n\n1. **Where are you departing from?** (Which city will you be flying from?)\n2. **What is tomorrow's date?** (Please provide the date in a format like \"2024-01-15\" or \"January 15, 2024\")\n\nOnce you provide these details, I'll be able to book your flight to Boston."}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":14,"cache_creation_input_tokens":2196,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":2196,"ephemeral_1h_input_tokens":0},"output_tokens":101}}11224 887
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/invoke HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 10907
+Accept: */*
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"anthropic_version":"bedrock-2023-05-31","max_tokens":512,"system":"BedrockCacheTest-v1: You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. You are a helpful assistant with access to weather and flight booking capabilities. ","messages":[{"role":"user","content":[{"type":"text","text":"What's the weather in Boston?"}]},{"role":"assistant","content":[{"type":"tool_use","id":"toolu_bdrk_015MyHjGcqrBnR6psxATkrZb","name":"get_weather","input":{"location":"Boston, MA"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_bdrk_015MyHjGcqrBnR6psxATkrZb","content":"{\"temperature\": 72, \"condition\": \"sunny\"}"}]},{"role":"assistant","content":[{"type":"text","text":"The weather in Boston is currently sunny with a temperature of 72°F. It's a beautiful day!","cache_control":{"type":"ephemeral","ttl":"5m"}}]},{"role":"user","content":[{"type":"text","text":"Now book a flight to Boston for tomorrow"}]},{"role":"assistant","content":[{"type":"text","text":"I can help you book a flight to Boston for tomorrow! However, I need a bit more information:\n\n1. **Where are you departing from?** (Which city will you be flying from?)\n2. **What is tomorrow's date?** (Please provide the date in a format like \"2024-01-15\" or \"January 15, 2024\")\n\nOnce you provide these details, I'll be able to book your flight to Boston.","cache_control":{"type":"ephemeral","ttl":"5m"}}]},{"role":"user","content":[{"type":"text","text":"I'm flying from New York on March 4th"}]}],"tools":[{"name":"get_weather","description":"BedrockCacheTest-v1: Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. Get current weather conditions including temperature, humidity, wind speed, and precipitation for a specified geographic location. ","input_schema":{"properties":{"location":{"description":"City and state, e.g. San Francisco, CA","type":"string"}},"required":["location"],"type":"object"}},{"name":"book_flight","description":"BedrockCacheTest-v1: Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. Book airline tickets for domestic and international flights with flexible options for departure, arrival, and passenger details. ","input_schema":{"properties":{"date":{"description":"Departure date","type":"string"},"destination":{"description":"Destination city","type":"string"}},"required":["destination","date"],"type":"object"}}]}HTTP/2.0 200 OK
+Content-Length: 502
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 10:53:38 GMT
+X-Amzn-Bedrock-Cache-Read-Input-Token-Count: 2196
+X-Amzn-Bedrock-Cache-Write-Input-Token-Count: 112
+X-Amzn-Bedrock-Input-Token-Count: 17
+X-Amzn-Bedrock-Invocation-Latency: 2206
+X-Amzn-Bedrock-Output-Token-Count: 73
+X-Amzn-Requestid: bda25e46-e221-4954-9598-8284ab448118
+
+{"model":"claude-sonnet-4-5-20250929","id":"msg_bdrk_01B5RXNL3fFzZ3332PaVGv4N","type":"message","role":"assistant","content":[{"type":"tool_use","id":"toolu_bdrk_0171AVgL1Nu48z6YsefT1HCa","name":"book_flight","input":{"destination":"Boston","date":"March 4th"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":17,"cache_creation_input_tokens":112,"cache_read_input_tokens":2196,"cache_creation":{"ephemeral_5m_input_tokens":112,"ephemeral_1h_input_tokens":0},"output_tokens":73}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestAnthropicNovaImage.httprr b/llms/bedrock/testdata/TestAmazonNovaImage.httprr
similarity index 100%
rename from llms/bedrock/testdata/TestAnthropicNovaImage.httprr
rename to llms/bedrock/testdata/TestAmazonNovaImage.httprr
diff --git a/llms/bedrock/testdata/TestAmazonOutputConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonOutputConverseAPI.httprr
index ac1f559a..7f13cd26 100644
--- a/llms/bedrock/testdata/TestAmazonOutputConverseAPI.httprr
+++ b/llms/bedrock/testdata/TestAmazonOutputConverseAPI.httprr
@@ -1,5 +1,5 @@
httprr trace v1
-451 444
+451 451
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/ai21.jamba-1-5-large-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -8,12 +8,12 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 279
+Content-Length: 286
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:22 GMT
-X-Amzn-Requestid: 7438eab0-66e9-48f2-972c-4f4219444a01
+Date: Tue, 03 Mar 2026 15:43:20 GMT
+X-Amzn-Requestid: 04655bfd-c846-406d-99b9-80edc7da35fa
-{"metrics":{"latencyMs":458},"output":{"message":{"content":[{"text":" Artificial intelligence mimics human intelligence using data and algorithms."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":25,"outputTokens":12,"serverToolUsage":{},"totalTokens":37}}450 442
+{"metrics":{"latencyMs":512},"output":{"message":{"content":[{"text":" AI: Machines simulating human intelligence for problem-solving and decision-making."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":25,"outputTokens":17,"serverToolUsage":{},"totalTokens":42}}450 432
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/ai21.jamba-1-5-mini-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -22,12 +22,12 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 277
+Content-Length: 267
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:24 GMT
-X-Amzn-Requestid: 7770c26e-0d01-44da-bc12-f7dd212a9c57
+Date: Tue, 03 Mar 2026 15:43:26 GMT
+X-Amzn-Requestid: cba8a010-27b9-4abb-b742-869b7afc9def
-{"metrics":{"latencyMs":580},"output":{"message":{"content":[{"text":" Intelligent systems mimicking human cognition through algorithms and data."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":25,"outputTokens":12,"serverToolUsage":{},"totalTokens":37}}452 428
+{"metrics":{"latencyMs":323},"output":{"message":{"content":[{"text":" Intelligent systems that learn and make decisions based on data."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":25,"outputTokens":12,"serverToolUsage":{},"totalTokens":37}}452 428
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-2-lite-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -38,10 +38,10 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
Content-Length: 263
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:26 GMT
-X-Amzn-Requestid: 03e7df3e-4308-4837-a629-4741cc48f0d2
+Date: Tue, 03 Mar 2026 15:43:33 GMT
+X-Amzn-Requestid: 16890f48-08aa-41e2-8552-f2c67918f4d8
-{"metrics":{"latencyMs":432},"output":{"message":{"content":[{"text":"AI mimics human intelligence through learning and adaptation."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":61,"outputTokens":12,"serverToolUsage":{},"totalTokens":73}}453 427
+{"metrics":{"latencyMs":493},"output":{"message":{"content":[{"text":"AI mimics human intelligence through learning and adaptation."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":61,"outputTokens":12,"serverToolUsage":{},"totalTokens":73}}453 424
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-premier-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -50,12 +50,12 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 262
+Content-Length: 259
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:27 GMT
-X-Amzn-Requestid: d616dfaf-471d-44a5-b0b7-3fdb52948d67
+Date: Tue, 03 Mar 2026 15:43:39 GMT
+X-Amzn-Requestid: 1592bd01-57b7-4d34-9a18-fb55789064a2
-{"metrics":{"latencyMs":556},"output":{"message":{"content":[{"text":"AI mimics human intelligence using computers and algorithms."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":50,"outputTokens":10,"serverToolUsage":{},"totalTokens":60}}449 428
+{"metrics":{"latencyMs":523},"output":{"message":{"content":[{"text":"AI mimics human intelligence using machines and software."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":50,"outputTokens":10,"serverToolUsage":{},"totalTokens":60}}449 434
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-pro-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -64,12 +64,12 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 263
+Content-Length: 269
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:29 GMT
-X-Amzn-Requestid: ee4cd39b-c3b4-41bd-81c1-8e47a5a1e26a
+Date: Tue, 03 Mar 2026 15:43:46 GMT
+X-Amzn-Requestid: 1a9812f8-ed5c-4626-b548-6bf8e26508de
-{"metrics":{"latencyMs":900},"output":{"message":{"content":[{"text":"AI: intelligent machines learning from data, aiding humanity."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":16,"outputTokens":12,"serverToolUsage":{},"totalTokens":28}}450 379
+{"metrics":{"latencyMs":417},"output":{"message":{"content":[{"text":"Machine intelligence mimicking human cognition and decision-making."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":16,"outputTokens":11,"serverToolUsage":{},"totalTokens":27}}450 486
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-lite-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -78,12 +78,12 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 214
+Content-Length: 321
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:31 GMT
-X-Amzn-Requestid: 09d1e774-adff-4a6d-af33-dacba8cd2cb5
+Date: Tue, 03 Mar 2026 15:43:53 GMT
+X-Amzn-Requestid: 4f1d251a-d3a6-48ba-8971-deaf3babdd43
-{"metrics":{"latencyMs":325},"output":{"message":{"content":[{"text":"Not possible."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":16,"outputTokens":4,"serverToolUsage":{},"totalTokens":20}}451 409
+{"metrics":{"latencyMs":496},"output":{"message":{"content":[{"text":"Complex, transformative, intelligent, adaptive, evolving, data-driven, autonomous, cognitive, revolutionary, impactful."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":16,"outputTokens":23,"serverToolUsage":{},"totalTokens":39}}451 412
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-micro-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -92,13 +92,13 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 244
+Content-Length: 247
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:32 GMT
-X-Amzn-Requestid: ab32e805-3672-4f3e-a8dd-3874b00d4c00
+Date: Tue, 03 Mar 2026 15:43:59 GMT
+X-Amzn-Requestid: f2f1d7b1-a5be-4008-bae3-c8cf95cb4b44
-{"metrics":{"latencyMs":256},"output":{"message":{"content":[{"text":"AI mimics human thinking to solve problems."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":16,"outputTokens":9,"serverToolUsage":{},"totalTokens":25}}468 546
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-5-20251101-v1%3A0/converse HTTP/1.1
+{"metrics":{"latencyMs":418},"output":{"message":{"content":[{"text":"Machines learning from data to make decisions."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":16,"outputTokens":9,"serverToolUsage":{},"totalTokens":25}}455 546
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-6-v1/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
Content-Length: 166
@@ -108,10 +108,38 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
Content-Length: 381
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:38 GMT
-X-Amzn-Requestid: 48239999-d9d4-4687-998c-75b36e7207b1
+Date: Tue, 03 Mar 2026 15:44:07 GMT
+X-Amzn-Requestid: e70f40d6-0fbf-40b1-8e87-d35e26abbc5a
-{"metrics":{"latencyMs":4809},"output":{"message":{"content":[{"text":"AI: Machines learning to perform tasks requiring human intelligence."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":15,"serverToolUsage":{},"totalTokens":39}}469 534
+{"metrics":{"latencyMs":1975},"output":{"message":{"content":[{"text":"Machines learning to think, decide, and solve problems autonomously."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":25,"outputTokens":17,"serverToolUsage":{},"totalTokens":42}}454 541
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-6/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 376
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:44:15 GMT
+X-Amzn-Requestid: ab454da7-ab07-45cf-88f1-f6691989d084
+
+{"metrics":{"latencyMs":1321},"output":{"message":{"content":[{"text":"**AI: machines learning to think, decide, and solve problems.**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":25,"outputTokens":17,"serverToolUsage":{},"totalTokens":42}}468 537
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-5-20251101-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 372
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:44:23 GMT
+X-Amzn-Requestid: 786f9a95-2326-4dc5-aa90-88d9a98844d2
+
+{"metrics":{"latencyMs":2127},"output":{"message":{"content":[{"text":"AI: Machines learning to think, reason, and solve problems."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":17,"serverToolUsage":{},"totalTokens":41}}469 534
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-haiku-4-5-20251001-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -122,10 +150,10 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
Content-Length: 369
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:40 GMT
-X-Amzn-Requestid: fce386f3-99dc-4bc5-8e26-d601be2ce18d
+Date: Tue, 03 Mar 2026 15:44:30 GMT
+X-Amzn-Requestid: 7eb4d70c-6229-4ded-a260-22a68215e3be
-{"metrics":{"latencyMs":695},"output":{"message":{"content":[{"text":"Machines learning patterns to make intelligent decisions."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":12,"serverToolUsage":{},"totalTokens":36}}470 544
+{"metrics":{"latencyMs":1005},"output":{"message":{"content":[{"text":"Machines learning patterns to perform intelligent tasks."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":12,"serverToolUsage":{},"totalTokens":36}}470 543
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -134,12 +162,12 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 379
+Content-Length: 378
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:44 GMT
-X-Amzn-Requestid: b4a51cca-78a1-4578-9534-2de0c39e56e7
+Date: Tue, 03 Mar 2026 15:44:38 GMT
+X-Amzn-Requestid: 60fb3af7-b5e7-486b-a03e-aeea6ea2d772
-{"metrics":{"latencyMs":2773},"output":{"message":{"content":[{"text":"AI: machines that learn, reason, and solve problems intelligently."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":17,"serverToolUsage":{},"totalTokens":41}}468 546
+{"metrics":{"latencyMs":1888},"output":{"message":{"content":[{"text":"AI: machines learning patterns to make decisions and predictions."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":14,"serverToolUsage":{},"totalTokens":38}}468 546
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-1-20250805-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -150,24 +178,10 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
Content-Length: 381
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:49 GMT
-X-Amzn-Requestid: 5555b23d-2a06-413a-b8ab-4a5766cbd873
+Date: Tue, 03 Mar 2026 15:44:48 GMT
+X-Amzn-Requestid: f920bd52-15c8-4a5e-9cac-c2ee1d0663f1
-{"metrics":{"latencyMs":3557},"output":{"message":{"content":[{"text":"Machines learning patterns from data to perform tasks intelligently."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":15,"serverToolUsage":{},"totalTokens":39}}466 549
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-20250514-v1%3A0/converse HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 166
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 384
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:53 GMT
-X-Amzn-Requestid: 52cc7114-2cd5-4f39-b8d2-0cd91897a87d
-
-{"metrics":{"latencyMs":3612},"output":{"message":{"content":[{"text":"Machines learning patterns from data to make predictions and decisions."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":15,"serverToolUsage":{},"totalTokens":39}}468 541
+{"metrics":{"latencyMs":3803},"output":{"message":{"content":[{"text":"Machines learning patterns from data to perform tasks intelligently."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":15,"serverToolUsage":{},"totalTokens":39}}468 551
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-20250514-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -175,41 +189,27 @@ Content-Length: 166
Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 376
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:56 GMT
-X-Amzn-Requestid: 541a16a6-f1ca-4c44-8eea-a2199e7bcc45
-
-{"metrics":{"latencyMs":1719},"output":{"message":{"content":[{"text":"Machines that learn patterns to make decisions and predictions."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":14,"serverToolUsage":{},"totalTokens":38}}470 564
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-3-7-sonnet-20250219-v1%3A0/converse HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 166
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 399
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:17:58 GMT
-X-Amzn-Requestid: f96ceeb1-f207-4b80-951f-36ed63a43874
-
-{"metrics":{"latencyMs":878},"output":{"message":{"content":[{"text":"AI: Computer systems mimicking human intelligence through learning and decision-making."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":18,"serverToolUsage":{},"totalTokens":42}}469 551
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-3-5-haiku-20241022-v1%3A0/converse HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 166
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
Content-Length: 386
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:18:01 GMT
-X-Amzn-Requestid: 82864f82-2ab1-4066-9a5b-9ce4897f2e99
+Date: Tue, 03 Mar 2026 15:44:57 GMT
+X-Amzn-Requestid: 68d35b70-5b56-4d54-99c9-7a877062d70c
-{"metrics":{"latencyMs":966},"output":{"message":{"content":[{"text":"Machines learning and making decisions like intelligent, thinking systems."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":15,"serverToolUsage":{},"totalTokens":39}}447 424
+{"metrics":{"latencyMs":2190},"output":{"message":{"content":[{"text":"Computer systems that mimic human thinking and decision-making abilities."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":16,"serverToolUsage":{},"totalTokens":40}}469 535
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-3-5-haiku-20241022-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 370
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:45:04 GMT
+X-Amzn-Requestid: 07d7cd57-2880-4d10-83c4-fdf13d51709e
+
+{"metrics":{"latencyMs":885},"output":{"message":{"content":[{"text":"Machines learning to think and solve problems like humans."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":24,"outputTokens":14,"serverToolUsage":{},"totalTokens":38}}447 454
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/cohere.command-r-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -218,12 +218,12 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 259
+Content-Length: 289
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:18:02 GMT
-X-Amzn-Requestid: 5e2b4f8a-b101-42ce-91cd-e84c7f2afce5
+Date: Tue, 03 Mar 2026 15:45:10 GMT
+X-Amzn-Requestid: 9c11e78a-9a29-450e-8111-94e2b0c07026
-{"metrics":{"latencyMs":206},"output":{"message":{"content":[{"text":"AI is the intelligence exhibited by machines or software."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":16,"outputTokens":10,"serverToolUsage":{},"totalTokens":26}}452 430
+{"metrics":{"latencyMs":280},"output":{"message":{"content":[{"text":"AI is the simulation of human intelligence in machines programmed to think like humans."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":16,"outputTokens":15,"serverToolUsage":{},"totalTokens":31}}452 422
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/cohere.command-r-plus-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -232,12 +232,12 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 265
+Content-Length: 257
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:18:03 GMT
-X-Amzn-Requestid: 78373a09-9cba-46c8-beb0-02e09582d533
+Date: Tue, 03 Mar 2026 15:45:17 GMT
+X-Amzn-Requestid: d4040238-b2db-4fa2-8f97-939eddd4fa6c
-{"metrics":{"latencyMs":347},"output":{"message":{"content":[{"text":"AI is intelligent automation with machine learning capabilities."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":16,"outputTokens":9,"serverToolUsage":{},"totalTokens":25}}460 390
+{"metrics":{"latencyMs":375},"output":{"message":{"content":[{"text":"AI is the simulation of human intelligence by machines."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":16,"outputTokens":10,"serverToolUsage":{},"totalTokens":26}}460 390
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.meta.llama3-3-70b-instruct-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -248,10 +248,10 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
Content-Length: 225
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:18:05 GMT
-X-Amzn-Requestid: 67d109c5-1970-4f20-9b0e-755b0929a512
+Date: Tue, 03 Mar 2026 15:45:23 GMT
+X-Amzn-Requestid: 6fa697c4-75d7-4f06-b649-4c43177b8bb8
-{"metrics":{"latencyMs":236},"output":{"message":{"content":[{"text":"Artificial Intelligence."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":51,"outputTokens":5,"serverToolUsage":{},"totalTokens":56}}460 438
+{"metrics":{"latencyMs":217},"output":{"message":{"content":[{"text":"Artificial Intelligence."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":51,"outputTokens":5,"serverToolUsage":{},"totalTokens":56}}460 438
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.meta.llama3-1-70b-instruct-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -262,10 +262,10 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
Content-Length: 273
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:18:07 GMT
-X-Amzn-Requestid: 3c114bc2-f0d3-44ff-b09c-6a98b810b0e9
+Date: Tue, 03 Mar 2026 15:45:30 GMT
+X-Amzn-Requestid: 61c063ca-c56e-4498-bfbd-14a0a3051706
-{"metrics":{"latencyMs":848},"output":{"message":{"content":[{"text":"\n\nArtificial Intelligence: Machines that think and learn like humans."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":30,"outputTokens":14,"serverToolUsage":{},"totalTokens":44}}455 432
+{"metrics":{"latencyMs":938},"output":{"message":{"content":[{"text":"\n\nArtificial Intelligence: Machines that think and learn like humans."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":30,"outputTokens":14,"serverToolUsage":{},"totalTokens":44}}455 428
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/meta.llama3-70b-instruct-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -274,12 +274,12 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 267
+Content-Length: 263
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:18:08 GMT
-X-Amzn-Requestid: 875c5ef7-2d76-484b-9c6b-38e953a1484c
+Date: Tue, 03 Mar 2026 15:45:37 GMT
+X-Amzn-Requestid: 0e4760b6-825c-4547-a5f6-44c71cbdbbf6
-{"metrics":{"latencyMs":480},"output":{"message":{"content":[{"text":"\n\nIntelligent machines that learn, reason, and act like humans."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":30,"outputTokens":15,"serverToolUsage":{},"totalTokens":45}}454 438
+{"metrics":{"latencyMs":435},"output":{"message":{"content":[{"text":"\n\nIntelligent machines that think and learn like humans do."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":30,"outputTokens":13,"serverToolUsage":{},"totalTokens":43}}454 438
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/meta.llama3-8b-instruct-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -290,10 +290,10 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
Content-Length: 273
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:18:10 GMT
-X-Amzn-Requestid: 34dfd385-4249-46a0-9a81-585036091fcb
+Date: Tue, 03 Mar 2026 15:45:43 GMT
+X-Amzn-Requestid: 6c6a53ba-9b53-4980-9e9e-462ce9043b2e
-{"metrics":{"latencyMs":278},"output":{"message":{"content":[{"text":"\n\nArtificial intelligence: machines that think and learn like humans."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":30,"outputTokens":14,"serverToolUsage":{},"totalTokens":44}}445 2633
+{"metrics":{"latencyMs":251},"output":{"message":{"content":[{"text":"\n\nArtificial Intelligence: Machines that think and learn like humans."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":30,"outputTokens":14,"serverToolUsage":{},"totalTokens":44}}445 2382
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.deepseek.r1-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -302,9 +302,219 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
-Content-Length: 2467
+Content-Length: 2216
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:18:14 GMT
-X-Amzn-Requestid: d7bf9ada-1134-4601-a654-f4ac83794262
+Date: Tue, 03 Mar 2026 15:45:52 GMT
+X-Amzn-Requestid: 96e5d6f1-86ed-40e2-a46f-0b405012ae74
-{"metrics":{"latencyMs":2904},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"text":"Okay, the user wants me to explain AI in 10 words or less. Let me start by recalling what AI stands for. AI is Artificial Intelligence, which involves machines simulating human intelligence. But how to condense that into a concise definition?\n\nI need to capture the essence: machines performing tasks that typically require human intelligence. Maybe words like \"machines,\" \"mimic,\" \"human intelligence,\" \"tasks.\" Let me count. \"Machines mimicking human intelligence to perform tasks.\" That's 8 words. Perfect. But wait, does that cover learning and problem-solving? Maybe \"machines simulating human intelligence to solve problems.\" Hmm, \"simulating\" might be better than \"mimicking.\" Let me check synonyms. \"Imitate,\" \"replicate,\" \"emulate.\" \"Simulating\" is accurate. \n\nAlternatively, \"Computer systems performing tasks requiring human intelligence.\" That's 9 words. But \"computer systems\" might be too narrow. AI can be in robots, software, etc. \"Machines\" is broader. Also, should I include learning? Maybe \"Machines learning and performing human-like tasks.\" But that's 8 words. \"Learning\" is a key aspect. However, the original answer I thought of was \"Machines simulating human intelligence to perform tasks.\" That's concise and covers the main points. Let me verify the word count. 1. Machines 2. simulating 3. human 4. intelligence 5. to 6. perform 7. tasks. Seven words. Wait, that's only seven. Did I miscount earlier? Let me check again. \"Machines mimicking human intelligence to perform tasks.\" That's 8 words. Hmm, maybe the user's example answer is different. Wait, the user's example answer is \"Machines simulating human intelligence to perform tasks.\" Let me count again. Machines (1), simulating (2), human (3), intelligence (4), to (5), perform (6), tasks (7). So seven words. But the user asked for 10 words or less. So that's acceptable. But maybe the user's example answer was different. Wait, in the initial prompt, the user's example answer is \"Explain AI in 10 words or less. AI: Machines simulating human intelligence to perform tasks.\" So that's 7 words. So the user's example answer is 7 words. So the answer is correct. But maybe I can make it even"}}}],"role":"assistant"}},"stopReason":"max_tokens","usage":{"inputTokens":20,"outputTokens":508,"serverToolUsage":{},"totalTokens":528}}
\ No newline at end of file
+{"metrics":{"latencyMs":3015},"output":{"message":{"content":[{"text":"\n\nAI: Computer systems performing tasks requiring human intelligence."},{"reasoningContent":{"reasoningText":{"text":"Okay, the user wants me to explain AI in 10 words or less. Let me start by recalling what AI actually is. AI stands for Artificial Intelligence, which involves machines simulating human intelligence. But how to condense that into a concise definition?\n\nHmm, maybe focus on the core aspects: machines performing tasks that typically require human intelligence. But that's a bit long. Let me count the words. \"Machines performing tasks requiring human intelligence.\" That's 7 words. Good, but maybe \"simulating\" instead of \"performing\"? \"Machines simulating human intelligence to perform tasks.\" Still 8 words. Maybe \"Systems that mimic human intelligence to solve problems.\" 10 words exactly. Wait, \"mimic\" might not be the best term. Some people argue AI doesn't mimic but uses different methods. Maybe \"Systems designed to think and learn like humans.\" But that's 10 words. Alternatively, \"Computer systems performing tasks needing human intelligence.\" 9 words. Maybe add \"learning\" in there. \"Machines learning and performing human-like tasks intelligently.\" 9 words. Or \"Technology enabling machines to think and act intelligently.\" 9 words. The user might want to include aspects like learning, problem-solving, decision-making. How about \"AI: Machines designed to learn, reason, and act autonomously.\" 10 words. That works. Let me check synonyms. \"Autonomously\" might be better than \"intelligently.\" Alternatively, \"AI simulates human intelligence in machines to solve problems.\" 10 words. But \"simulates\" is accurate. Another angle: \"Computer systems that can perform tasks requiring human intelligence.\" 10 words. That's from the standard definition. Yeah, that's solid. Let me confirm the word count. \"Computer systems that perform tasks requiring human intelligence.\" 10 words. Perfect. That's concise and covers the essence without jargon.\n"}}}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":20,"outputTokens":404,"serverToolUsage":{},"totalTokens":424}}437 440
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/deepseek.v3.2/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 275
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:46:00 GMT
+X-Amzn-Requestid: 07a9b8cf-030a-4817-aced-a7b1267f5414
+
+{"metrics":{"latencyMs":1656},"output":{"message":{"content":[{"text":"AI is machines performing tasks that usually require human intelligence."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":19,"outputTokens":12,"serverToolUsage":{},"totalTokens":31}}449 1049
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/openai.gpt-oss-120b-1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 884
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:46:07 GMT
+X-Amzn-Requestid: d95bb073-8439-45b2-8460-c18735dcc616
+
+{"metrics":{"latencyMs":601},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"text":"We need to answer: \"Explain AI in 10 words or less.\" So a short phrase with up to 10 words. Provide perhaps 9 words: \"Machines that learn, reason, and act like intelligent humans.\" Count words: Machines(1) that2 learn,3 reason,4 and5 act6 like7 intelligent8 humans9. That's 9 words, fits. Could be 10 words: \"Computational systems that learn, reason, adapt, and perform intelligent tasks.\" Count: Computational1 systems2 that3 learn,4 reason,5 adapt,6 and7 perform8 intelligent9 tasks10. That's exactly 10. Provide one. Let's answer succinctly."}}},{"text":"Computational systems that learn, reason, adapt, and perform intelligent tasks."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":84,"outputTokens":164,"serverToolUsage":{},"totalTokens":248}}448 1414
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/openai.gpt-oss-20b-1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 1248
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:46:14 GMT
+X-Amzn-Requestid: a793c430-a095-4b91-a8ec-610fb48c78e1
+
+{"metrics":{"latencyMs":861},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"text":"We need to answer the user request: \"Explain AI in 10 words or less.\" This is a simple request. Provide a concise explanation in 10 words or less. Possibly: \"Intelligent automation simulates human cognition, learning, reasoning, problem-solving.\" Count words: \"Intelligent(1) automation(2) simulates(3) human(4) cognition,(5) learning,(6) reasoning,(7) problem-solving(8). That's 8 words. Satisfies. Or \"Machines mimic human thinking, solving tasks autonomously.\" Count: Machines(1) mimic(2) human(3) thinking,(4) solving(5) tasks(6) autonomously(7). 7 words. That's fine. The user just wants something like that. Provide that answer. Make sure to stay within 10 words inclusive. Also mention AI is about making machines act intelligently. So answer: \"Machines mimic human thinking, solving tasks independently.\" Count: Machines(1) mimic(2) human(3) thinking,(4) solving(5) tasks(6) independently(7). 7 words.\n\nThus output."}}},{"text":"Machines mimic human thinking to solve tasks independently."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":84,"outputTokens":252,"serverToolUsage":{},"totalTokens":336}}447 424
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-next-80b-a3b/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 259
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:46:20 GMT
+X-Amzn-Requestid: 8c39cd13-bc27-41dc-9409-5b76b28b8417
+
+{"metrics":{"latencyMs":535},"output":{"message":{"content":[{"text":"Computers learning to think, decide, and act like humans."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":30,"outputTokens":14,"serverToolUsage":{},"totalTokens":44}}447 415
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-vl-235b-a22b/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 250
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:46:27 GMT
+X-Amzn-Requestid: 11f09415-edc9-4a65-98f8-eb65b3c578fa
+
+{"metrics":{"latencyMs":426},"output":{"message":{"content":[{"text":"Machines that learn, think, and act like humans."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":30,"outputTokens":13,"serverToolUsage":{},"totalTokens":43}}445 476
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-32b-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 311
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:46:33 GMT
+X-Amzn-Requestid: 17020819-255a-4546-a197-c7b7e9a0aee8
+
+{"metrics":{"latencyMs":232},"output":{"message":{"content":[{"text":"Artificial Intelligence: Machine systems designed to mimic human intelligence and perform tasks autonomously."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":34,"outputTokens":18,"serverToolUsage":{},"totalTokens":52}}455 464
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-coder-30b-a3b-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 299
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:46:41 GMT
+X-Amzn-Requestid: ccfe8200-4278-4fa8-a624-473210d4741f
+
+{"metrics":{"latencyMs":1274},"output":{"message":{"content":[{"text":"Artificial intelligence mimics human cognition through data-driven learning and decision-making."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":30,"outputTokens":16,"serverToolUsage":{},"totalTokens":46}}445 445
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-coder-next/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 280
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:46:47 GMT
+X-Amzn-Requestid: 0c919627-e4e1-48eb-8db3-92bae02f807a
+
+{"metrics":{"latencyMs":398},"output":{"message":{"content":[{"text":"AI: Machines that mimic human intelligence—learn, reason, perceive, and act."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":30,"outputTokens":18,"serverToolUsage":{},"totalTokens":48}}461 431
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/mistral.mistral-large-3-675b-instruct/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 266
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:46:54 GMT
+X-Amzn-Requestid: cb8d40f7-f514-4af8-8413-1e3c2b6ac23e
+
+{"metrics":{"latencyMs":264},"output":{"message":{"content":[{"text":"Machines mimicking human intelligence for problem-solving tasks."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":22,"outputTokens":12,"serverToolUsage":{},"totalTokens":34}}452 423
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/mistral.magistral-small-2509/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 258
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:47:00 GMT
+X-Amzn-Requestid: 27ea9d71-2af1-4ef4-b2ef-67308520534e
+
+{"metrics":{"latencyMs":459},"output":{"message":{"content":[{"text":"\"AI: Machines learning, mimicking human intelligence.\""}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":22,"outputTokens":12,"serverToolUsage":{},"totalTokens":34}}457 412
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/mistral.mistral-large-2402-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 247
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:47:07 GMT
+X-Amzn-Requestid: bcaaedd4-45ad-4ca0-8450-285c256024b7
+
+{"metrics":{"latencyMs":309},"output":{"message":{"content":[{"text":"AI is a machine mimicking human intelligence."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":22,"outputTokens":10,"serverToolUsage":{},"totalTokens":32}}444 425
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/moonshotai.kimi-k2.5/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 260
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:47:13 GMT
+X-Amzn-Requestid: 3d9b25fe-e861-4b3f-93ff-2244a3e1bb34
+
+{"metrics":{"latencyMs":483},"output":{"message":{"content":[{"text":" Machines learning patterns to predict, decide, or create."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":28,"outputTokens":13,"serverToolUsage":{},"totalTokens":41}}449 2673
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/moonshot.kimi-k2-thinking/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 2507
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:47:41 GMT
+X-Amzn-Requestid: 4a56964c-b626-43b8-aa10-36482312d8d9
+
+{"metrics":{"latencyMs":21116},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"text":" The user wants me to explain AI in 10 words or less.\n This is a very concise request. I need to distill the essence of AI into a short phrase.\n What is AI? It's about machines mimicking human intelligence.\n Key concepts: machines, learning, intelligence, problem-solving, automation.\n\n Let me try some options:\n - \"Machines that learn and think like humans.\" (7 words) - This is good, but \"think like humans\" is debatable and not always accurate.\n - \"Machine learning and problem-solving.\" (4 words) - A bit too technical and narrow.\n - \"Computers mimicking human intelligence.\" (4 words) - Simple and direct.\n - \"Teaching machines to learn and reason.\" (6 words) - Uses \"teaching,\" which is a good analogy.\n - \"Simulating human intelligence in computers.\" (5 words) - Similar to the previous one, maybe more accurate.\n - \"Machines performing tasks requiring human intelligence.\" (6 words) - This is a definition often used. It's accurate.\n - \"Intelligence demonstrated by machines.\" (4 words) - Very short, but maybe too vague.\n - \"Making computers smart.\" (3 words) - Too simplistic, almost childish.\n - \"Machine intelligence automating complex tasks.\" (5 words) - Good, covers automation.\n - \"Learning machines solving human-like problems.\" (5 words) - Okay.\n\n Let me reconsider the best one.\n \"Computers mimicking human intelligence.\" - 4 words. This is simple and covers the core idea. Is it perfect? No. AI doesn't always mimic human intelligence *exactly*, and sometimes it solves problems in very non-human ways. But as a high-level, sub-10-word explanation for a layperson, it's effective.\n\n Another option: \"Machines learning to perform intelligent tasks.\" 6 words. This is also good. It focuses on *learning* and *tasks* rather than just mimicry.\n\n How about: \"Simulating human cognition using computers.\" 4 words. \"Cognition\" might be too technical.\n\n \"Algorithms learning from data.\" 4 words. This is true for ML, but AI is broader (e.g., rule-based systems). But modern AI *is* mostly ML. This is also a very good, modern definition.\n\n Let's go back to the core. What is the simplest, most accurate, and most understandable explanation?\n - \""}}}],"role":"assistant"}},"stopReason":"max_tokens","usage":{"inputTokens":29,"outputTokens":512,"serverToolUsage":{},"totalTokens":541}}435 414
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/zai.glm-4.7/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 249
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:47:47 GMT
+X-Amzn-Requestid: ea5cf569-be4f-4df6-a25f-1165790257fa
+
+{"metrics":{"latencyMs":294},"output":{"message":{"content":[{"text":"Machines learning to think and act like humans."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":22,"outputTokens":11,"serverToolUsage":{},"totalTokens":33}}441 389
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/zai.glm-4.7-flash/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 166
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Explain AI in 10 words or less."}],"role":"user"}],"system":[{"text":"You know all about AI."}]}HTTP/2.0 200 OK
+Content-Length: 224
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 15:47:54 GMT
+X-Amzn-Requestid: 85f1597a-b9e0-4a61-b051-d3e7f9ce9665
+
+{"metrics":{"latencyMs":221},"output":{"message":{"content":[{"text":"Simulated intelligence."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":22,"outputTokens":5,"serverToolUsage":{},"totalTokens":27}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestAmazonReasoningConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonReasoningConverseAPI.httprr
index 6d003bba..30d10e2c 100644
--- a/llms/bedrock/testdata/TestAmazonReasoningConverseAPI.httprr
+++ b/llms/bedrock/testdata/TestAmazonReasoningConverseAPI.httprr
@@ -1,5 +1,33 @@
httprr trace v1
-542 1939
+529 1458
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-6-v1/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 240
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":1024}},"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
+Content-Length: 1292
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 19:43:58 GMT
+X-Amzn-Requestid: 4f15c605-66b9-4aed-99fa-3fecb1f3cba8
+
+{"metrics":{"latencyMs":5338},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EpQCCkgICxABGAIqQGN/vnBLGqecogCjXDmTXmDx81tdE9z+DMpyJOyx7nXoKV177dxUUMjSu1mvDkv58ejPnpwAWAbqTTaqFY3KhLISDC2iwcW4GDDlrU0Z5RoMTVQGHGe/Vv7CBBNIIjDx+8iCOZXDLtivQRwO8M35K2578+vr1Ai/0YKQ6JRNNAoCNMbjO26ddqF2XIirnoMqepOLopeDrQMuFJDrHv96E2Try3YE/zf+FSvmxhrjpFAIWiYR+CBGUdoENy2CchEYH8rYp50Hqrj3kZ9jTXC337KdmY3uH0NqpnXrjChwBKvRMCV+/QhxuoM5Pzb+MFPP7235J/7ZnB4Vb4iRjfT2IPvDIqAdtycyqNlVGAE=","text":"17 * 23\n\nLet me break this down step by step.\n\n17 * 23 = 17 * (20 + 3) = 17 * 20 + 17 * 3 = 340 + 51 = 391"}}},{"text":"# Multiplying 17 × 23\n\n## Breaking it down\n\nI'll use the distributive property to split this into easier parts:\n\n**17 × 23 = 17 × (20 + 3)**\n\n## Step-by-step calculations\n\n1. **17 × 20** = 340\n2. **17 × 3** = 51\n\n## Adding the partial products\n\n340 + 51 = **391**\n\n## Verification\n\n```\n 17\n × 23\n ----\n 51 ← (17 × 3)\n 340 ← (17 × 20)\n ----\n 391\n```\n\n**17 × 23 = 391**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":55,"outputTokens":238,"serverToolUsage":{},"totalTokens":293}}528 1413
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-6/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 240
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":1024}},"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
+Content-Length: 1247
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 19:44:14 GMT
+X-Amzn-Requestid: 544dc82e-a7bb-4a91-a9ce-fabda9cb3064
+
+{"metrics":{"latencyMs":4877},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EvQBCkgICxABGAIqQN5oZ2H+jxOLvhrtwjkFbJgMNpfToY5q5/O8E8q/wsUdO72bG1QCSyQte6bbFH4rumBUzC4qXe6grPqa/FiBpHQSDMVxXY54wJ/GTJ0nohoMXLsKGhl6MmiwN6CKIjBlN+noh+L/wE9cjWQBU6w+dcZsE72iBNe/hhetNL+XbZ/Eg6PPOirOtxs14Y4SIjQqWnUqso/AGGDDLJmzZ1vl/fXWPfLFvkqAA9OqFWqmAWLR3m7T6/1yGCgShYWXif5RFN8apev+/1HnVHpyVv7gidmXlxU+RpPg1SJcAAo/F3v72QiuIfTLF/e/fBgB","text":"17 * 23\n\nI'll break this down:\n17 * 23 = 17 * 20 + 17 * 3\n= 340 + 51\n= 391"}}},{"text":"## Calculating 17 × 23\n\n### Method: Break Apart (Distributive Property)\n\n**Split 23 into 20 + 3:**\n\n| Step | Calculation | Result |\n|------|------------|--------|\n| 17 × 20 | 17 × 2 × 10 | 340 |\n| 17 × 3 | 17 × 3 | 51 |\n| **Add together** | 340 + 51 | **391** |\n\n### Verification (Standard Multiplication):\n```\n 17\n× 23\n-----\n 51 ← (17 × 3)\n+ 340 ← (17 × 20)\n-----\n 391\n```\n\n### ✅ Answer: 17 × 23 = **391**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":55,"outputTokens":249,"serverToolUsage":{},"totalTokens":304}}542 2038
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-5-20251101-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -8,12 +36,26 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":1024}},"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
-Content-Length: 1773
+Content-Length: 1872
Content-Type: application/json
-Date: Fri, 23 Jan 2026 14:01:43 GMT
-X-Amzn-Requestid: 8f2b1220-d8c5-46dd-ad32-8990baf2f8df
+Date: Tue, 03 Mar 2026 19:44:31 GMT
+X-Amzn-Requestid: e928d6f8-b309-49e0-9882-c3a8eda43439
-{"metrics":{"latencyMs":7272},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EpUECkgICxABGAIqQH69Dv17/3nuqkw6XmAYcjMqZunNkAu8T2ORfcdNfldbgylOkuBEpjt57v3YCkKIOLj+d2KzXhjNeoTDGKb9CrwSDN6th2sZgSrjy9Zu2xoMTRXKBADbFaFaHuCBIjCxqMPEYcLpyktbLfqqzmp6pMNhlI5k+WHT4FtcDrAGwBOojDt5/PBrWaQvX0sTlzsq+gJzOTLvVNVeZGv5vjpndiGsK+HVkYrVTDvA7Y9TF91Moi+jJ5j+CPeO4lMuqFsond6pVDGpKQN/oso2VJzpmcFRPCaxDwjfz0GsmmXZh7LSPfd4RDl9GmTv3SGhSlrdYvZ8fj2JToTeBZ4b9QorjQPkPhLyoSCksQFT5HPoKuFAKcIdhx7GgPVWbOlmFOnfcSEiM9+cbM5Wal2RW2205C72SPSibVaGdVdwQUpF1SQFaz/vzLmZBuV+sQy+v/fG/hL81uq8YkjNj6ItgoeWy2ipjVfKVs6JlxHC/SCxCuefu3JOJseHIUSXwiTbNryOmLU5xhN1wbntk501FmCrsFQBmDe8ITyqIQUQOr1r+DSpBv9GSdH+EYuSWfj5txZDbmictMjzNm6v7ll3xshNl2ckB66JDKKK3itSWtEHGUVHun3wJrrXCBeqBB6etLT1fPxsV+mnLi+d7U0mysy4IE/cRtv6wpNL2JcCqd+QtgN887Y6+/VLSkUxEkgYAQ==","text":"I need to calculate 17 * 23. Let me break this down step by step.\n\nI can use the standard multiplication method or break it into easier parts.\n\nMethod 1: Breaking down the numbers\n17 * 23 = 17 * (20 + 3)\n= 17 * 20 + 17 * 3\n= 340 + 51\n= 391\n\nLet me verify with another approach:\n17 * 23 = (20 - 3) * 23\n= 20 * 23 - 3 * 23\n= 460 - 69\n= 391\n\nYes, the answer is 391."}}},{"text":"# Calculating 17 × 23\n\n## Breaking it into simpler parts\n\nI'll split 23 into (20 + 3) to make this easier:\n\n**Step 1:** Calculate 17 × 20\n- 17 × 20 = 340\n\n**Step 2:** Calculate 17 × 3\n- 17 × 3 = 51\n\n**Step 3:** Add the results\n- 340 + 51 = **391**\n\n## Answer: 17 × 23 = 391"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":55,"outputTokens":288,"serverToolUsage":{},"totalTokens":343}}544 2516
+{"metrics":{"latencyMs":5915},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EpwECkgICxABGAIqQN3fdQ8wsZIz3w/v24CxB20FhHExj9qU3iaQOLbiL12tl2YmOge4OgeHVqiEhc/gbGcLY9YpST2fk9vxXJoMjNESDImFQeZGeovMnt75OxoMpcI2C4Nh0gnpp/qIIjBlO+hsBayR8rvBt3L8Tbn8JmPuinaV3cNerWAgfzoxbIv//j5WKDlqMTB5pn6Y5PcqgQM663SCzOjwXIZX+4L4T9ebpnXATqtcbObQi8ucsDzcK+cWf0emxS9C3ls7YpMOeKG9npIvmHlJlZmsyyw+J03xOn9QhRuV7gWZ6fzENx8JBZQDTQT0ZCPLNHKsz5OGKV9KmqehYoMIDliACLHPeTJOJbCVmHv3PTLbzf+a7P0lB7bFUAu0FHrMEXVv/nzh+l534kJKKg/6V7J6S8u+UyOD74aLMpqPFSmXkNs3i3m0+0bhG5cUoeMTHVXXs5wjA5VhEDG7jjiGyfKukecEOsS7/TXZDDf4dvLtKNuxqkQB7y1Imi9oGHSQzYxONJNLC8TEhhQqp/mW0ivwpu/g8r/RX2/5Y7RH7xfk2VEOXhF6rx2vd0en9ov5+jJUd12BRxx6YORlKjeky9oO1+YhSZw152ij/k/m2zUywgXnqaMy96n2Yd72v5iyISQNOrMNmJ3crFO0xquAJ6yeS5v6+X3uLq7boJqKSJhiYhBok5ztS/TIKwoSYIFqyLa66GPS8W2gGAE=","text":"I need to calculate 17 * 23. Let me break this down step by step.\n\nMethod 1: Standard multiplication\n17 * 23\n\nI can break this down as:\n17 * 23 = 17 * (20 + 3)\n= 17 * 20 + 17 * 3\n= 340 + 51\n= 391\n\nLet me verify with another method.\n\nMethod 2: Breaking down 17\n17 * 23 = (10 + 7) * 23\n= 10 * 23 + 7 * 23\n= 230 + 161\n= 391\n\nBoth methods give me 391, so the answer is 391."}}},{"text":"# Calculating 17 × 23\n\n## Step-by-Step Solution\n\nI'll break this into simpler parts using the distributive property.\n\n**Method: Break 23 into (20 + 3)**\n\n17 × 23 = 17 × (20 + 3)\n\n**Step 1:** Calculate 17 × 20\n- 17 × 20 = 340\n\n**Step 2:** Calculate 17 × 3\n- 17 × 3 = 51\n\n**Step 3:** Add the results\n- 340 + 51 = **391**\n\n## Answer: 17 × 23 = **391**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":55,"outputTokens":331,"serverToolUsage":{},"totalTokens":386}}543 2085
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-haiku-4-5-20251001-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 240
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":1024}},"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
+Content-Length: 1919
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 19:44:45 GMT
+X-Amzn-Requestid: b3f26a3f-2ac3-4692-8c83-7b8042ac9a2e
+
+{"metrics":{"latencyMs":2560},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"ErIECkgICxABGAIqQF8y6aqbNjoVfr3g3hbtOd3OJUR4ffak4iCiJZB5Ah1s6iVEZ/ALetVtfvDl7+Hz2zIXxaPGR3zjx8xVe/TrpgMSDBhmLtm20Md/A7v97BoMuT/Bvcy0E97n1btkIjDwYu9Vvxk7Kvp/9LGR5X5DHNW/3LmQ9w8HXXDIBps1l+hOHOd3OQj/oeAq2QJpQBQqlwMmhUMfo4zSYgqNdGDcxTaR5Fu4UtTDRCDNUmI0gxQKNlxrbVs52CXDk39dWPFaneDRk08v3Y55UK+KDlEIt3/2Il9SPOS2LHsJrsCYWZEDfwLuhX6jDbH9sS8dn90VUK0CSuothFjkGEvVggJGS3UQaBMn+QNoLPYTnJqu3+7X4bJ44DPcCcl7fjlBSjMZpUH2TNxeSRC1MSvs+n/Fae0xhp0LmyRT7dEF5pADLufsfgVE50fhjHFsGnqnv8cPGlH28A4Q+2zcICKplQ4jaCb0KYROHWbmDAqMHPNMdeJKSLu93QGDMJZphvu8ZGErqD6CzuK9DM47V6WwrhgKGav/lYsX32ubzRq8KOrlVraFpXqTYGCSxxVyVi9FV+7h7P/OCDzjYPbhSP51i5+sZx9bnCfnUrgQdlctUAGw1EDM+fioFRBweUGeqcximekZaOXFJ4+UKbvQY/mL5rWEUYZWMVP9LlcUDSK0pHmqqvywoYKUxS8zFBLBu+shJ3i0RPbhpINLF8VzYRJdmTREk8wgRTnRsN++hBgB","text":"I need to calculate 17 * 23. Let me work through this step by step.\n\nMethod 1: Breaking it down using the distributive property\n17 * 23 = 17 * (20 + 3)\n= 17 * 20 + 17 * 3\n= 340 + 51\n= 391\n\nLet me verify this with another method to make sure.\n\nMethod 2: Another way to break it down\n17 * 23 = (10 + 7) * 23\n= 10 * 23 + 7 * 23\n= 230 + 161\n= 391\n\nBoth methods give me 391, so that's the answer."}}},{"text":"# Calculating 17 × 23\n\nI'll break this down using the distributive property:\n\n## Method 1: Split 23 into 20 + 3\n\n17 × 23 = 17 × (20 + 3)\n\n= (17 × 20) + (17 × 3)\n\n= 340 + 51\n\n= **391**\n\n## Verification using Method 2: Split 17 into 10 + 7\n\n17 × 23 = (10 + 7) × 23\n\n= (10 × 23) + (7 × 23)\n\n= 230 + 161\n\n= **391** ✓\n\n**Answer: 17 × 23 = 391**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":55,"outputTokens":347,"serverToolUsage":{},"totalTokens":402}}544 2307
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -22,40 +64,12 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":1024}},"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
-Content-Length: 2350
+Content-Length: 2141
Content-Type: application/json
-Date: Fri, 23 Jan 2026 14:01:50 GMT
-X-Amzn-Requestid: 6e8b3bd8-5914-4a74-bbf9-1b2dba5675d5
+Date: Tue, 03 Mar 2026 19:45:02 GMT
+X-Amzn-Requestid: 2ea9fa52-4c35-4359-b565-d5cc58f4321e
-{"metrics":{"latencyMs":5659},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EqUFCkgICxABGAIqQPINXYxMeNgZBwXMLylqEffnwKWlyrItZ6k6XzA374XkyPynvsEPk3W28UolHsSCrzS1V6aU80+CbxDR+2IBizUSDI4HFk4GM8lJ3rhXyxoMH+D8xeDSCIppOvxFIjC1gwLzJBLytxAGxUeBuQtxfkVCjEOdZXtzmXkElexOJum5iRCeuj9NDuc3Z/ZF18gqigS2kgyIhPaxo9iYlFsdIJU+hz7W8ZlglvVAFVWAxlASXzTFFc/huh6tlB5w1pCk8ndMfjlKwkFIuBcXOKMtkN5sDd47cxLvlCqHTcxS8mu8gyxwAS5aXw4rhTvL+vA8SS7I1UTiNWPJ5c2wLLzhE9HeUrX8ntlqd/w2g0err8xvllCKrOHA3Xb2pDIIx5eF6LipjFwT7lXf2gaya5vYxWtH2RPpOKhO1L/o7kL4emJsXGeP7EluVcIfkvc/ojZTzuez5IeG1iTFzeczeIUUKyeoPhu7cte9fs9TFOghrTs66eZdZ3NaLODeLyrVCDNMpt2FmFsw+xM0ojNOzF7SrjexqgVSnGsYUEmvC0USD3pREpDlJPygAODMISSzN9lVD3fKESSQ60S/iF1QlXqbN37U1B/ssVGi6A6kYIDdzXpR23CFB+00nU2J0Y4MH/NtpBhl4xbmFIepvsM2RX7jBN5Rx6o3Cce1YEsqyLjoI/iQfVDGCILXg4kIz64y1ucScOY/cLoaNSDiqKNm/sv4H6egWOVIqO/x+B6G71BPX3hToT0AJQpAIc1E0VA+zgIq3Nf5ImbfgXnuRSXairWcfac+tOSvJPD793gedMWH8ITBrbIfogEO8dzE732fBfAHoEEepfcX1sbNaanOAvkyEBuCS//frlAmlh9hoZKBrOhUkUkbirYdS7/C7isYAQ==","text":"I need to calculate 17 * 23. Let me break this down step by step.\n\nI can use the distributive property to make this easier:\n17 * 23 = 17 * (20 + 3)\n = (17 * 20) + (17 * 3)\n\nLet me calculate each part:\n- 17 * 20 = 17 * 2 * 10 = 34 * 10 = 340\n- 17 * 3 = 51\n\nSo: 340 + 51 = 391\n\nLet me verify this another way:\n23 * 17 = 23 * (10 + 7)\n = (23 * 10) + (23 * 7)\n = 230 + (23 * 7)\n\n23 * 7 = (20 * 7) + (3 * 7) = 140 + 21 = 161\n\nSo: 230 + 161 = 391\n\nBoth methods give me 391, so that's correct."}}},{"text":"# Calculating 17 × 23\n\nI'll break this down using the distributive property:\n\n## Method: Break 23 into 20 + 3\n\n**17 × 23 = 17 × (20 + 3)**\n\nThis splits into two easier multiplications:\n- 17 × 20 = 340\n- 17 × 3 = 51\n\n**Add them together:**\n340 + 51 = **391**\n\n## Verification using a different breakdown:\n\nLet me verify by breaking down 17 instead (as 10 + 7):\n\n**23 × 17 = 23 × (10 + 7)**\n- 23 × 10 = 230\n- 23 × 7 = 161\n\n**Add them together:**\n230 + 161 = **391** ✓\n\n**Answer: 17 × 23 = 391**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":55,"outputTokens":478,"serverToolUsage":{},"totalTokens":533}}542 2068
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-1-20250805-v1%3A0/converse HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 240
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":1024}},"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
-Content-Length: 1902
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 14:02:08 GMT
-X-Amzn-Requestid: 45222b32-fbd0-4398-98cc-f9b098750286
-
-{"metrics":{"latencyMs":17761},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EvUDCkgICxABGAIqQNdlQQKdiOUOh7R7bEGA4/HLx/A6e+wFpJMPFh4ni+TgUCyROIqXkM3fIMLfmfNUMhvHLW7ulcSH/N/m1TW+m4ASDKEZ/VcJxflCoLIE0BoMDopa1lrkKKGtcK2UIjCnBu0ekrHnrfp/SVgoD7orVH++8z91s+Z6gAT+EZl2CNhZKhXSV54do3QYTTmek/Iq2gJdGaorERUEKB3UPKdemTzvfxgdZerZ6TDf0MFSkdmNKVkPTYghSFS2JyH0W8gQ27XxFobBcrqfPYRaucAIntwMTjpRAzlqJ7yrlemFs/0hym8cc6e1NtwlCvy8oJiTo1UlzCtHjyVagmgIekJmeFdPfDKFuXMGxQm5Ebkb57H2fB3hSdg2wZC/ak9Okvt2v6p4ckK3R5uNXHIWKNJsAIFwtu9RfxR76hCiZDmI2lQ0p2KkfC5XAtI2OD5rRTP2UW/yugC/zGdwonmT+1i4wO2MgqPJWqPWohIk2h6A+vgMSIiMuSpB77Cuy6m9Pu/QyVYyBMPamLMfhikBr/h4PFKop71MnqQmnAswLuUvBMQFJuMhdz/AvOu9eCFu7P1Pzi/LpSqou1wCrwqAu+MxkjVVaWyZYfd7zotUfQjmuXqPuUYxpWDrGMbyHMZgM7RsPL38FWEFSwjOOA3eGAE=","text":"I need to calculate 17 * 23 step by step.\n\nLet me break this down using the distributive property:\n\n17 * 23 = 17 * (20 + 3)\n = (17 * 20) + (17 * 3)\n = 340 + 51\n = 391\n\nLet me verify this another way:\n23 * 17 = 23 * (10 + 7)\n = (23 * 10) + (23 * 7)\n = 230 + 161\n = 391\n\nGood, both methods give me 391."}}},{"text":"I'll calculate 17 × 23 step by step using the distributive property.\n\n**Method 1: Breaking down 23**\n- 17 × 23 = 17 × (20 + 3)\n- = (17 × 20) + (17 × 3)\n- = 340 + 51\n- = 391\n\nLet me show the sub-calculations:\n- 17 × 20 = 17 × 2 × 10 = 34 × 10 = 340\n- 17 × 3 = 51\n\n**Method 2: Let me verify by breaking down 17**\n- 23 × 17 = 23 × (10 + 7)\n- = (23 × 10) + (23 × 7)\n- = 230 + 161\n- = 391\n\nSub-calculations:\n- 23 × 10 = 230\n- 23 × 7 = 161\n\n**Answer: 17 × 23 = 391**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":55,"outputTokens":406,"serverToolUsage":{},"totalTokens":461}}540 2554
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-20250514-v1%3A0/converse HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 240
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":1024}},"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
-Content-Length: 2388
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 14:02:31 GMT
-X-Amzn-Requestid: 53cb3e73-9087-411a-b588-9e9b30bf7671
-
-{"metrics":{"latencyMs":21668},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"Er8FCkgICxABGAIqQHf4WKannOf0uOwOwsPvdrW7Dwwt38BDhakw/pJm9G4ehcEdHbyfvQdSYFVc3radRGaw/2fkRIUksgLlM/oQmywSDCwYz7xyG75qDODKaRoMgt2pB/kzJsavMswcIjCSbR+KYYD2LelQ1YubfzwBdXRx6jZth0EkqOrUvLqnhn0DHSyzgu3YaurONGTipOUqpARPgibP/RA/udm9vwy8xRX5h/Cu5k4Uv0Hm/lX0pBWAxMHmqOR5vWDz8AvL0JPST2oMTKDE66Ekdv4QkQCeQULDF2b7OOvRVy+I/R2tXaQlXVkX/b90A7pONbNLmpL/jG2b0kHdBwIQzneki8m/WTIiNVCa0hnFiYSLYCQmie7mVn8n+hi5LLdpNqKlnHzZYqIuqGldJAg9q1149DjGXVyQltmt2LNj29TRLb1vlT7GWYc9Go011KzJfW/GjkD7ShWq/zjV1jjA6dfQP+3iDqcpvNpNWkzJ1ew+FPG+FpOTvB/hEiVTfLeKQfE9Q7V0J97FBN+ucXTjLZHl+ApWt6m9KX70HhvIl4m+1dnfu/6u8lVEsqjsl9cWxGPXipzzBXXi/CsSqaR37eJeYZUvjg73grpWg9CM9EasozW0So7gV3qS3OQWBPO44EXHibKFawv+Ot2iaJfKJUNoeCh3PMDrAphsITYV/5pDZWsZUuYTfd3Uc0zXtkqq20X2AVK49wxl2QLVXJ1DmkUp+PbBAXxgQ2GqGqzUjw1rK9oeY0NS66vqFeN6l+5dctkUEUYp6Z64lKCQdvdeHFtEywe+TfUX0BLxo1e9fYL5mZMa68SkVqgIRlCLrKDm8/NJZjOrQvo9d1Y50WTUQ7URKkL7t0arNVagAv1Wf/eWlcr/I/R0xHy5Ml+wmrLmeW9pLwa4NcCHQqe3zP5orHeGxQwD/1E78OJQ0BgB","text":"I need to calculate 17 * 23 step by step.\n\nI can break this down in several ways. Let me use the standard multiplication method:\n\n17 * 23 = ?\n\nI can break 23 into 20 + 3:\n17 * 23 = 17 * (20 + 3)\n= 17 * 20 + 17 * 3\n= 340 + 51\n= 391\n\nLet me verify this another way. I can break 17 into 10 + 7:\n17 * 23 = (10 + 7) * 23\n= 10 * 23 + 7 * 23\n= 230 + 161\n= 391\n\nGood, both methods give the same answer.\n\nLet me also verify using the standard multiplication algorithm:\n 17\n × 23\n ----\n 51 (17 × 3)\n 340 (17 × 20)\n ----\n 391"}}},{"text":"I'll solve 17 × 23 step by step using the distributive property.\n\n**Method 1: Breaking down 23**\n- 17 × 23 = 17 × (20 + 3)\n- = (17 × 20) + (17 × 3)\n- = 340 + 51\n- = 391\n\nLet me verify this with another approach:\n\n**Method 2: Breaking down 17**\n- 17 × 23 = (10 + 7) × 23\n- = (10 × 23) + (7 × 23)\n- = 230 + 161\n- = 391\n\n**Traditional multiplication check:**\n```\n 17\n × 23\n ----\n 51 (17 × 3)\n 340 (17 × 20)\n ----\n 391\n```\n\nTherefore, 17 × 23 = **391**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":54,"outputTokens":466,"serverToolUsage":{},"totalTokens":520}}542 2397
+{"metrics":{"latencyMs":5932},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EuMECkgICxABGAIqQC+KM9Ym1pLVdus5pR0yB0fftebblJJ0HSd4IJSXiMMTbaH5BL9n2hYit58Qcv2jHJJhA7XxUN5suHYO9CBcyjkSDPQBxPm3eLSW0J2WaxoM8h4pqJlNn1mThk4jIjDPoZgWs2lLt4yV11asp0lc1SeoUHY+Phscf/7UQY6bdTYOLDF7fVT6xvVQr6w/lCMqyANyKdMgv/gVGjpn+r7ujJ4v5dutcH0FU6MHLNphQmU9kyxEZxCDJsRCVspQWCn6H5j/j4BUVfab8rmm5sy2xpaAn7R3sWALlFC9yK7/7QE7W7GCqMHz15p4zICWxm0BppeDvJX20xVd3qMgMi2/oxCg+KRIkEwLhh3m7p16zpD8YXJpb+NkoWSgLYhpnnGgSCPiat2PT9xEDFmzRc6iiUBfmcnd47tlsFXcOFVGt4BlN4/1gJFlaMq+sZFvlCGN60r00ah2++4Htzss4sCzyGWfqTmI0Rv1QeMzpKShhsZFfPHf9ARGrpk/BKtLoThRS4z/j8RIh9PF+kFF5g0hhpGqG13dkWChv9B8dDUQgGC0Yyk9hjQfAMRPG/RTiDS/Qnbtu4S2z9XEnbc9cTZ7HHy3Ejma/9GlZ7z8BHIo+0O6sib1t6X+V3rE2eeLZreqINS/huwpDxKnGS9KmwwXcPwTV8dspfwulkEqE7piwcct8Xnz+1cK9oDmPWK5Dssg0L5U2YZ9ji2h8pznc6b5D3gK7ws0JEMwbZbPfuKW6gJG4QcQQTsCGaA33JpMrb3PP8TMgdoDRsa1IfsULxOmdDXANU0Kkcx2jLQYAQ==","text":"I need to calculate 17 * 23. Let me break this down step by step.\n\nMethod 1: Breaking down by place value\n17 * 23 = 17 * (20 + 3)\n= (17 * 20) + (17 * 3)\n= 340 + 51\n= 391\n\nLet me verify this with another method.\n\nMethod 2: Breaking down the first number\n17 * 23 = (10 + 7) * 23\n= (10 * 23) + (7 * 23)\n= 230 + 161\n= 391\n\nLet me double-check 7 * 23:\n7 * 23 = 7 * 20 + 7 * 3 = 140 + 21 = 161 ✓\n\nBoth methods give me 391, so that's the answer."}}},{"text":"# 17 × 23 = ?\n\nLet me solve this by breaking it down into easier parts:\n\n## Method: Split 23 into 20 + 3\n\n**17 × 23 = 17 × (20 + 3)**\n\n### Step 1: Multiply 17 × 20\n- 17 × 20 = 340\n\n### Step 2: Multiply 17 × 3\n- 17 × 3 = 51\n\n### Step 3: Add the results\n- 340 + 51 = **391**\n\n## Verification using another approach:\n\nBreaking down 17 instead: **(10 + 7) × 23**\n- 10 × 23 = 230\n- 7 × 23 = 161\n- 230 + 161 = **391** ✓\n\n**Answer: 17 × 23 = 391**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":55,"outputTokens":435,"serverToolUsage":{},"totalTokens":490}}542 2420
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-20250514-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -64,13 +78,27 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":1024}},"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
-Content-Length: 2231
+Content-Length: 2254
Content-Type: application/json
-Date: Fri, 23 Jan 2026 14:02:38 GMT
-X-Amzn-Requestid: 105068ba-2aa1-4727-aa1f-872f81b76078
+Date: Tue, 03 Mar 2026 19:45:17 GMT
+X-Amzn-Requestid: 2a4265f1-c110-454b-97c8-3a82d3206689
-{"metrics":{"latencyMs":5222},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EvwECkgICxABGAIqQN+UN1xiOQ1bWK1idzPcWpQNG21zA6YZr7nrx/YbpM812s/XGLLRWwijEde2cHJSVhBhUv9NkkZnT+VKuTHTFDUSDCJJdCPxjjQCZxWm2hoMfZqJFyLGvt+MTrr8IjAKgU9dNzRk+6enqbzBJkIwYqadGCkBGFfN1J4hxb3NYRv4NKpNOSUFq06AIPNnSEAq4QOanLNumRnjIPz0jnDSMm66BoBjB2o08j/xca7oS9nUXP9JyS/16e35JMF7ifw2YVJw0CFDBFaKCtRHW7NqZU2Ov1yH9T71fRNyksk6P7rnf0GoriUqKGfAtygHwi2deaAAbNSkK0ApbORY20CreQp4JkJJBZ6vB6RWdKaBpew3L7eNMmxJatQqLyTQUaHOUD4Hq1cmfhFNgAhz/E05Nb+XFuhrgIj4dWZvsSbf3IjJcTwtBKCbSCVQWZJwnm4P9JjqL9a6j4/Nzz+hKJUe8GaofT0gMCtggTJTV7yx/+XVWDn2IOV7GzqAWRVFIpBw7EG/v0bOFqtGM2+qsK8hrB10f5P20LhOlgt9460Uj2U6FOWwruG9Is7vzR6Jn+7hhiKFizEvq+6WJ+nZ5kl7xj8RtE1GE2APcXT8G3uauxT6Y6ZZSZz+T1Rru0nWQFFsutw5WVfWhGU4Pd9ik3xbBuKYEkBP0/ScWQFQFH8OiFsjQwdqnQbYYM9Nx6V7wMpzx5Z+G3km93VQ5fkdLVpXuDoAaE715MJLKRRiMNyFvkfkbIArr4CGL5j/x0HbqH7OVd5kiHUwS678gqo0v/NHTg8peZcXIPMuBcQCXimKYe61OPRXkhEYcugGZ+vn2IM9UqSrGAE=","text":"I need to calculate 17 * 23. Let me do this step by step using the standard multiplication method.\n\n17 * 23\n\nI can break this down using the distributive property:\n17 * 23 = 17 * (20 + 3) = 17 * 20 + 17 * 3\n\nLet me calculate each part:\n17 * 20 = 17 * 2 * 10 = 34 * 10 = 340\n17 * 3 = 51\n\nSo 17 * 23 = 340 + 51 = 391\n\nLet me double-check this using the standard algorithm:\n 17\n × 23\n ----\n 51 (17 × 3)\n 340 (17 × 20)\n ----\n 391\n\nYes, that's correct."}}},{"text":"I'll solve 17 × 23 step by step using the distributive property.\n\n**Step 1: Break down 23 into easier parts**\n23 = 20 + 3\n\n**Step 2: Apply the distributive property**\n17 × 23 = 17 × (20 + 3) = (17 × 20) + (17 × 3)\n\n**Step 3: Calculate each part**\n- 17 × 20 = 340\n- 17 × 3 = 51\n\n**Step 4: Add the results**\n340 + 51 = 391\n\n**Verification using standard multiplication:**\n```\n 17\n× 23\n-----\n 51 (17 × 3)\n 340 (17 × 20)\n-----\n 391\n```\n\nTherefore, **17 × 23 = 391**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":54,"outputTokens":422,"serverToolUsage":{},"totalTokens":476}}544 1627
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-3-7-sonnet-20250219-v1%3A0/converse HTTP/1.1
+{"metrics":{"latencyMs":4404},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EvoECkgICxABGAIqQDJCN0r3VW4DgDzE1eGzD/0807wS302MJ8p4CWBm8u5PO0tpnB3qhMOir7uZUcM9/gCPOh+VZW8Yf0KmidlfveoSDBci1uTLkBaYguFa3hoMj6dLB+T69bNGbz9OIjDOT+eSTNtkYvTu0pFaDcGncxu2z08oaN+Di0zMB+zb57bFxuHvbpjgaj4kTPLL84Iq3wOpru3kLYWUjkzrmDze32JsqRN9k987EbvxcMZ/0G21jiTSDJMuTu31HKyX39OTWsk8NNZCO1BItgihdhf0OhdtAmeC1Uqid/yYZYDP13uOuPb4ntrY5NHpAXoGpegryy87L/LN9YIIGE7LQgf1rU/X2RiDg96M4Qc81Iii1aM2PJb0Rw3oceuH1/jCK7pqOVTwGtIP4hIfc7H5m7XU4bPMLDgtiNtCU741NiHfSH915AcTun1LFDh5qtpjwV4IQW88/Wv+pGSnyLwhFjQTHmBJPwi3CJfToBLRuJNO+ZQPvy5NFMb4Sb5qZmJwCGnvZ57MYN1gKDK3w7CPwci4xNq2NZw/UmhUKLOvNza/17F5WJTFkG4UV3/VYYdVRN+UD51G5M6WRH9KugekBe6Od9sSw2CPFgy6Z906BhInHlHMbo+oTC4mpWspeu1alikgv1RkTI6FsjEAAkTV7MkraL1tn4KJLJ4syBZoZcRjPi7CnrI4gKD1ahUIKCEZr/g5Bq9bv92RjyAnH/a0r0xYW3sHj3aysRVJ4NQvZY+sp0QbRIImeH6gHPiBRXQ8nwsChmpkykkMwv6edLqFO5ViB7NZFc/+OZvujrafh8nOVpZRxQG7A4l31AWhdqF1Qfim4RgB","text":"I need to calculate 17 * 23. Let me do this step by step using the standard multiplication method.\n\n17 * 23\n\nI can break this down using the distributive property:\n17 * 23 = 17 * (20 + 3) = 17 * 20 + 17 * 3\n\nLet me calculate each part:\n17 * 20 = 17 * 2 * 10 = 34 * 10 = 340\n17 * 3 = 51\n\nSo 17 * 23 = 340 + 51 = 391\n\nLet me double-check this with the standard algorithm:\n 17\n × 23\n ----\n 51 (17 × 3)\n 340 (17 × 20)\n ----\n 391\n\nYes, that's correct."}}},{"text":"I'll solve 17 × 23 step by step using the distributive property method.\n\n**Step 1: Break down 23 into easier numbers**\n23 = 20 + 3\n\n**Step 2: Apply the distributive property**\n17 × 23 = 17 × (20 + 3) = (17 × 20) + (17 × 3)\n\n**Step 3: Calculate each part separately**\n- 17 × 20 = 340\n- 17 × 3 = 51\n\n**Step 4: Add the results together**\n340 + 51 = 391\n\n**Verification using standard multiplication:**\n```\n 17\n× 23\n-----\n 51 (17 × 3)\n 340 (17 × 20)\n-----\n 391\n```\n\nTherefore, **17 × 23 = 391**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":55,"outputTokens":424,"serverToolUsage":{},"totalTokens":479}}435 5894
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.deepseek.r1-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 156
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
+Content-Length: 5728
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 19:45:39 GMT
+X-Amzn-Requestid: 431da6fb-c37a-4f0b-96dd-a352070b11a5
+
+{"metrics":{"latencyMs":10162},"output":{"message":{"content":[{"text":"\n\nTo calculate \\(17 \\times 23\\), we can use the **distributive property** and break down the multiplication into simpler steps:\n\n1. **Decompose 23 into 20 + 3**:\n \\[\n 17 \\times 23 = 17 \\times (20 + 3)\n \\]\n\n2. **Apply the distributive property**:\n \\[\n 17 \\times 20 + 17 \\times 3\n \\]\n\n3. **Calculate each part**:\n - \\(17 \\times 20 = 340\\)\n - \\(17 \\times 3 = 51\\)\n\n4. **Add the results**:\n \\[\n 340 + 51 = 391\n \\]\n\n**Verification using the difference of squares** (since \\(17 = 20 - 3\\) and \\(23 = 20 + 3\\)):\n\\[\n(20 - 3)(20 + 3) = 20^2 - 3^2 = 400 - 9 = 391\n\\]\n\n**Final Answer**: \n\\(\\boxed{391}\\)"},{"reasoningContent":{"reasoningText":{"text":"Okay, so I need to figure out what 17 multiplied by 23 is. Hmm, let me think. I remember that multiplication is just repeated addition, so maybe I can add 17 to itself 23 times, but that seems like it would take too long. There must be a better way.\n\nWait, maybe I can break down the numbers into smaller parts that are easier to multiply. Like, using the distributive property. Let me recall: a*(b + c) = a*b + a*c. So if I can split one of the numbers into tens and ones, that might help. Let's try splitting 23 into 20 and 3. That makes sense because 20 is a multiple of 10, which is easier to work with.\n\nSo, 17 * 23 becomes 17*(20 + 3). Applying the distributive property, that would be 17*20 + 17*3. Let me calculate each part separately.\n\nFirst, 17*20. Well, 17*2 is 34, so 17*20 must be 34*10, which is 340. Got that part down.\n\nNext, 17*3. Let me do that. 17*3... 10*3 is 30, and 7*3 is 21, so adding those together gives 30 + 21 = 51. So 17*3 is 51.\n\nNow, add the two results together: 340 + 51. Let's see, 340 + 50 is 390, and then add the remaining 1 to get 391. So, 17*23 should be 391. Wait, let me check that again to make sure I didn't make a mistake.\n\nAlternatively, maybe I can use another method to verify. Let's try the standard algorithm for multiplication. Multiply 17 by 23. So, writing it out vertically:\n\n 17\nx 23\n-------\n\nFirst, multiply 17 by 3 (the ones place of 23). 7*3 is 21, write down 1 and carry over 2. Then 1*3 is 3, plus the carried 2 makes 5. So that gives 51.\n\nNext, multiply 17 by 20 (the tens place of 23, which is 2*10). So 17*2 is 34, and since it's actually 20, we add a zero at the end, making it 340.\n\nNow, add 51 and 340 together. 51 + 340. Let's add the hundreds, tens, and ones. 300 + 0 = 300, 40 + 50 = 90, and 0 + 1 = 1. So 300 + 90 is 390, plus 1 is 391. Yep, same result.\n\nWait, just to be absolutely sure, maybe I can check using another method. Let's try the lattice method or maybe another decomposition. Let me try splitting both numbers. 17 is 10 + 7, and 23 is 20 + 3. Then using the distributive property again:\n\n(10 + 7)*(20 + 3) = 10*20 + 10*3 + 7*20 + 7*3.\n\nCalculating each term:\n\n10*20 = 200\n\n10*3 = 30\n\n7*20 = 140\n\n7*3 = 21\n\nNow add them all up: 200 + 30 is 230, 140 + 21 is 161. Then 230 + 161. Let's see, 200 + 100 = 300, 30 + 60 = 90, 0 + 1 = 1. So 300 + 90 is 390, plus 1 is 391. Same answer again. Okay, that seems consistent.\n\nAlternatively, maybe I can use estimation to check if 391 is a reasonable result. 17 is close to 15, and 23 is close to 25. 15*25 is 375. But since 17 is a bit more than 15 and 23 is a bit less than 25, the actual product should be a little higher than 375. 391 is 16 more than 375, which seems reasonable. If I had estimated 20*20=400, which is 17*23, 391 is just 9 less than 400, which also makes sense because both numbers are a bit less than 20 and 25. So the estimation checks out.\n\nAnother way to verify could be using subtraction. For example, 23 is 20 + 3, but maybe 23 is 25 - 2. Let's try that. 17*25 is easier. 25 is a quarter of 100, so 17*25 = (17*100)/4 = 1700/4 = 425. Then subtract 17*2 = 34. So 425 - 34 = 391. Yep, same answer. That works too.\n\nWait, let me try another angle. Maybe using base 10 or some other numerical tricks. For instance, 17*23. If I know that (a + b)(a - b) = a² - b², but that's for conjugate pairs. Here, 17 and 23 aren't symmetric around a common number. Let's see, the average of 17 and 23 is (17+23)/2 = 20. So 17 is 20 - 3, and 23 is 20 + 3. So actually, they are symmetric around 20. So then, (20 - 3)(20 + 3) = 20² - 3² = 400 - 9 = 391. Oh! That's a neat way to do it. So that's another method giving the same result. That's cool. So using the difference of squares formula here. That's smart because 17 and 23 are equally distant from 20. So that's a quicker way if you recognize that pattern.\n\nSo all these different methods—distributive property, standard algorithm, lattice method, difference of squares—all lead to the same answer: 391. That gives me confidence that the result is correct. I don't think I made any calculation errors along the way, especially since multiple methods confirm the same result. Let me just do a quick check with a calculator... Well, since I don't have a calculator here, but if I do 17*20=340 and 17*3=51, adding them gives 340+51=391. Yep, that's straightforward. So I think that's solid.\n\nAnother check: 23*17. Let's reverse the multiplication. 23*10=230, 23*7=161. 230+161=391. Same result. Multiplication is commutative, so it should be the same. Yep, that works too.\n\nAlright, I think I've thoroughly confirmed that 17 multiplied by 23 equals 391. All the different approaches and checks lead to the same answer, so I'm pretty sure that's correct.\n"}}}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":23,"outputTokens":1725,"serverToolUsage":{},"totalTokens":1748}}523 1660
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/openai.gpt-oss-120b-1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
Content-Length: 240
@@ -78,9 +106,37 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":1024}},"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
-Content-Length: 1461
+Content-Length: 1494
Content-Type: application/json
-Date: Fri, 23 Jan 2026 14:02:44 GMT
-X-Amzn-Requestid: fc77b234-167f-4ccd-9c9a-f320f90c2cfb
+Date: Tue, 03 Mar 2026 19:45:51 GMT
+X-Amzn-Requestid: 6cf557c2-fe7a-4567-958c-474fc4e0c404
-{"metrics":{"latencyMs":4945},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"ErcBCkgICxABGAIiQP9Bulu/G73oh1GxqJxQ9Ks1m6cbHI16BEzf3FIH8xByln/FCWTrzgYxUw6Ll3pWT1F34Y6vR1s9mRR8zwmWpAISDLwa/EjhFM01LgKo5RoMRC/a3Vuff54ub2a6IjC2SquDWskU+1HJEXD6dyXnDppaMvJAiDFzJm9Uh26XoqqE3L3fVj8RMMq9FEKSx0MqHSdh10UVXiWPQ7L67aoq2v0UQvuhOJ4n0zgE8ZSOGAI=","text":"To calculate 17 * 23, I'll break it down into steps.\n\nFirst, let me multiply 17 by 20:\n17 * 20 = 17 * 2 * 10 = 34 * 10 = 340\n\nNext, let me multiply 17 by 3:\n17 * 3 = 51\n\nFinally, I'll add these results:\n17 * 23 = 17 * 20 + 17 * 3 = 340 + 51 = 391\n\nSo 17 * 23 = 391."}}},{"text":"# Calculating 17 × 23\n\nI'll solve this step by step:\n\n## Method 1: Direct multiplication\nI can multiply these numbers using the standard algorithm:\n```\n 17\n × 23\n-----\n 51 (17 × 3)\n 340 (17 × 20)\n-----\n 391\n```\n\n## Method 2: Breaking it down\nI can also break it down into parts:\n- 17 × 20 = 340\n- 17 × 3 = 51\n- Add the parts: 340 + 51 = 391\n\n## Method 3: Distributive property\nAnother way to think about it:\n- 17 × 23 = 17 × (20 + 3)\n- = (17 × 20) + (17 × 3)\n- = 340 + 51\n- = 391\n\nTherefore, 17 × 23 = 391."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":54,"outputTokens":373,"serverToolUsage":{},"totalTokens":427}}
\ No newline at end of file
+{"metrics":{"latencyMs":1447},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"text":"The user asks to think step by step: \"What is 17 * 23? Show your reasoning process.\" So answer with multiplication step by step. Provide reasoning: break down 17*23 = 17*(20+3) = 17*20 + 17*3 = 340 + 51 = 391. Or use other method. Provide final answer 391. Provide explanation."}}},{"text":"Sure! Let’s multiply 17 by 23 step‑by‑step.\n\n### 1️⃣ Write the problem in a way that makes it easy to use the distributive property \n\\(17 \\times 23\\) can be broken into two simpler pieces by splitting one of the numbers:\n\n\\[\n23 = 20 + 3\n\\]\n\nSo:\n\n\\[\n17 \\times 23 = 17 \\times (20 + 3)\n\\]\n\n### 2️⃣ Apply the distributive property (multiply each part separately) \n\n\\[\n17 \\times (20 + 3) = (17 \\times 20) + (17 \\times 3)\n\\]\n\n### 3️⃣ Compute each of those two products \n\n- **\\(17 \\times 20\\):** \n Multiply 17 by 2 first → \\(17 \\times 2 = 34\\). \n Then add a zero because we’re really multiplying by 20 (i.e., \\(2 \\times 10\\)). \n So \\(17 \\times 20 = 340\\).\n\n- **\\(17 \\times 3\\):** \n \\(17 \\times 3 = 51\\).\n\n### 4️⃣ Add the two results together \n\n\\[\n340 + 51 = 391\n\\]\n\n### ✅ Final answer \n\n\\[\n\\boxed{391}\n\\]\n\nSo, 17 multiplied by 23 equals **391**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":83,"outputTokens":386,"serverToolUsage":{},"totalTokens":469}}522 2034
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/openai.gpt-oss-20b-1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 240
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":1024}},"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
+Content-Length: 1868
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 19:46:04 GMT
+X-Amzn-Requestid: 09db0006-430e-40f1-ab43-4cadddc636f2
+
+{"metrics":{"latencyMs":1482},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"text":"We need to compute 17 * 23. We should show step-by-step reasoning. Probably show multiplication process: 17 * 23 = 17 * (20 + 3) = 17*20 + 17*3 = 340 + 51 = 391. Or show long multiplication: 23 * 17. Let's produce a clear reasoning. Also show using distributive law and patterns. This is straightforward."}}},{"text":"**Step 1 – Recognize the numbers**\n\nWe need to multiply\n\n\\[\n17 \\times 23\n\\]\n\nBoth numbers are small enough to handle by hand or by mental arithmetic, so we can use the distributive property of multiplication over addition.\n\n---\n\n**Step 2 – Decompose one of the factors**\n\nChoose to split the number 23 into a sum that’s easier to work with:\n\n\\[\n23 = 20 + 3\n\\]\n\n---\n\n**Step 3 – Apply the distributive law**\n\n\\[\n17 \\times 23 = 17 \\times (20 + 3)\n\\]\n\nBy the distributive property, this equals\n\n\\[\n17 \\times 20 + 17 \\times 3\n\\]\n\n---\n\n**Step 4 – Compute the two simpler products**\n\n1. **\\(17 \\times 20\\)** \n Multiplying by 20 is the same as multiplying by 2 and then adding a zero (i.e., adding a factor of 10). \n \\[\n 17 \\times 2 = 34 \\quad\\Longrightarrow\\quad 34 \\times 10 = 340\n \\]\n\n2. **\\(17 \\times 3\\)** \n \\[\n 17 \\times 3 = 51\n \\]\n\n---\n\n**Step 5 – Add the results**\n\n\\[\n340 + 51 = 391\n\\]\n\n---\n\n**Result**\n\n\\[\n\\boxed{17 \\times 23 = 391}\n\\]\n\n---\n\n**Optional check (long multiplication)**\n\n```\n 17\n × 23\n -------\n 51 (17 × 3)\n+ 340 (17 × 20, shift one place left)\n -------\n 391\n```\n\nBoth methods confirm that 17 multiplied by 23 equals 391."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":83,"outputTokens":480,"serverToolUsage":{},"totalTokens":563}}523 3649
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/moonshot.kimi-k2-thinking/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 240
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":1024}},"inferenceConfig":{"maxTokens":4096},"messages":[{"content":[{"text":"Think step by step: What is 17 * 23? Show your reasoning process."}],"role":"user"}]}HTTP/2.0 200 OK
+Content-Length: 3483
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 19:46:23 GMT
+X-Amzn-Requestid: fe153ed6-94b3-40fa-a829-8667594ed2ae
+
+{"metrics":{"latencyMs":8245},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"text":" We need to calculate the product of 17 and 23. Then we also need to show the step-by-step reasoning process. Let me think about this.\n\nWe could do direct multiplication, but perhaps we can use a mental math strategy. The numbers are close to 20, so we could use the difference of squares technique or the \"multiply near a base\" technique.\n\nLet me try the difference of squares approach: 17 * 23 = (20 - 3) * (20 + 3) = 20² - 3² = 400 - 9 = 391.\n\nThat's interesting! The product is 391.\n\nBut let me also do it the traditional way: 17 * 23 = 17 * (20 + 3) = 17 * 20 + 17 * 3 = 340 + 51 = 391.\n\nOr: 23 * 17 = 23 * (10 + 7) = 230 + 161 = 391.\n\nEach method gives the same result: 391.\n\nNow, let me think about how to show the reasoning process step-by-step in a clear way. I should explain the method, break it down, and then arrive at the answer. The difference of squares method is elegant and efficient, but I could also show the standard multiplication method.\n\nSince the question asks me to \"think step by step\", I should:\n1. Identify what we're calculating (17 * 23)\n2. Choose a method (I'll go with difference of squares as it's elegant, but also mention the standard method)\n3. Show the steps\n4. Arrive at the final answer\n\nLet me structure my response to be as clear as possible.\n\nActually, let me double-check my calculation:\n17 * 23 = ?\n17 * 20 = 340\n17 * 3 = 51\n340 + 51 = 391\n\nYes, that's correct.\n\nFor the difference of squares method:\n(20 - 3) * (20 + 3) = 20² - 3² = 400 - 9 = 391\n\nThis is correct too.\n\nThe standard long multiplication:\n 17\n × 23\n ----\n 51 (17 × 3)\n 340 (17 × 20, shifted)\n ----\n 391\n\nAll methods confirm the answer is 391.\n\nNow, for the step-by-step reasoning process, I'll focus on one clear method and explain each step. The difference of squares method is particularly nice for this problem because the numbers are symmetric around 20, making the calculation very straightforward. Let me write out the reasoning:\n\nStep 1: Recognize that 17 and 23 are equidistant from 20 (they differ by ±3).\nStep 2: Use the algebraic identity (a - b)(a + b) = a² - b²\nStep 3: Set a = 20 and b = 3\nStep 4: Calculate a² = 400 and b² = 9\nStep 5: Subtract: 400 - 9 = 391\n\nThis is clean and elegant. I'll present this as the main method but also mention as an alternative the standard decomposition method to show understanding of multiple approaches."}}},{"text":" **Step 1:** Identify the multiplication problem and look for an efficient approach.\nI need to calculate 17 × 23. I notice these numbers are symmetric around 20 (17 is 3 less than 20, and 23 is 3 more than 20).\n\n**Step 2:** Use the difference of squares formula.\nI can rewrite the product as: (20 - 3) × (20 + 3)\n\n**Step 3:** Apply the algebraic identity (a - b)(a + b) = a² - b².\nHere, a = 20 and b = 3, so:\n(20 - 3) × (20 + 3) = 20² - 3²\n\n**Step 4:** Calculate each term.\n20² = 400\n3² = 9\n\n**Step 5:** Subtract to find the final answer.\n400 - 9 = **391**\n\n---\n\n**Alternative check:**\nI can also verify using the distributive property:\n17 × 23 = 17 × (20 + 3) = (17 × 20) + (17 × 3) = 340 + 51 = **391**\n\nBoth methods confirm the answer is **391**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":46,"outputTokens":920,"serverToolUsage":{},"totalTokens":966}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestAmazonReasoningStreamingConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonReasoningStreamingConverseAPI.httprr
index 8dc449e2..648130d0 100644
Binary files a/llms/bedrock/testdata/TestAmazonReasoningStreamingConverseAPI.httprr and b/llms/bedrock/testdata/TestAmazonReasoningStreamingConverseAPI.httprr differ
diff --git a/llms/bedrock/testdata/TestAmazonSequentialToolCallsWithThinkingConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonSequentialToolCallsWithThinkingConverseAPI.httprr
new file mode 100644
index 00000000..1f04064d
--- /dev/null
+++ b/llms/bedrock/testdata/TestAmazonSequentialToolCallsWithThinkingConverseAPI.httprr
@@ -0,0 +1,30 @@
+httprr trace v1
+770 1360
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 466
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":2048}},"inferenceConfig":{"maxTokens":4096,"temperature":1},"messages":[{"content":[{"text":"Calculate (5 + 3) and then multiply by 2"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"Perform a calculation","inputSchema":{"json":{"properties":{"expression":{"type":"string"}},"required":["expression"],"type":"object"}},"name":"calculate"}}]}}HTTP/2.0 200 OK
+Content-Length: 1194
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:48:15 GMT
+X-Amzn-Requestid: ed53c3b5-af84-49b0-8450-c098606f9f2c
+
+{"metrics":{"latencyMs":3157},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EuwCCkgICxABGAIqQBilFNe+5INhzkPazuSJTvJrubMx4pRE+Kb+2kD8s7gmSWWCmwLrmUxONoNlznIFuPDOEEi36mUHJsCm7ryozN0SDHw0pifl33kdexDNthoMDbrknXWBmNZeeRaNIjByT1UDoC8V/+szUCDpTO3fDBxAlQ1O9ZsmAIXda37nDHr229HG6/+6ir3AfsHqBMMq0QHfFC56b+GIVI71pK5Q716xUZ0wE/MYSZO39XHTr9FoYXJqxBC2GMRkBpzYXLAVNs3T6QMMB4YhEHmWM8DDAqBwfiPFGgOEjXRv2Byxs3PTH7vzW3Znp0cqp59Uy4v5os9bkF9dA3lb0k6JFXkv9K2m/n52dc0gF8djsCczVzdhSyq7QnaG9frkphhgs29K4PI2efhIYoT6YYxQacD/0beCzMoq7VwH2ffPDOWdVP87e64lwejUoIU6K2lS48r8ArruZ5BKuqeCEukvHo3FFKy/JBgB","text":"The user wants me to:\n1. Calculate (5 + 3)\n2. Then multiply the result by 2\n\nThis is essentially calculating (5 + 3) * 2, which equals 8 * 2 = 16.\n\nI can do this in one calculation: (5 + 3) * 2"}}},{"toolUse":{"input":{"expression":"(5 + 3) * 2"},"name":"calculate","toolUseId":"tooluse_cQy4nWyTZ0YD6iFmxNOHiX","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":597,"outputTokens":143,"serverToolUsage":{},"totalTokens":740}}1824 563
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 1519
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":2048}},"inferenceConfig":{"maxTokens":4096,"temperature":1},"messages":[{"content":[{"text":"Calculate (5 + 3) and then multiply by 2"}],"role":"user"},{"content":[{"reasoningContent":{"reasoningText":{"signature":"EuwCCkgICxABGAIqQBilFNe+5INhzkPazuSJTvJrubMx4pRE+Kb+2kD8s7gmSWWCmwLrmUxONoNlznIFuPDOEEi36mUHJsCm7ryozN0SDHw0pifl33kdexDNthoMDbrknXWBmNZeeRaNIjByT1UDoC8V/+szUCDpTO3fDBxAlQ1O9ZsmAIXda37nDHr229HG6/+6ir3AfsHqBMMq0QHfFC56b+GIVI71pK5Q716xUZ0wE/MYSZO39XHTr9FoYXJqxBC2GMRkBpzYXLAVNs3T6QMMB4YhEHmWM8DDAqBwfiPFGgOEjXRv2Byxs3PTH7vzW3Znp0cqp59Uy4v5os9bkF9dA3lb0k6JFXkv9K2m/n52dc0gF8djsCczVzdhSyq7QnaG9frkphhgs29K4PI2efhIYoT6YYxQacD/0beCzMoq7VwH2ffPDOWdVP87e64lwejUoIU6K2lS48r8ArruZ5BKuqeCEukvHo3FFKy/JBgB","text":"The user wants me to:\n1. Calculate (5 + 3)\n2. Then multiply the result by 2\n\nThis is essentially calculating (5 + 3) * 2, which equals 8 * 2 = 16.\n\nI can do this in one calculation: (5 + 3) * 2"}}}],"role":"assistant"},{"content":[{"toolUse":{"input":{"expression":"(5 + 3) * 2"},"name":"calculate","toolUseId":"tooluse_cQy4nWyTZ0YD6iFmxNOHiX"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"8"}],"toolUseId":"tooluse_cQy4nWyTZ0YD6iFmxNOHiX"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"Perform a calculation","inputSchema":{"json":{"properties":{"expression":{"type":"string"}},"required":["expression"],"type":"object"}},"name":"calculate"}}]}}HTTP/2.0 200 OK
+Content-Length: 398
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:48:18 GMT
+X-Amzn-Requestid: c1c05ece-0643-4d0f-8d45-0890a2a92ff7
+
+{"metrics":{"latencyMs":2419},"output":{"message":{"content":[{"text":"The result is **16**.\n\nTo break it down:\n- First: 5 + 3 = 8\n- Then: 8 × 2 = 16"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":753,"outputTokens":43,"serverToolUsage":{},"totalTokens":796}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestAmazonSingleToolCallWithThinkingConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonSingleToolCallWithThinkingConverseAPI.httprr
new file mode 100644
index 00000000..b0497784
--- /dev/null
+++ b/llms/bedrock/testdata/TestAmazonSingleToolCallWithThinkingConverseAPI.httprr
@@ -0,0 +1,30 @@
+httprr trace v1
+762 1364
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 458
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":2048}},"inferenceConfig":{"maxTokens":4096,"temperature":1},"messages":[{"content":[{"text":"What's the weather in Boston?"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"Get weather for a location","inputSchema":{"json":{"properties":{"location":{"type":"string"}},"required":["location"],"type":"object"}},"name":"get_weather"}}]}}HTTP/2.0 200 OK
+Content-Length: 1198
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:48:02 GMT
+X-Amzn-Requestid: eda4eb6d-a4af-4275-b548-60a790f200d4
+
+{"metrics":{"latencyMs":3751},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EvECCkgICxABGAIqQHhi2RPLJVjY2ondbMYFTjaGTKxCARpJBG6uf3ji0k5e0cCnNZsYHOUjFE4no1zIbIza9RDZ81JxzjgZKmf03dcSDFFVMZKstk3+/dXaRxoMUoFtAD/c3JZYz4XuIjBp2+D/mjtlTobiLTLiMCj8NKtEC5nV3eX3Dz3KTifdDhPwp5cr+T42rE42WDPoxQkq1gH+A52CkJZYI3e1aP1/K8j8Bhs3wgCY6kj1/bpRWQbjvNwEBnc9Emvg67ioG0MVMwi9aOG3F7fz+m+TDAePJMTRHjN3+u4JLJE6CBE/fB440f62Yi/17qLhEGwtSdJRaV4lLWKfRAMh+McoAVpIbT0raBOAbPTBaBmvvkMBom57iLhjoqHA80eJoCfsqgZF6ZYCg4YGiXqHz1K/uFtcUG+90icfZcGgp+qFsual0NvAVwOx8AVDQOkznLXgDbfRXx5DWSRNrDhvKPhaUFsXV3+GskhsMW/kGAE=","text":"The user is asking for the weather in Boston. I have access to a get_weather function that takes a location parameter. I have all the information I need to make this call - the location is \"Boston\"."}}},{"toolUse":{"input":{"location":"Boston"},"name":"get_weather","toolUseId":"tooluse_xSOkEzYy3oYAwEkWhnnZOG","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":593,"outputTokens":104,"serverToolUsage":{},"totalTokens":697}}1866 549
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 1561
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":2048}},"inferenceConfig":{"maxTokens":4096,"temperature":1},"messages":[{"content":[{"text":"What's the weather in Boston?"}],"role":"user"},{"content":[{"reasoningContent":{"reasoningText":{"signature":"EvECCkgICxABGAIqQHhi2RPLJVjY2ondbMYFTjaGTKxCARpJBG6uf3ji0k5e0cCnNZsYHOUjFE4no1zIbIza9RDZ81JxzjgZKmf03dcSDFFVMZKstk3+/dXaRxoMUoFtAD/c3JZYz4XuIjBp2+D/mjtlTobiLTLiMCj8NKtEC5nV3eX3Dz3KTifdDhPwp5cr+T42rE42WDPoxQkq1gH+A52CkJZYI3e1aP1/K8j8Bhs3wgCY6kj1/bpRWQbjvNwEBnc9Emvg67ioG0MVMwi9aOG3F7fz+m+TDAePJMTRHjN3+u4JLJE6CBE/fB440f62Yi/17qLhEGwtSdJRaV4lLWKfRAMh+McoAVpIbT0raBOAbPTBaBmvvkMBom57iLhjoqHA80eJoCfsqgZF6ZYCg4YGiXqHz1K/uFtcUG+90icfZcGgp+qFsual0NvAVwOx8AVDQOkznLXgDbfRXx5DWSRNrDhvKPhaUFsXV3+GskhsMW/kGAE=","text":"The user is asking for the weather in Boston. I have access to a get_weather function that takes a location parameter. I have all the information I need to make this call - the location is \"Boston\"."}}}],"role":"assistant"},{"content":[{"toolUse":{"input":{"location":"Boston"},"name":"get_weather","toolUseId":"tooluse_xSOkEzYy3oYAwEkWhnnZOG"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"{\"temperature\": 72, \"condition\": \"sunny\"}"}],"toolUseId":"tooluse_xSOkEzYy3oYAwEkWhnnZOG"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"Get weather for a location","inputSchema":{"json":{"properties":{"location":{"type":"string"}},"required":["location"],"type":"object"}},"name":"get_weather"}}]}}HTTP/2.0 200 OK
+Content-Length: 384
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:48:05 GMT
+X-Amzn-Requestid: 4fcac4ac-e91a-4213-a363-4ece03e794d7
+
+{"metrics":{"latencyMs":2319},"output":{"message":{"content":[{"text":"The weather in Boston is currently sunny with a temperature of 72°F."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":721,"outputTokens":19,"serverToolUsage":{},"totalTokens":740}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestAmazonStreamingOutputConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonStreamingOutputConverseAPI.httprr
index 624d56fd..2c4c8e72 100644
Binary files a/llms/bedrock/testdata/TestAmazonStreamingOutputConverseAPI.httprr and b/llms/bedrock/testdata/TestAmazonStreamingOutputConverseAPI.httprr differ
diff --git a/llms/bedrock/testdata/TestAmazonTextResponseWithThinkingConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonTextResponseWithThinkingConverseAPI.httprr
new file mode 100644
index 00000000..e8d1c33f
--- /dev/null
+++ b/llms/bedrock/testdata/TestAmazonTextResponseWithThinkingConverseAPI.httprr
@@ -0,0 +1,30 @@
+httprr trace v1
+527 1404
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 223
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":2048}},"inferenceConfig":{"maxTokens":4096,"temperature":1},"messages":[{"content":[{"text":"Solve: If x + 5 = 12, what is x?"}],"role":"user"}]}HTTP/2.0 200 OK
+Content-Length: 1238
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 09:53:35 GMT
+X-Amzn-Requestid: 5632c2b9-b84a-46d3-8f1f-7716a43b0a96
+
+{"metrics":{"latencyMs":2902},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EtsCCkgICxABGAIqQMt8Bg6o0aVrq4MmAJZgYta5Z8bVZNBUhOsdnH4JwJwP/KJ23ntE98IHRBIyhkom0srp1sAyxXNBxu7qeqA1PgISDFKlasvZZJat+NR5PxoM9UzILoRa9dHsYKzIIjAvm+MOyk5AkVWOj7A8NAZ6H08wY534kfC9pm+8ZKX3+b2bKENW0e6t1UEHR5wdhmgqwAE5YySKQOaQfuig4tYQcVtr6Ucu0D2fL/X043zMlMOSkdRIsaDJZYoC+50POh4eI1PDl4SYU5DjGILMh6Gp6oaIbBQqWEDAfrHK9uxX1w76aQN1TyAqwXj/h7O176pPe4AcZmswUMAJLHf6zm72fcHkYW9YBffXtdg4zExE2Cm7+BFB9MlZlX24XduPS0RaMCmuOnmaxr42GMluSr8Ypk0m/YypKxvq42ANrleYE0V/VtbOwEfZldAaxCQz+MT0NG0YAQ==","text":"This is a simple algebra problem. I need to solve for x.\n\nx + 5 = 12\n\nTo isolate x, I need to subtract 5 from both sides:\nx + 5 - 5 = 12 - 5\nx = 7\n\nLet me check: 7 + 5 = 12 ✓"}}},{"text":"To solve for x, I need to isolate it on one side of the equation.\n\n**Given:** x + 5 = 12\n\n**Subtract 5 from both sides:**\nx + 5 - 5 = 12 - 5\nx = 7\n\n**Answer: x = 7**\n\nTo check: 7 + 5 = 12 ✓"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":53,"outputTokens":182,"serverToolUsage":{},"totalTokens":235}}1557 1407
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 1252
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"additionalModelRequestFields":{"thinking":{"type":"enabled","budget_tokens":2048}},"inferenceConfig":{"maxTokens":4096,"temperature":1},"messages":[{"content":[{"text":"Solve: If x + 5 = 12, what is x?"}],"role":"user"},{"content":[{"reasoningContent":{"reasoningText":{"signature":"EtsCCkgICxABGAIqQMt8Bg6o0aVrq4MmAJZgYta5Z8bVZNBUhOsdnH4JwJwP/KJ23ntE98IHRBIyhkom0srp1sAyxXNBxu7qeqA1PgISDFKlasvZZJat+NR5PxoM9UzILoRa9dHsYKzIIjAvm+MOyk5AkVWOj7A8NAZ6H08wY534kfC9pm+8ZKX3+b2bKENW0e6t1UEHR5wdhmgqwAE5YySKQOaQfuig4tYQcVtr6Ucu0D2fL/X043zMlMOSkdRIsaDJZYoC+50POh4eI1PDl4SYU5DjGILMh6Gp6oaIbBQqWEDAfrHK9uxX1w76aQN1TyAqwXj/h7O176pPe4AcZmswUMAJLHf6zm72fcHkYW9YBffXtdg4zExE2Cm7+BFB9MlZlX24XduPS0RaMCmuOnmaxr42GMluSr8Ypk0m/YypKxvq42ANrleYE0V/VtbOwEfZldAaxCQz+MT0NG0YAQ==","text":"This is a simple algebra problem. I need to solve for x.\n\nx + 5 = 12\n\nTo isolate x, I need to subtract 5 from both sides:\nx + 5 - 5 = 12 - 5\nx = 7\n\nLet me check: 7 + 5 = 12 ✓"}}},{"text":"To solve for x, I need to isolate it on one side of the equation.\n\n**Given:** x + 5 = 12\n\n**Subtract 5 from both sides:**\nx + 5 - 5 = 12 - 5\nx = 7\n\n**Answer: x = 7**\n\nTo check: 7 + 5 = 12 ✓"}],"role":"assistant"},{"content":[{"text":"Now solve x + 10 = 25"}],"role":"user"}]}HTTP/2.0 200 OK
+Content-Length: 1241
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 09:53:38 GMT
+X-Amzn-Requestid: f4fb6451-3a84-4b84-b936-479b56caf712
+
+{"metrics":{"latencyMs":2775},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"signature":"EtoCCkgICxABGAIqQCaINcpLBMeeLKWkhkemjmm+zJ8h4O8WMeu2C6noTGywCkrLPFD5KYRLCpBDawM4wVZDRodkrhepUe6Hc9kafGsSDEXq/8VY/Y1qKgyBDhoMKZ7NhMSS/MqYxV/4IjDofHaSD/w3iP4rNITQSOy60PViOSAe6ONW37KdGxUhpgBu6qIcb/+CejjoSfTo4R4qvwFqJSktAdNFVdKp2Non1ZnySJJ4eePvCSWhPp3V7PAcbWVL8hmpvDSIe7FJs+1WsAN4z6zhI6MuaamibGmmDRdTA00kZcgAXvlmWdaMtsy68btT7LJHaIoe8kZWWpQcUIKNAYae22gwG4YE2TBC6i5RVap7GSbnsVpVSw1fJNvLZeek5rcpfMV6biPuNP0itzRdqtPaI7XeFZoOBqpiuGbFr9oDH1d135q3Ue3noLQ2/d2CPhcq64Cf/soip5uvExgB","text":"This is a similar problem to the previous one. I need to isolate x by subtracting 10 from both sides.\n\nx + 10 = 25\nx + 10 - 10 = 25 - 10\nx = 15\n\nLet me check: 15 + 10 = 25 ✓"}}},{"text":"To solve for x, I need to isolate it on one side of the equation.\n\n**Given:** x + 10 = 25\n\n**Subtract 10 from both sides:**\nx + 10 - 10 = 25 - 10\nx = 15\n\n**Answer: x = 15**\n\nTo check: 15 + 10 = 25 ✓"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":159,"outputTokens":178,"serverToolUsage":{},"totalTokens":337}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestAmazonTextResponseWithThinkingLegacyAPI.httprr b/llms/bedrock/testdata/TestAmazonTextResponseWithThinkingLegacyAPI.httprr
new file mode 100644
index 00000000..d1ed8b77
--- /dev/null
+++ b/llms/bedrock/testdata/TestAmazonTextResponseWithThinkingLegacyAPI.httprr
@@ -0,0 +1,42 @@
+httprr trace v1
+541 1706
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/invoke HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 226
+Accept: */*
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"anthropic_version":"bedrock-2023-05-31","max_tokens":4096,"messages":[{"role":"user","content":[{"type":"text","text":"Solve: If x + 5 = 12, what is x?"}]}],"temperature":1,"thinking":{"type":"enabled","budget_tokens":2048}}HTTP/2.0 200 OK
+Content-Length: 1324
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 09:53:47 GMT
+X-Amzn-Bedrock-Cache-Read-Input-Token-Count: 0
+X-Amzn-Bedrock-Cache-Write-Input-Token-Count: 0
+X-Amzn-Bedrock-Input-Token-Count: 53
+X-Amzn-Bedrock-Invocation-Latency: 2852
+X-Amzn-Bedrock-Output-Token-Count: 189
+X-Amzn-Requestid: b6a11904-aab1-4a19-abc9-bbbc59aa03d7
+
+{"model":"claude-sonnet-4-5-20250929","id":"msg_bdrk_01FykvttgnQcwwgLMQEdjj1W","type":"message","role":"assistant","content":[{"type":"thinking","thinking":"This is a simple linear equation. I need to solve for x.\n\nx + 5 = 12\n\nTo isolate x, I need to subtract 5 from both sides:\n\nx + 5 - 5 = 12 - 5\nx = 7\n\nLet me check: 7 + 5 = 12 ✓\n\nSo x = 7.","signature":"EucCCkgICxABGAIqQA1Bs3baE052D2zQoHInNj5chu5V28bC8iGMxs4Q3y0QuX/GjIuSBU8uIG9B3Ubn3IH0Dvf3GmyXYSOfDpfDi4ISDAogsxtiB6K7iW17zRoMDOSJMkSqATjOIcQiIjBrkoASTvvyjDByWFulTijqi+O89nC4KM6wvodmJw6MTLz7tEPsuRNWJD0rxBLq9UwqzAG4CiH4kXWSUlH4msIVzWsKGQ/ABCkntCY84C2bS+/FljjYBbjbv4rvvkYdidm3J45hEoyRX+kbFj/uLSOG9FrBmA1pmwG094TdtMbkHjNpEd0gH49H1AxcR21dfC+20XAbXHutRghdNUrTjxuWOmJneewnzbw7s0T9zmZcbyTi2DtPkgnHQbhCj3WY+SKjYt+/+FuPS6XzfQWRI7N48Dw1Iq1IZuTYhtwwfsCJzGNeY8sOttoJyoyKeg4U9D+IYhpgubnq9MLySYJtoyQYAQ=="},{"type":"text","text":"To solve for x, I need to isolate it on one side of the equation.\n\n**Given:** x + 5 = 12\n\n**Subtract 5 from both sides:**\nx + 5 - 5 = 12 - 5\nx = 7\n\n**Check:** 7 + 5 = 12 ✓\n\n**Answer: x = 7**"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":53,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":189}}1614 1715
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/invoke HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 1298
+Accept: */*
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"anthropic_version":"bedrock-2023-05-31","max_tokens":4096,"messages":[{"role":"user","content":[{"type":"text","text":"Solve: If x + 5 = 12, what is x?"}]},{"role":"assistant","content":[{"type":"thinking","thinking":"This is a simple linear equation. I need to solve for x.\n\nx + 5 = 12\n\nTo isolate x, I need to subtract 5 from both sides:\n\nx + 5 - 5 = 12 - 5\nx = 7\n\nLet me check: 7 + 5 = 12 ✓\n\nSo x = 7.","signature":"EucCCkgICxABGAIqQA1Bs3baE052D2zQoHInNj5chu5V28bC8iGMxs4Q3y0QuX/GjIuSBU8uIG9B3Ubn3IH0Dvf3GmyXYSOfDpfDi4ISDAogsxtiB6K7iW17zRoMDOSJMkSqATjOIcQiIjBrkoASTvvyjDByWFulTijqi+O89nC4KM6wvodmJw6MTLz7tEPsuRNWJD0rxBLq9UwqzAG4CiH4kXWSUlH4msIVzWsKGQ/ABCkntCY84C2bS+/FljjYBbjbv4rvvkYdidm3J45hEoyRX+kbFj/uLSOG9FrBmA1pmwG094TdtMbkHjNpEd0gH49H1AxcR21dfC+20XAbXHutRghdNUrTjxuWOmJneewnzbw7s0T9zmZcbyTi2DtPkgnHQbhCj3WY+SKjYt+/+FuPS6XzfQWRI7N48Dw1Iq1IZuTYhtwwfsCJzGNeY8sOttoJyoyKeg4U9D+IYhpgubnq9MLySYJtoyQYAQ=="},{"type":"text","text":"To solve for x, I need to isolate it on one side of the equation.\n\n**Given:** x + 5 = 12\n\n**Subtract 5 from both sides:**\nx + 5 - 5 = 12 - 5\nx = 7\n\n**Check:** 7 + 5 = 12 ✓\n\n**Answer: x = 7**"}]},{"role":"user","content":[{"type":"text","text":"Now solve x + 10 = 25"}]}],"temperature":1,"thinking":{"type":"enabled","budget_tokens":2048}}HTTP/2.0 200 OK
+Content-Length: 1332
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 09:53:51 GMT
+X-Amzn-Bedrock-Cache-Read-Input-Token-Count: 0
+X-Amzn-Bedrock-Cache-Write-Input-Token-Count: 0
+X-Amzn-Bedrock-Input-Token-Count: 159
+X-Amzn-Bedrock-Invocation-Latency: 2628
+X-Amzn-Bedrock-Output-Token-Count: 182
+X-Amzn-Requestid: d1427bd5-23f8-4dee-a5db-7cfd138390cc
+
+{"model":"claude-sonnet-4-5-20250929","id":"msg_bdrk_0161y4yYkmqTWMLv4CGdxRLa","type":"message","role":"assistant","content":[{"type":"thinking","thinking":"This is a similar problem to the previous one. I need to solve for x by isolating it.\n\nGiven: x + 10 = 25\n\nSubtract 10 from both sides:\nx + 10 - 10 = 25 - 10\nx = 15\n\nCheck: 15 + 10 = 25 ✓","signature":"EugCCkgICxABGAIqQE/DRbSu9PlP18yKbTvX0erRBolLraq5Qw6ygJoy3ioGt0SCtRD6jcV0LBh0QKsUCDUf2A6ylAC04NVN7nrohBESDEIgyuoCpRLIEF1n6BoMfNwR1uoA2GUmrx9YIjD9kpJBJy0gWHbPWJelJ874z1ylEDwwJFP3EmUF4jJT25fYG2zci7VEgnuyrtGRrK4qzQHIU8jfQ1rO3dO8HbUQNR196LeHkDZx03SdnkhiFdvGcHBsxRtmTYiH32VMWY5e9AtAmYGDYZdfTy1eYgAtllLHSfMOPSMcHSsGIRIpjyW0ssPzYkO6wZG46JGuVKK6ZxcJ/MI7LyAetwdPHk6GaLujj+Ao+qKWC5dsmF4xAvhJBbyIXWd19csNbFGzhml7r2gFwO3+9ESG34wQub7zxjuQIJyRyHhqzHeHp3OVyCKuHS5oSc9ykQ/of4P2+yBCnA13LMWCuqo1jTVFzh7SGAE="},{"type":"text","text":"To solve for x, I need to isolate it on one side of the equation.\n\n**Given:** x + 10 = 25\n\n**Subtract 10 from both sides:**\nx + 10 - 10 = 25 - 10\nx = 15\n\n**Check:** 15 + 10 = 25 ✓\n\n**Answer: x = 15**"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":159,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":182}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestAmazonTextResponseWithThinkingStreamingConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonTextResponseWithThinkingStreamingConverseAPI.httprr
new file mode 100644
index 00000000..592aa20b
Binary files /dev/null and b/llms/bedrock/testdata/TestAmazonTextResponseWithThinkingStreamingConverseAPI.httprr differ
diff --git a/llms/bedrock/testdata/TestAmazonToolCallingConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonToolCallingConverseAPI.httprr
index 17d32ecb..eabecc9f 100644
--- a/llms/bedrock/testdata/TestAmazonToolCallingConverseAPI.httprr
+++ b/llms/bedrock/testdata/TestAmazonToolCallingConverseAPI.httprr
@@ -10,24 +10,24 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
Content-Length: 322
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:05 GMT
-X-Amzn-Requestid: 8ecc827f-1db1-433a-899f-5be3a2bb7af2
+Date: Tue, 03 Mar 2026 16:57:50 GMT
+X-Amzn-Requestid: d0028f18-7c5e-46a3-b00a-f9ce39c6eadc
-{"metrics":{"latencyMs":513},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15.0,"b":8.0},"name":"calculator","toolUseId":"tooluse_cJ9wjzN0SYOS9zyb5L9RjQ"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":980,"outputTokens":45,"serverToolUsage":{},"totalTokens":1025}}1100 387
+{"metrics":{"latencyMs":567},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15.0,"b":8.0},"name":"calculator","toolUseId":"tooluse_LwmV0qafjcmbQKDnTlIKZv"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":980,"outputTokens":45,"serverToolUsage":{},"totalTokens":1025}}1143 383
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-2-lite-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
-Content-Length: 814
+Content-Length: 857
Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_cJ9wjzN0SYOS9zyb5L9RjQ"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_cJ9wjzN0SYOS9zyb5L9RjQ"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 222
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15.0","b":"8.0","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_LwmV0qafjcmbQKDnTlIKZv"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_LwmV0qafjcmbQKDnTlIKZv"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 218
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:07 GMT
-X-Amzn-Requestid: 6c7b8e45-8e18-45f9-9923-87c3ad4b6b5c
+Date: Tue, 03 Mar 2026 16:58:06 GMT
+X-Amzn-Requestid: 98f07492-56c2-4863-971b-b1001e5ff488
-{"metrics":{"latencyMs":419},"output":{"message":{"content":[{"text":"15 * 8 = **120**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":1020,"outputTokens":11,"serverToolUsage":{},"totalTokens":1031}}861 684
+{"metrics":{"latencyMs":436},"output":{"message":{"content":[{"text":"15 * 8 = 120"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":1055,"outputTokens":10,"serverToolUsage":{},"totalTokens":1065}}861 1015
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-premier-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -36,26 +36,26 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 519
+Content-Length: 850
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:11 GMT
-X-Amzn-Requestid: 8b87e4ed-f52f-4871-ac0c-646edcc70ec4
+Date: Tue, 03 Mar 2026 16:58:17 GMT
+X-Amzn-Requestid: ed956ada-c5e9-4220-9d47-e26c23c12303
-{"metrics":{"latencyMs":3113},"output":{"message":{"content":[{"text":"The user wants to multiply 15 by 8. The calculator tool can handle this as it supports multiplication operations. I'll use the calculator with the provided numbers.\n\n"},{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_qpz9K2ctQq6lXj7mWJr31Q"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":777,"outputTokens":66,"serverToolUsage":{},"totalTokens":843}}1101 1011
+{"metrics":{"latencyMs":4485},"output":{"message":{"content":[{"text":"The user's request is to calculate 15 multiplied by 8. Since multiplication is one of the basic arithmetic operations supported by the calculator tool, I can proceed directly. First, I'll verify that both numbers are integers and the operation is valid. The calculator requires parameters: operation (string), a (number), and b (number). Here, operation=\"multiply\", a=15, and b=8 all meet the required data types. No other tools are needed as this is a straightforward multiplication problem.\n\n"},{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_GAVVsg1gytFgCDl6AnVVwL"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":777,"outputTokens":137,"serverToolUsage":{},"totalTokens":914}}1140 768
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-premier-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
-Content-Length: 814
+Content-Length: 853
Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_qpz9K2ctQq6lXj7mWJr31Q"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_qpz9K2ctQq6lXj7mWJr31Q"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 846
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_GAVVsg1gytFgCDl6AnVVwL"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_GAVVsg1gytFgCDl6AnVVwL"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 603
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:19 GMT
-X-Amzn-Requestid: 029814d6-ee12-4c57-926f-6f6a57ad1763
+Date: Tue, 03 Mar 2026 16:58:36 GMT
+X-Amzn-Requestid: 1001a07e-ccb3-40e7-a86e-2a4db5f6b30b
-{"metrics":{"latencyMs":6634},"output":{"message":{"content":[{"text":"The calculator tool was used to multiply 15 by 8. The operation performed was a multiplication, which is one of the basic arithmetic operations supported by the tool. The parameters provided were operation=\"multiply\", a=15, and b=8. These values are valid according to the tool's requirements, as both a and b are numbers and the operation is in the allowed enum list. The result obtained from the tool was 120, which is the correct product of 15 and 8. Since the calculation was straightforward and the tool provided the expected result, no further tools or steps are needed. The result of 15 multiplied by 8 is 120."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":820,"outputTokens":148,"serverToolUsage":{},"totalTokens":968}}857 628
+{"metrics":{"latencyMs":2872},"output":{"message":{"content":[{"text":"The multiplication of 15 and 8 has been calculated using the tool, resulting in 120. This is a straightforward arithmetic operation where each digit of the second number is multiplied by the first number, then the results are summed, taking into account the positional value. The tool has provided the correct result for this operation. The result of 15 multiplied by 8 is 120."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":832,"outputTokens":88,"serverToolUsage":{},"totalTokens":920}}857 681
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-pro-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -64,26 +64,26 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 463
+Content-Length: 516
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:21 GMT
-X-Amzn-Requestid: 845a59e2-fd6d-41bd-be4d-a5d8e14efe41
+Date: Tue, 03 Mar 2026 16:58:43 GMT
+X-Amzn-Requestid: a2c18054-d33c-486a-b9aa-1fb44c95dbc9
-{"metrics":{"latencyMs":1033},"output":{"message":{"content":[{"text":" The user has requested a multiplication operation. I will use the calculator tool to perform this operation. \n"},{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_gnH1Q_N9RCaV52Z9jCo8pA"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":462,"outputTokens":50,"serverToolUsage":{},"totalTokens":512}}1097 397
+{"metrics":{"latencyMs":1188},"output":{"message":{"content":[{"text":" To solve the multiplication of 15 and 8, I will use the calculator tool with the operation set to 'multiply', the first number as 15, and the second number as 8. \n"},{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_8QAF4wuKQA0tA30UguZVEU"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":462,"outputTokens":74,"serverToolUsage":{},"totalTokens":536}}1136 398
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-pro-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
-Content-Length: 814
+Content-Length: 853
Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_gnH1Q_N9RCaV52Z9jCo8pA"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_gnH1Q_N9RCaV52Z9jCo8pA"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 232
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_8QAF4wuKQA0tA30UguZVEU"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_8QAF4wuKQA0tA30UguZVEU"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 233
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:23 GMT
-X-Amzn-Requestid: 1a2cc193-40fa-492d-87f1-be9f5f8cf78d
+Date: Tue, 03 Mar 2026 16:59:01 GMT
+X-Amzn-Requestid: fa6cb90c-2eca-41fe-b315-ee4c0509cc69
-{"metrics":{"latencyMs":554},"output":{"message":{"content":[{"text":"The result of 15 * 8 is 120."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":503,"outputTokens":15,"serverToolUsage":{},"totalTokens":518}}858 626
+{"metrics":{"latencyMs":1258},"output":{"message":{"content":[{"text":"The result of 15 * 8 is 120."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":515,"outputTokens":15,"serverToolUsage":{},"totalTokens":530}}858 679
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-lite-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -92,26 +92,26 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 461
+Content-Length: 514
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:24 GMT
-X-Amzn-Requestid: af1f80d1-05ac-4c64-ad6f-1158fbf8c224
+Date: Tue, 03 Mar 2026 16:59:08 GMT
+X-Amzn-Requestid: ae093267-17b5-4e07-9b50-984c58832f21
-{"metrics":{"latencyMs":705},"output":{"message":{"content":[{"text":"The User's request is to calculate the product of 15 and 8. The tool 'calculator' can perform this operation.\n"},{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_XRIMmY-YTMi9b08_V2j7mA"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":462,"outputTokens":59,"serverToolUsage":{},"totalTokens":521}}1098 527
+{"metrics":{"latencyMs":823},"output":{"message":{"content":[{"text":"The User wants to calculate the product of 15 and 8. The calculator tool can perform this operation. I will use the calculator tool with the 'multiply' operation.\n"},{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_BwmUooY87MBMCcvyedVDKW"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":462,"outputTokens":66,"serverToolUsage":{},"totalTokens":528}}1137 524
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-lite-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
-Content-Length: 814
+Content-Length: 853
Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_XRIMmY-YTMi9b08_V2j7mA"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_XRIMmY-YTMi9b08_V2j7mA"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 362
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_BwmUooY87MBMCcvyedVDKW"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_BwmUooY87MBMCcvyedVDKW"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 359
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:26 GMT
-X-Amzn-Requestid: 54e5bba6-9728-4624-8102-cc0f01430f14
+Date: Tue, 03 Mar 2026 16:59:25 GMT
+X-Amzn-Requestid: 86e8f56d-c1bf-4d6d-859e-b2384a68f46e
-{"metrics":{"latencyMs":657},"output":{"message":{"content":[{"text":" I have the result from the calculator tool. The multiplication of 15 and 8 is 120. \n The result of 15 * 8 is 120. "}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":503,"outputTokens":51,"serverToolUsage":{},"totalTokens":554}}859 633
+{"metrics":{"latencyMs":703},"output":{"message":{"content":[{"text":" I have the result from the calculator tool, which shows that 15 * 8 equals 120. \n The result of 15 * 8 is 120. "}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":515,"outputTokens":51,"serverToolUsage":{},"totalTokens":566}}859 638
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-micro-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -120,27 +120,27 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 468
+Content-Length: 473
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:28 GMT
-X-Amzn-Requestid: 20b5fa05-2cc6-4803-9d0e-f21af2016d3e
+Date: Tue, 03 Mar 2026 16:59:31 GMT
+X-Amzn-Requestid: ab029dae-60ac-45ec-93ba-48c326ea0706
-{"metrics":{"latencyMs":516},"output":{"message":{"content":[{"text":" The User wants to calculate the product of 15 and 8. I can use the calculator tool to perform this multiplication. \n"},{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_1BiuAtKKQvWnjNB1emhidg"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":462,"outputTokens":57,"serverToolUsage":{},"totalTokens":519}}1099 397
+{"metrics":{"latencyMs":535},"output":{"message":{"content":[{"text":" The user has requested a multiplication calculation of 15 * 8. I can use the calculator tool to perform this operation. \n"},{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_1ACatNfn2I9OBzAmC3yKOF"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":462,"outputTokens":57,"serverToolUsage":{},"totalTokens":519}}1138 413
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.amazon.nova-micro-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
-Content-Length: 814
+Content-Length: 853
Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_1BiuAtKKQvWnjNB1emhidg"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_1BiuAtKKQvWnjNB1emhidg"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 232
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_1ACatNfn2I9OBzAmC3yKOF"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_1ACatNfn2I9OBzAmC3yKOF"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 248
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:29 GMT
-X-Amzn-Requestid: fac42b2b-0c33-47fc-90fd-1e490d6b3a08
+Date: Tue, 03 Mar 2026 16:59:48 GMT
+X-Amzn-Requestid: 788155f3-056d-4677-a9a4-1c80598fea3d
-{"metrics":{"latencyMs":394},"output":{"message":{"content":[{"text":"The result of 15 * 8 is 120."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":503,"outputTokens":15,"serverToolUsage":{},"totalTokens":518}}876 611
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-5-20251101-v1%3A0/converse HTTP/1.1
+{"metrics":{"latencyMs":404},"output":{"message":{"content":[{"text":"The result of the calculation 15 * 8 is 120."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":515,"outputTokens":17,"serverToolUsage":{},"totalTokens":532}}863 611
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-6-v1/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
Content-Length: 574
@@ -150,25 +150,25 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
Content-Length: 446
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:33 GMT
-X-Amzn-Requestid: c4cc4ec3-44b0-4e97-b98a-e683ebe8ffd7
+Date: Tue, 03 Mar 2026 16:59:56 GMT
+X-Amzn-Requestid: e4521d57-97a7-423e-97a4-6a38f8a2933f
-{"metrics":{"latencyMs":2123},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_KnTDpjlWQniyhKdzmHeanw","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":628,"outputTokens":85,"serverToolUsage":{},"totalTokens":713}}1116 513
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-5-20251101-v1%3A0/converse HTTP/1.1
+{"metrics":{"latencyMs":2238},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_TF8pVu8N2CuZZCKtj9PxGS","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":629,"outputTokens":86,"serverToolUsage":{},"totalTokens":715}}1142 517
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-6-v1/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
-Content-Length: 814
+Content-Length: 853
Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_KnTDpjlWQniyhKdzmHeanw"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_KnTDpjlWQniyhKdzmHeanw"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 348
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_TF8pVu8N2CuZZCKtj9PxGS"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_TF8pVu8N2CuZZCKtj9PxGS"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 352
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:37 GMT
-X-Amzn-Requestid: 92f0d4b9-726d-441a-8538-a3bcb72775ad
+Date: Tue, 03 Mar 2026 17:00:14 GMT
+X-Amzn-Requestid: c938fad7-657a-47f6-ba88-c5f7815d5b56
-{"metrics":{"latencyMs":3074},"output":{"message":{"content":[{"text":"The result of 15 × 8 is **120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":676,"outputTokens":17,"serverToolUsage":{},"totalTokens":693}}877 610
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-haiku-4-5-20251001-v1%3A0/converse HTTP/1.1
+{"metrics":{"latencyMs":1795},"output":{"message":{"content":[{"text":"The result of **15 × 8** is **120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":728,"outputTokens":17,"serverToolUsage":{},"totalTokens":745}}862 665
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-6/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
Content-Length: 574
@@ -176,55 +176,170 @@ Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 445
+Content-Length: 500
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:39 GMT
-X-Amzn-Requestid: a112c85c-aa78-4c48-8148-418c90be89d1
+Date: Tue, 03 Mar 2026 17:00:22 GMT
+X-Amzn-Requestid: 1c30d501-93c0-4691-8d12-97b545808932
-{"metrics":{"latencyMs":940},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_1WECBHlDTLCfHJcmb1uW4w","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":628,"outputTokens":86,"serverToolUsage":{},"totalTokens":714}}1117 495
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-haiku-4-5-20251001-v1%3A0/converse HTTP/1.1
+{"metrics":{"latencyMs":1502},"output":{"message":{"content":[{"text":"I'll calculate 15 * 8 for you right away!"},{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_gYGMT5G3aVmOxo2jhhqnuD","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":629,"outputTokens":101,"serverToolUsage":{},"totalTokens":730}}1141 512
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-6/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
-Content-Length: 814
+Content-Length: 853
Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_1WECBHlDTLCfHJcmb1uW4w"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_1WECBHlDTLCfHJcmb1uW4w"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 330
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:41 GMT
-X-Amzn-Requestid: 95acb377-c780-47d3-97b2-f89c2af0167a
-
-{"metrics":{"latencyMs":644},"output":{"message":{"content":[{"text":"15 * 8 = **120**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":676,"outputTokens":13,"serverToolUsage":{},"totalTokens":689}}878 611
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 574
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 446
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:46 GMT
-X-Amzn-Requestid: eaad1d1f-a6cc-4914-9ea2-e067ede9b6c4
-
-{"metrics":{"latencyMs":3771},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_ql8hDScwTcuWhAYxz2Eeuw","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":628,"outputTokens":85,"serverToolUsage":{},"totalTokens":713}}1118 512
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 814
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_ql8hDScwTcuWhAYxz2Eeuw"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_ql8hDScwTcuWhAYxz2Eeuw"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_gYGMT5G3aVmOxo2jhhqnuD"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_gYGMT5G3aVmOxo2jhhqnuD"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
Content-Length: 347
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:49 GMT
-X-Amzn-Requestid: a1727ccd-919d-4d51-8f0c-07fcc2358bd0
+Date: Tue, 03 Mar 2026 17:00:39 GMT
+X-Amzn-Requestid: 3d8a87c5-8d14-40da-ad1d-63c7f5909b69
-{"metrics":{"latencyMs":1780},"output":{"message":{"content":[{"text":"The result of 15 * 8 is **120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":676,"outputTokens":17,"serverToolUsage":{},"totalTokens":693}}874 653
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-20250514-v1%3A0/converse HTTP/1.1
+{"metrics":{"latencyMs":1067},"output":{"message":{"content":[{"text":"The result of **15 × 8 = 120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":728,"outputTokens":17,"serverToolUsage":{},"totalTokens":745}}876 611
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-5-20251101-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 446
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:00:48 GMT
+X-Amzn-Requestid: 9327ac6c-0cbb-4a21-8bcc-c173cdcbc841
+
+{"metrics":{"latencyMs":2318},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_g5vGsMeFhNl3t52qor3tn5","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":628,"outputTokens":85,"serverToolUsage":{},"totalTokens":713}}1155 497
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-5-20251101-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_g5vGsMeFhNl3t52qor3tn5"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_g5vGsMeFhNl3t52qor3tn5"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 332
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:01:06 GMT
+X-Amzn-Requestid: 69a8b20f-cd83-4811-abcf-9d1758cc189b
+
+{"metrics":{"latencyMs":1846},"output":{"message":{"content":[{"text":"15 × 8 = **120**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":727,"outputTokens":13,"serverToolUsage":{},"totalTokens":740}}877 611
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-haiku-4-5-20251001-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 446
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:01:13 GMT
+X-Amzn-Requestid: 6fdfdd42-310d-470f-aeaa-e2056b7d6e89
+
+{"metrics":{"latencyMs":1311},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_0HvrFMK50GvjaGQF2cskFH","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":628,"outputTokens":86,"serverToolUsage":{},"totalTokens":714}}1156 512
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-haiku-4-5-20251001-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_0HvrFMK50GvjaGQF2cskFH"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_0HvrFMK50GvjaGQF2cskFH"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 347
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:01:30 GMT
+X-Amzn-Requestid: d4d8b21f-40f3-426f-b66b-1146a72a78e1
+
+{"metrics":{"latencyMs":1119},"output":{"message":{"content":[{"text":"The result of 15 * 8 is **120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":727,"outputTokens":17,"serverToolUsage":{},"totalTokens":744}}878 611
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 446
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:01:38 GMT
+X-Amzn-Requestid: d74dd5ff-ee88-4e64-a38c-ae4ab12713a1
+
+{"metrics":{"latencyMs":2084},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_2mOVV8liCIWg1lN51HiyNM","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":628,"outputTokens":85,"serverToolUsage":{},"totalTokens":713}}1157 496
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_2mOVV8liCIWg1lN51HiyNM"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_2mOVV8liCIWg1lN51HiyNM"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 331
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:01:56 GMT
+X-Amzn-Requestid: 94d40744-0f2e-4677-bae7-af5e6c44685f
+
+{"metrics":{"latencyMs":1626},"output":{"message":{"content":[{"text":"15 * 8 = **120**"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":727,"outputTokens":13,"serverToolUsage":{},"totalTokens":740}}876 611
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-1-20250805-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 446
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:02:08 GMT
+X-Amzn-Requestid: 3c3d13da-6533-4e6f-895f-a832d991429b
+
+{"metrics":{"latencyMs":5542},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_UpVvvudZcCsi7uENeqkh28","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":445,"outputTokens":85,"serverToolUsage":{},"totalTokens":530}}1155 336
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-1-20250805-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_UpVvvudZcCsi7uENeqkh28"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_UpVvvudZcCsi7uENeqkh28"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 429 Too Many Requests
+Content-Length: 65
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:02:24 GMT
+X-Amzn-Errortype: ThrottlingException:http://internal.amazon.com/coral/com.amazon.bedrock/
+X-Amzn-Requestid: f30357b9-c08f-4fae-9e87-4ebc318676ae
+
+{"message":"Too many requests, please wait before trying again."}1155 336
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-1-20250805-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_UpVvvudZcCsi7uENeqkh28"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_UpVvvudZcCsi7uENeqkh28"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 429 Too Many Requests
+Content-Length: 65
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:02:27 GMT
+X-Amzn-Errortype: ThrottlingException:http://internal.amazon.com/coral/com.amazon.bedrock/
+X-Amzn-Requestid: a81b37bf-ce19-47bd-b2ce-65980cf44fa5
+
+{"message":"Too many requests, please wait before trying again."}1155 336
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-1-20250805-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_UpVvvudZcCsi7uENeqkh28"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_UpVvvudZcCsi7uENeqkh28"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 429 Too Many Requests
+Content-Length: 65
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:02:29 GMT
+X-Amzn-Errortype: ThrottlingException:http://internal.amazon.com/coral/com.amazon.bedrock/
+X-Amzn-Requestid: de012399-0645-4352-ba84-be5cad73bca0
+
+{"message":"Too many requests, please wait before trying again."}876 653
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-20250514-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
Content-Length: 574
@@ -234,80 +349,24 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
Content-Length: 488
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:39:56 GMT
-X-Amzn-Requestid: b8902e91-920a-4e12-8a20-8a308698b57f
+Date: Tue, 03 Mar 2026 17:02:33 GMT
+X-Amzn-Requestid: c8eab77f-2e2c-47f1-93a5-2b85e6ea142e
-{"metrics":{"latencyMs":6297},"output":{"message":{"content":[{"text":"I'll calculate 15 * 8 for you."},{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_6wshjV5LRxSyHTElNv5mbA","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":445,"outputTokens":99,"serverToolUsage":{},"totalTokens":544}}1114 492
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-20250514-v1%3A0/converse HTTP/1.1
+{"metrics":{"latencyMs":2529},"output":{"message":{"content":[{"text":"I'll calculate 15 * 8 for you."},{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_LBtQdU6wz1R5WeS6ohdnIj","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":445,"outputTokens":99,"serverToolUsage":{},"totalTokens":544}}1155 492
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-20250514-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
-Content-Length: 814
+Content-Length: 853
Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_6wshjV5LRxSyHTElNv5mbA"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_6wshjV5LRxSyHTElNv5mbA"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_LBtQdU6wz1R5WeS6ohdnIj"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_LBtQdU6wz1R5WeS6ohdnIj"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
Content-Length: 327
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:40:00 GMT
-X-Amzn-Requestid: b635123e-b6f1-442f-9f48-7c7ecf853ef5
+Date: Tue, 03 Mar 2026 17:02:51 GMT
+X-Amzn-Requestid: d2c1d8e9-c850-4338-9c54-2b13dbc422cf
-{"metrics":{"latencyMs":3127},"output":{"message":{"content":[{"text":"15 * 8 = 120"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":493,"outputTokens":12,"serverToolUsage":{},"totalTokens":505}}876 653
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-20250514-v1%3A0/converse HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 574
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 488
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:40:03 GMT
-X-Amzn-Requestid: 75041c74-fb4e-41ea-a091-4a008f98b156
-
-{"metrics":{"latencyMs":1317},"output":{"message":{"content":[{"text":"I'll calculate 15 * 8 for you."},{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_jygB95lURB2E530Sg9MXGg","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":445,"outputTokens":99,"serverToolUsage":{},"totalTokens":544}}1116 511
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-20250514-v1%3A0/converse HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 814
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_jygB95lURB2E530Sg9MXGg"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_jygB95lURB2E530Sg9MXGg"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 346
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:40:05 GMT
-X-Amzn-Requestid: 53bac7bd-095f-4572-82ec-6b03a5c022fa
-
-{"metrics":{"latencyMs":787},"output":{"message":{"content":[{"text":"The result of 15 * 8 is **120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":493,"outputTokens":17,"serverToolUsage":{},"totalTokens":510}}878 680
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-3-7-sonnet-20250219-v1%3A0/converse HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 574
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 515
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:40:09 GMT
-X-Amzn-Requestid: 72afee62-f8d7-4b69-b310-5e0693e09d07
-
-{"metrics":{"latencyMs":3366},"output":{"message":{"content":[{"text":"I'll calculate 15 * 8 for you using the calculator tool."},{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_JAzSG41ASNalAHsNxaRZAw","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":445,"outputTokens":103,"serverToolUsage":{},"totalTokens":548}}1118 508
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-3-7-sonnet-20250219-v1%3A0/converse HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 814
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_JAzSG41ASNalAHsNxaRZAw"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_JAzSG41ASNalAHsNxaRZAw"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 343
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:40:12 GMT
-X-Amzn-Requestid: 729e385a-a68b-449c-9b23-40696cbcdf8a
-
-{"metrics":{"latencyMs":1499},"output":{"message":{"content":[{"text":"The result of 15 * 8 is 120."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":492,"outputTokens":18,"serverToolUsage":{},"totalTokens":510}}877 693
+{"metrics":{"latencyMs":2397},"output":{"message":{"content":[{"text":"15 * 8 = 120"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":544,"outputTokens":12,"serverToolUsage":{},"totalTokens":556}}877 693
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-3-5-haiku-20241022-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -318,24 +377,24 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
Content-Length: 528
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:40:15 GMT
-X-Amzn-Requestid: 2778cdc3-abc0-4cbd-9b32-f11b2f33e359
+Date: Tue, 03 Mar 2026 17:02:59 GMT
+X-Amzn-Requestid: 2b4ef6f4-ab95-491c-8699-2d3579b63c98
-{"metrics":{"latencyMs":2187},"output":{"message":{"content":[{"text":"I'll help you calculate 15 multiplied by 8 using the calculator tool."},{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_JTEzhwB_Shy56QQI4lV9sQ","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":396,"outputTokens":105,"serverToolUsage":{},"totalTokens":501}}1117 578
+{"metrics":{"latencyMs":1915},"output":{"message":{"content":[{"text":"I'll help you calculate 15 multiplied by 8 using the calculator tool."},{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_BnHGFzo8AoF6yDpiPwuY63","type":"tool_use"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":396,"outputTokens":105,"serverToolUsage":{},"totalTokens":501}}1156 507
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-3-5-haiku-20241022-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
-Content-Length: 814
+Content-Length: 853
Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_JTEzhwB_Shy56QQI4lV9sQ"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_JTEzhwB_Shy56QQI4lV9sQ"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
-Content-Length: 413
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_BnHGFzo8AoF6yDpiPwuY63"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_BnHGFzo8AoF6yDpiPwuY63"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 342
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:40:17 GMT
-X-Amzn-Requestid: 7bfb242c-ccd3-4232-85ff-437728b6cd39
+Date: Tue, 03 Mar 2026 17:03:16 GMT
+X-Amzn-Requestid: 6cad71f4-b67c-4ea8-8c17-abc9e20f7e20
-{"metrics":{"latencyMs":1214},"output":{"message":{"content":[{"text":"I can confirm that 15 * 8 = 120. I used the calculator tool to multiply these two numbers for you."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":443,"outputTokens":32,"serverToolUsage":{},"totalTokens":475}}860 545
+{"metrics":{"latencyMs":764},"output":{"message":{"content":[{"text":"The result of 15 * 8 is 120."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":494,"outputTokens":18,"serverToolUsage":{},"totalTokens":512}}860 545
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/cohere.command-r-plus-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
@@ -346,21 +405,329 @@ Content-Type: application/json
{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
Content-Length: 380
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:40:21 GMT
-X-Amzn-Requestid: d1d96796-6e66-4e1e-9bc1-c688e161097a
+Date: Tue, 03 Mar 2026 17:03:24 GMT
+X-Amzn-Requestid: 7fb892a4-434c-49cb-8eef-87504a55064b
-{"metrics":{"latencyMs":2108},"output":{"message":{"content":[{"text":"I will use the calculator tool to multiply 15 and 8."},{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_EZaDYqSSRDyTnGgSQK1Cug"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":39,"outputTokens":30,"serverToolUsage":{},"totalTokens":69}}1100 389
+{"metrics":{"latencyMs":2072},"output":{"message":{"content":[{"text":"I will use the calculator tool to multiply 15 and 8."},{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_jrsLqewNLRB5g9loWRJPrd"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":39,"outputTokens":30,"serverToolUsage":{},"totalTokens":69}}1139 389
POST https://bedrock-runtime.us-east-1.amazonaws.com/model/cohere.command-r-plus-v1%3A0/converse HTTP/1.1
Host: bedrock-runtime.us-east-1.amazonaws.com
User-Agent: langchaingo-httprr
-Content-Length: 814
+Content-Length: 853
Authorization: AWS4-HMAC-SHA256 test-api-key
Content-Type: application/json
-{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{},"name":"calculator","toolUseId":"tooluse_EZaDYqSSRDyTnGgSQK1Cug"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_EZaDYqSSRDyTnGgSQK1Cug"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_jrsLqewNLRB5g9loWRJPrd"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_jrsLqewNLRB5g9loWRJPrd"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
Content-Length: 224
Content-Type: application/json
-Date: Fri, 23 Jan 2026 13:40:23 GMT
-X-Amzn-Requestid: cb84d2fe-a47f-472d-9a62-09f6a9f11bd3
+Date: Tue, 03 Mar 2026 17:03:42 GMT
+X-Amzn-Requestid: a807f650-5c9f-4c7f-b180-b04143e5202a
-{"metrics":{"latencyMs":1523},"output":{"message":{"content":[{"text":"The answer is **120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":51,"outputTokens":8,"serverToolUsage":{},"totalTokens":59}}
\ No newline at end of file
+{"metrics":{"latencyMs":1540},"output":{"message":{"content":[{"text":"The answer is **120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":51,"outputTokens":8,"serverToolUsage":{},"totalTokens":59}}845 541
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/deepseek.v3.2/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 376
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:03:51 GMT
+X-Amzn-Requestid: ddffb646-5eb2-4597-a1d3-9b4024fac4f7
+
+{"metrics":{"latencyMs":2769},"output":{"message":{"content":[{"text":"I'll calculate 15 multiplied by 8 for you.\n\n"},{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_334wv9zhg7tzewY9cqMWeA"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":375,"outputTokens":87,"serverToolUsage":{},"totalTokens":462}}1124 382
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/deepseek.v3.2/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_334wv9zhg7tzewY9cqMWeA"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_334wv9zhg7tzewY9cqMWeA"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 217
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:04:12 GMT
+X-Amzn-Requestid: be2e88be-834a-4e70-a4ca-f885ec790b30
+
+{"metrics":{"latencyMs":4368},"output":{"message":{"content":[{"text":"15 × 8 = 120"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":468,"outputTokens":8,"serverToolUsage":{},"totalTokens":476}}857 592
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/openai.gpt-oss-120b-1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 427
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:04:18 GMT
+X-Amzn-Requestid: 6ac40649-f91a-4e0e-94f8-ff370356f625
+
+{"metrics":{"latencyMs":338},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"text":"We need to calculate 15 * 8 = 120. Use calculator function."}}},{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_fsETLVAPPAiK8P5CQ95KEZ"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":159,"outputTokens":59,"serverToolUsage":{},"totalTokens":218}}1136 529
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/openai.gpt-oss-120b-1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_fsETLVAPPAiK8P5CQ95KEZ"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_fsETLVAPPAiK8P5CQ95KEZ"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 364
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:04:35 GMT
+X-Amzn-Requestid: 91d7ae30-c3db-4161-a51a-7f67727f53fb
+
+{"metrics":{"latencyMs":557},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"text":"The user asks to calculate 15 * 8. We have the result 120. Need to output final answer."}}},{"text":"15 × 8 = 120."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":198,"outputTokens":44,"serverToolUsage":{},"totalTokens":242}}856 568
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/openai.gpt-oss-20b-1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 403
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:04:42 GMT
+X-Amzn-Requestid: 85bc2d9f-5c83-40bf-977e-fb52c3d8e686
+
+{"metrics":{"latencyMs":657},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"text":"We need to use the calculator tool."}}},{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_uNWH7xzECAH8tqzW9ON8gC"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":159,"outputTokens":40,"serverToolUsage":{},"totalTokens":199}}1135 563
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/openai.gpt-oss-20b-1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_uNWH7xzECAH8tqzW9ON8gC"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_uNWH7xzECAH8tqzW9ON8gC"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 398
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:04:58 GMT
+X-Amzn-Requestid: f438b693-dd8b-498a-ab3e-829c97cacf1a
+
+{"metrics":{"latencyMs":301},"output":{"message":{"content":[{"reasoningContent":{"reasoningText":{"text":"The user asked to calculate 15 * 8. The assistant already did. Possibly they want the result. The final answer is 120. So respond with that."}}},{"text":"120"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":198,"outputTokens":45,"serverToolUsage":{},"totalTokens":243}}855 483
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-next-80b-a3b/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 318
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:05:05 GMT
+X-Amzn-Requestid: d4e278e0-8c7c-4e51-bc78-7b803669c5b1
+
+{"metrics":{"latencyMs":1033},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_4vv10vuf06MMOcflIltWAI"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":221,"outputTokens":32,"serverToolUsage":{},"totalTokens":253}}1134 409
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-next-80b-a3b/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_4vv10vuf06MMOcflIltWAI"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_4vv10vuf06MMOcflIltWAI"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 244
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:05:22 GMT
+X-Amzn-Requestid: c3997954-0f19-4e79-8213-3e13ef219f86
+
+{"metrics":{"latencyMs":515},"output":{"message":{"content":[{"text":"The result of 15 multiplied by 8 is 120."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":270,"outputTokens":17,"serverToolUsage":{},"totalTokens":287}}855 482
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-vl-235b-a22b/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 317
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:05:29 GMT
+X-Amzn-Requestid: 08d165d9-9b07-4615-b07d-c490ae80a223
+
+{"metrics":{"latencyMs":806},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_uWA2ORAozJQdxtIuJ5UKRO"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":221,"outputTokens":32,"serverToolUsage":{},"totalTokens":253}}1134 401
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-vl-235b-a22b/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_uWA2ORAozJQdxtIuJ5UKRO"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_uWA2ORAozJQdxtIuJ5UKRO"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 236
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:05:46 GMT
+X-Amzn-Requestid: 9de9b4ac-d7ae-4b6a-909c-d7ec9b37f55a
+
+{"metrics":{"latencyMs":575},"output":{"message":{"content":[{"text":"The result of 15 * 8 is **120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":269,"outputTokens":17,"serverToolUsage":{},"totalTokens":286}}853 483
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-32b-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 318
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:05:53 GMT
+X-Amzn-Requestid: f2e8aea1-d8ce-4983-8ff2-8475ae387b5f
+
+{"metrics":{"latencyMs":1407},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_47IkYlf21JuVlGZosNMnLs"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":225,"outputTokens":32,"serverToolUsage":{},"totalTokens":257}}1132 410
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-32b-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_47IkYlf21JuVlGZosNMnLs"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_47IkYlf21JuVlGZosNMnLs"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 245
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:06:11 GMT
+X-Amzn-Requestid: 345e1b55-a3a7-4d5c-b0a9-dd021935f44c
+
+{"metrics":{"latencyMs":1548},"output":{"message":{"content":[{"text":"The result of $15 \\times 8$ is **120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":273,"outputTokens":19,"serverToolUsage":{},"totalTokens":292}}863 482
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-coder-30b-a3b-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 317
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:06:18 GMT
+X-Amzn-Requestid: 14ba6298-e034-45a8-b2d1-0a02b72b39f1
+
+{"metrics":{"latencyMs":665},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_aGFNJ9ZFYfo3CogYV34tSZ"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":378,"outputTokens":41,"serverToolUsage":{},"totalTokens":419}}1142 407
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-coder-30b-a3b-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_aGFNJ9ZFYfo3CogYV34tSZ"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_aGFNJ9ZFYfo3CogYV34tSZ"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 242
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:06:34 GMT
+X-Amzn-Requestid: 941f4f7a-ed2d-43ba-8416-e8275ffed7e1
+
+{"metrics":{"latencyMs":277},"output":{"message":{"content":[{"text":"The result of $15 \\times 8$ is $120$."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":436,"outputTokens":18,"serverToolUsage":{},"totalTokens":454}}853 482
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-coder-next/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 317
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:06:41 GMT
+X-Amzn-Requestid: 249e17c8-6743-4f6e-b051-5f5984c3c018
+
+{"metrics":{"latencyMs":922},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_gsE4sp1ENzoTMBP50MpFQn"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":377,"outputTokens":41,"serverToolUsage":{},"totalTokens":418}}1132 407
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/qwen.qwen3-coder-next/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_gsE4sp1ENzoTMBP50MpFQn"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_gsE4sp1ENzoTMBP50MpFQn"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 242
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:06:58 GMT
+X-Amzn-Requestid: 08e1fd09-7047-461b-b54a-4cc8bc4d4edb
+
+{"metrics":{"latencyMs":504},"output":{"message":{"content":[{"text":"The result of $15 \\times 8$ is $120$."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":434,"outputTokens":18,"serverToolUsage":{},"totalTokens":452}}869 482
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/mistral.mistral-large-3-675b-instruct/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 317
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:07:04 GMT
+X-Amzn-Requestid: aec1bb2d-4a44-41d2-a95b-59194f7c1830
+
+{"metrics":{"latencyMs":367},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_l24cvHuahEJ25ry2DVAWxB"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":137,"outputTokens":25,"serverToolUsage":{},"totalTokens":162}}1148 415
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/mistral.mistral-large-3-675b-instruct/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_l24cvHuahEJ25ry2DVAWxB"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_l24cvHuahEJ25ry2DVAWxB"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 250
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:07:21 GMT
+X-Amzn-Requestid: 74e955f4-afc8-463b-9a1d-5d844bf5ad59
+
+{"metrics":{"latencyMs":348},"output":{"message":{"content":[{"text":"The result of \\( 15 \\times 8 \\) is **120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":168,"outputTokens":20,"serverToolUsage":{},"totalTokens":188}}865 483
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/mistral.mistral-large-2402-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 318
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:07:29 GMT
+X-Amzn-Requestid: de693b74-d0d7-4211-ba59-01bfb0da5737
+
+{"metrics":{"latencyMs":1550},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"multiply","a":15,"b":8},"name":"calculator","toolUseId":"tooluse_yq4pDEXFcOgzF2ZgkAeP6U"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":143,"outputTokens":35,"serverToolUsage":{},"totalTokens":178}}1144 397
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/mistral.mistral-large-2402-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_yq4pDEXFcOgzF2ZgkAeP6U"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_yq4pDEXFcOgzF2ZgkAeP6U"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 232
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:07:45 GMT
+X-Amzn-Requestid: ba7aea39-cc5d-485f-90d7-4a6047ae559b
+
+{"metrics":{"latencyMs":455},"output":{"message":{"content":[{"text":"The result of 15 * 8 is 120."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":195,"outputTokens":16,"serverToolUsage":{},"totalTokens":211}}852 483
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/moonshotai.kimi-k2.5/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 574
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 318
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:07:53 GMT
+X-Amzn-Requestid: 810d587d-7116-4631-9540-9599830932d1
+
+{"metrics":{"latencyMs":1818},"output":{"message":{"content":[{"toolUse":{"input":{"a":15,"b":8,"operation":"multiply"},"name":"calculator","toolUseId":"tooluse_sutJQ3XHuccpwovkFsTXJ2"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":114,"outputTokens":29,"serverToolUsage":{},"totalTokens":143}}1131 402
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/moonshotai.kimi-k2.5/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 853
+Authorization: AWS4-HMAC-SHA256 test-api-key
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Calculate 15 * 8"}],"role":"user"},{"content":[{"toolUse":{"input":{"a":"15","b":"8","operation":"multiply"},"name":"calculator","toolUseId":"tooluse_sutJQ3XHuccpwovkFsTXJ2"}}],"role":"assistant"},{"content":[{"toolResult":{"content":[{"text":"120"}],"toolUseId":"tooluse_sutJQ3XHuccpwovkFsTXJ2"}}],"role":"user"}],"toolConfig":{"toolChoice":{"auto":{}},"tools":[{"toolSpec":{"description":"A calculator that can perform basic arithmetic operations","inputSchema":{"json":{"type":"object","properties":{"operation":{"type":"string","description":"The operation to perform","enum":["add","subtract","multiply","divide"]},"a":{"type":"number","description":"First number"},"b":{"type":"number","description":"Second number"}},"required":["operation","a","b"]}},"name":"calculator"}}]}}HTTP/2.0 200 OK
+Content-Length: 237
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 17:08:10 GMT
+X-Amzn-Requestid: 7c911a3d-b6e0-4322-a217-852ae959806c
+
+{"metrics":{"latencyMs":542},"output":{"message":{"content":[{"text":" The result of 15 * 8 is **120**."}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":184,"outputTokens":13,"serverToolUsage":{},"totalTokens":197}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestAmazonToolCallingStreamingConverseAPI.httprr b/llms/bedrock/testdata/TestAmazonToolCallingStreamingConverseAPI.httprr
index 3e86cb98..7ae2913f 100644
Binary files a/llms/bedrock/testdata/TestAmazonToolCallingStreamingConverseAPI.httprr and b/llms/bedrock/testdata/TestAmazonToolCallingStreamingConverseAPI.httprr differ
diff --git a/llms/bedrock/testdata/TestBedrockAnthropicToolCalling.httprr b/llms/bedrock/testdata/TestBedrockAnthropicToolCalling.httprr
deleted file mode 100644
index 5a6284cf..00000000
--- a/llms/bedrock/testdata/TestBedrockAnthropicToolCalling.httprr
+++ /dev/null
@@ -1,56 +0,0 @@
-httprr trace v1
-821 762
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-haiku-4-5-20251001-v1%3A0/invoke HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 507
-Accept: */*
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"anthropic_version":"bedrock-2023-05-31","max_tokens":512,"messages":[{"role":"user","content":[{"type":"text","text":"What's the weather like in New York?"}]}],"tools":[{"name":"get_weather","description":"Get the current weather for a location","input_schema":{"properties":{"location":{"description":"The city and state, e.g. San Francisco, CA","type":"string"},"unit":{"description":"The unit of temperature","enum":["celsius","fahrenheit"],"type":"string"}},"required":["location"],"type":"object"}}]}HTTP/2.0 200 OK
-Content-Length: 479
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 12:46:58 GMT
-X-Amzn-Bedrock-Input-Token-Count: 614
-X-Amzn-Bedrock-Invocation-Latency: 763
-X-Amzn-Bedrock-Output-Token-Count: 57
-X-Amzn-Requestid: be9df7d2-bf07-4936-a89d-5c9a2048fd12
-
-{"model":"claude-haiku-4-5-20251001","id":"msg_bdrk_01WuVdmuVpN7jMutExtqSqDR","type":"message","role":"assistant","content":[{"type":"tool_use","id":"toolu_bdrk_01NAFKQXKFq9KJcXYspsWJT2","name":"get_weather","input":{"location":"New York, NY"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":614,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":57}}787 793
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-haiku-4-5-20251001-v1%3A0/invoke HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 473
-Accept: */*
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"anthropic_version":"bedrock-2023-05-31","max_tokens":512,"messages":[{"role":"user","content":[{"type":"text","text":"What's the weather like in New York?"}]},{"role":"assistant","content":[{"type":"tool_use","id":"toolu_bdrk_01NAFKQXKFq9KJcXYspsWJT2","name":"get_weather","input":{"location":"New York, NY"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_bdrk_01NAFKQXKFq9KJcXYspsWJT2","content":"It's currently 72°F and sunny in New York"}]}]}HTTP/2.0 200 OK
-Content-Length: 511
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 12:47:00 GMT
-X-Amzn-Bedrock-Input-Token-Count: 97
-X-Amzn-Bedrock-Invocation-Latency: 790
-X-Amzn-Bedrock-Output-Token-Count: 35
-X-Amzn-Requestid: 4c43be74-cdfc-4462-a8a9-be68cad26a23
-
-{"model":"claude-haiku-4-5-20251001","id":"msg_bdrk_01UXSrEUQrxZ8DSJNTGEW4SC","type":"message","role":"assistant","content":[{"type":"text","text":"It's currently **72°F and sunny** in New York. It's nice weather! Is there anything else you'd like to know about the weather?"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":97,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":35}}1066 980
-POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-haiku-4-5-20251001-v1%3A0/invoke HTTP/1.1
-Host: bedrock-runtime.us-east-1.amazonaws.com
-User-Agent: langchaingo-httprr
-Content-Length: 752
-Accept: */*
-Authorization: AWS4-HMAC-SHA256 test-api-key
-Content-Type: application/json
-
-{"anthropic_version":"bedrock-2023-05-31","max_tokens":512,"messages":[{"role":"user","content":[{"type":"text","text":"What's 123 * 456 and what's the weather in Paris?"}]}],"tools":[{"name":"get_weather","description":"Get the current weather for a location","input_schema":{"properties":{"location":{"description":"The city and state, e.g. San Francisco, CA","type":"string"},"unit":{"description":"The unit of temperature","enum":["celsius","fahrenheit"],"type":"string"}},"required":["location"],"type":"object"}},{"name":"calculate","description":"Perform mathematical calculations","input_schema":{"properties":{"expression":{"description":"The mathematical expression to evaluate","type":"string"}},"required":["expression"],"type":"object"}}]}HTTP/2.0 200 OK
-Content-Length: 696
-Content-Type: application/json
-Date: Fri, 23 Jan 2026 12:47:02 GMT
-X-Amzn-Bedrock-Input-Token-Count: 682
-X-Amzn-Bedrock-Invocation-Latency: 930
-X-Amzn-Bedrock-Output-Token-Count: 108
-X-Amzn-Requestid: 228f3dbd-385f-486b-b9b3-3b364932798f
-
-{"model":"claude-haiku-4-5-20251001","id":"msg_bdrk_0122fRnppVApgaxwsVmbDSx9","type":"message","role":"assistant","content":[{"type":"text","text":"I'll calculate that multiplication and get the weather in Paris for you."},{"type":"tool_use","id":"toolu_bdrk_01X6jfbj9zs3QKzaXqnxgv6w","name":"calculate","input":{"expression":"123 * 456"}},{"type":"tool_use","id":"toolu_bdrk_01Qmb6fa8KLEBr2MVnKyAUWy","name":"get_weather","input":{"location":"Paris, France"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":682,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":108}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestCreateClientWithBearerTokenCredentials.httprr b/llms/bedrock/testdata/TestCreateClientWithBearerTokenCredentials.httprr
new file mode 100644
index 00000000..c13b0f3b
--- /dev/null
+++ b/llms/bedrock/testdata/TestCreateClientWithBearerTokenCredentials.httprr
@@ -0,0 +1,15 @@
+httprr trace v1
+367 586
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 109
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Hello, how are you?"}],"role":"user"}]}HTTP/2.0 200 OK
+Content-Length: 421
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:46:55 GMT
+X-Amzn-Requestid: f8c7b8ae-9387-4864-9245-d97c1c081613
+
+{"metrics":{"latencyMs":2193},"output":{"message":{"content":[{"text":"Hello! I'm doing well, thank you for asking. How are you doing today? Is there anything I can help you with?"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":13,"outputTokens":30,"serverToolUsage":{},"totalTokens":43}}
\ No newline at end of file
diff --git a/llms/bedrock/testdata/TestCreateClientWithLongLeavingCredentials.httprr b/llms/bedrock/testdata/TestCreateClientWithLongLeavingCredentials.httprr
new file mode 100644
index 00000000..a0e2b031
--- /dev/null
+++ b/llms/bedrock/testdata/TestCreateClientWithLongLeavingCredentials.httprr
@@ -0,0 +1,15 @@
+httprr trace v1
+367 586
+POST https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-5-20250929-v1%3A0/converse HTTP/1.1
+Host: bedrock-runtime.us-east-1.amazonaws.com
+User-Agent: langchaingo-httprr
+Content-Length: 109
+Content-Type: application/json
+
+{"inferenceConfig":{"maxTokens":512},"messages":[{"content":[{"text":"Hello, how are you?"}],"role":"user"}]}HTTP/2.0 200 OK
+Content-Length: 421
+Content-Type: application/json
+Date: Tue, 03 Mar 2026 21:50:40 GMT
+X-Amzn-Requestid: 9847ea7d-909f-4d65-b1be-4ec486cfec87
+
+{"metrics":{"latencyMs":2036},"output":{"message":{"content":[{"text":"Hello! I'm doing well, thank you for asking. How are you doing today? Is there anything I can help you with?"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"cacheReadInputTokenCount":0,"cacheReadInputTokens":0,"cacheWriteInputTokenCount":0,"cacheWriteInputTokens":0,"inputTokens":13,"outputTokens":30,"serverToolUsage":{},"totalTokens":43}}
\ No newline at end of file