From a164fbd2975423fa02f490ff5b0054fcb4ab3d94 Mon Sep 17 00:00:00 2001 From: sbaluja Date: Thu, 22 Jan 2026 12:17:47 -0500 Subject: [PATCH 1/2] Fix streaming bug for SRA clients --- .../velocity/cpp/smithy/SmithyServiceOperationsSource.vm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyServiceOperationsSource.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyServiceOperationsSource.vm index b578db299a1..bcb5fd4428e 100644 --- a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyServiceOperationsSource.vm +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyServiceOperationsSource.vm @@ -24,7 +24,11 @@ ${operation.name}Outcome ${className}::${operation.name}(${constText}${operation }); } #end - return ${operation.name}Outcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_${operation.http.method}, [&#if($hasEndPointOverrides) , endpointOverrides #end](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + #if($operation.result && $operation.result.shape.hasStreamMembers()) + return ${operation.name}Outcome(MakeRequestWithUnparsedResponse(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_${operation.http.method}, [&#if($hasEndPointOverrides) , endpointOverrides #end](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + #else + return ${operation.name}Outcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_${operation.http.method}, [&#if($hasEndPointOverrides) , endpointOverrides #end](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + #end #parse("/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyEndpointClosure.vm") })); }, From 2efbd7c6f2a06ccdef54ea1266240d8a65584e99 Mon Sep 17 00:00:00 2001 From: sbaluja Date: Thu, 22 Jan 2026 12:18:21 -0500 Subject: [PATCH 2/2] Update clients & add test for BedrockRuntime::InvokeModel --- .../source/BedrockRuntimeClient.cpp | 13 +++++++------ .../IntegrationTests.cpp | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/generated/src/aws-cpp-sdk-bedrock-runtime/source/BedrockRuntimeClient.cpp b/generated/src/aws-cpp-sdk-bedrock-runtime/source/BedrockRuntimeClient.cpp index c5b1f368ff8..fae27e6dee0 100644 --- a/generated/src/aws-cpp-sdk-bedrock-runtime/source/BedrockRuntimeClient.cpp +++ b/generated/src/aws-cpp-sdk-bedrock-runtime/source/BedrockRuntimeClient.cpp @@ -373,12 +373,13 @@ InvokeModelOutcome BedrockRuntimeClient::InvokeModel(const InvokeModelRequest& r smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( [&]() -> InvokeModelOutcome { - return InvokeModelOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST, - [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { - resolvedEndpoint.AddPathSegments("/model/"); - resolvedEndpoint.AddPathSegment(request.GetModelId()); - resolvedEndpoint.AddPathSegments("/invoke"); - })); + return InvokeModelOutcome(MakeRequestWithUnparsedResponse(&request, request.GetServiceRequestName(), + Aws::Http::HttpMethod::HTTP_POST, + [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments("/model/"); + resolvedEndpoint.AddPathSegment(request.GetModelId()); + resolvedEndpoint.AddPathSegments("/invoke"); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, diff --git a/tests/aws-cpp-sdk-bedrock-runtime-integration-tests/IntegrationTests.cpp b/tests/aws-cpp-sdk-bedrock-runtime-integration-tests/IntegrationTests.cpp index 4e6613d8255..dea5d5aaf1c 100644 --- a/tests/aws-cpp-sdk-bedrock-runtime-integration-tests/IntegrationTests.cpp +++ b/tests/aws-cpp-sdk-bedrock-runtime-integration-tests/IntegrationTests.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -74,4 +75,21 @@ TEST_F(BedrockRuntimeTests, TestStreaming) return responseReceived; }); ASSERT_TRUE(responseReceived); } + +TEST_F(BedrockRuntimeTests, TestInvokeModel) +{ + auto bedrockRequest = Aws::BedrockRuntime::Model::InvokeModelRequest{}.WithModelId("us.anthropic.claude-3-5-sonnet-20241022-v2:0").WithAccept("application/json") ; + + bedrockRequest.SetBody(Aws::MakeShared( + "BedrockRuntimeTests::TestInvokeModel", + R"({"anthropic_version":"bedrock-2023-05-31","max_tokens":1024,"messages":[{"role":"user","content":"Why is the Mets baseball team so bad?"}]})")); + bedrockRequest.SetContentType("application/json"); + + Aws::BedrockRuntime::Model::InvokeModelOutcome outcome = m_client->InvokeModel(bedrockRequest); + ASSERT_TRUE(outcome.IsSuccess()); + Aws::StringStream ss; + ss << outcome.GetResult().GetBody().rdbuf(); + ASSERT_FALSE(ss.str().empty()); +} + }