AIP-C01 · Question #65
A company is designing an API for a generative AI (GenAI) application that uses a foundation model (FM) that is hosted on a managed model service. The API must stream responses to reduce latency…
The correct answer is A. Integrate an Amazon API Gateway HTTP API with an AWS Lambda function to invoke Amazon. The requirements are streaming responses, token limit enforcement, and retry logic for timeouts/partial responses-all with the least operational overhead. An API Gateway HTTP API paired with a Lambda function invoking Amazon Bedrock is the right combination: Lambda can call…
Question
A company is designing an API for a generative AI (GenAI) application that uses a foundation model (FM) that is hosted on a managed model service. The API must stream responses to reduce latency, enforce token limits to manage compute resource usage, and implement retry logic to handle model timeouts and partial responses. Which solution will meet these requirements with the LEAST operational overhead?
Options
- AIntegrate an Amazon API Gateway HTTP API with an AWS Lambda function to invoke Amazon
- BConnect an Amazon API Gateway HTTP API directly to Amazon Bedrock. Simulate streaming by
- CConnect an Amazon API Gateway WebSocket API to an Amazon ECS service that hosts a
- DIntegrate an Amazon API Gateway REST API with an AWS Lambda function that invokes
How the community answered
(45 responses)- A76% (34)
- B7% (3)
- C2% (1)
- D16% (7)
Explanation
The requirements are streaming responses, token limit enforcement, and retry logic for timeouts/partial responses-all with the least operational overhead. An API Gateway HTTP API paired with a Lambda function invoking Amazon Bedrock is the right combination: Lambda can call Bedrock's streaming InvokeModelWithResponseStream API, enforce token limits via request parameters, and implement retry logic in code-all without managing any servers or containers. HTTP APIs on API Gateway have lower latency and cost than REST APIs and natively support Lambda streaming responses. Option B (direct API Gateway to Bedrock integration) cannot implement retry logic or complex token enforcement without a compute layer. Option C (ECS service) introduces container management overhead. Option D (REST API variant) is functionally similar to A but REST APIs have higher overhead than HTTP APIs for this use case, making A the preferred minimum-overhead solution.
Topics
Community Discussion
No community discussion yet for this question.