mirror of
https://github.com/vxcontrol/langchaingo.git
synced 2026-07-18 10:45:37 -04:00
feat: update AWS SDK dependencies and enhance caching support
- Upgraded various AWS SDK dependencies in go.mod and go.sum files to their latest versions, improving compatibility and performance. - Introduced automatic caching support for specific Anthropic models, optimizing token usage and reducing costs. - Refactored message processing to include caching logic, ensuring seamless integration with existing functionalities. - Removed deprecated models from tests and updated test cases to validate new caching features and model support.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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=
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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=
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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=
|
||||
|
||||
+704
-109
@@ -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<br/>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<br/>BEFORE text content]
|
||||
B -->|Converse API| D[Add ReasoningContent blocks<br/>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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
+157
-17
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
+1539
-25
File diff suppressed because it is too large
Load Diff
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
+91
-14
@@ -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"
|
||||
)
|
||||
|
||||
+44
File diff suppressed because one or more lines are too long
+62
File diff suppressed because one or more lines are too long
+58
File diff suppressed because one or more lines are too long
+82
File diff suppressed because one or more lines are too long
Generated
Vendored
+322
-112
@@ -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}}
|
||||
{"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}}
|
||||
+102
-46
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
Generated
Vendored
+30
@@ -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}}
|
||||
+30
@@ -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}}
|
||||
BIN
Binary file not shown.
+30
@@ -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}}
|
||||
+42
@@ -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}}
|
||||
Generated
Vendored
BIN
Binary file not shown.
+549
-182
@@ -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":"<thinking>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.</thinking>\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":"<thinking>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.</thinking>\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":"<thinking>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.</thinking> 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":"<thinking>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.</thinking> 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":"<thinking> The user has requested a multiplication operation. I will use the calculator tool to perform this operation. </thinking>\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":"<thinking> 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. </thinking>\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":"<thinking>The User's request is to calculate the product of 15 and 8. The tool 'calculator' can perform this operation.</thinking>\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":"<thinking>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.</thinking>\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":"<thinking> I have the result from the calculator tool. The multiplication of 15 and 8 is 120. </thinking>\n<response> The result of 15 * 8 is 120. </response>"}],"role":"assistant"}},"stopReason":"end_turn","usage":{"inputTokens":503,"outputTokens":51,"serverToolUsage":{},"totalTokens":554}}859 633
|
||||
{"metrics":{"latencyMs":703},"output":{"message":{"content":[{"text":"<thinking> I have the result from the calculator tool, which shows that 15 * 8 equals 120. </thinking>\n<response> The result of 15 * 8 is 120. </response>"}],"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":"<thinking> The User wants to calculate the product of 15 and 8. I can use the calculator tool to perform this multiplication. </thinking>\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":"<thinking> The user has requested a multiplication calculation of 15 * 8. I can use the calculator tool to perform this operation. </thinking>\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}}
|
||||
{"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}}
|
||||
BIN
Binary file not shown.
-56
@@ -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}}
|
||||
+15
@@ -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}}
|
||||
+15
@@ -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}}
|
||||
Reference in New Issue
Block a user