Course menuDVA-C03

Exams / DVA-C03 / Calling Amazon Bedrock from application code / Question 1

DVA-C03 practice question: Calling Amazon Bedrock from application code

Development with AWS Services A free question from our original DVA-C03 practice exam. Try it, then open the answer to see why each option is right or wrong.

Last verified against current AWS documentation ·How we write our questions

A retail company's support app sends customer chat messages to a foundation model on Amazon Bedrock. The code calls InvokeModel, and each model family needs its own request body and its own response parser.

The team wants to test two other Bedrock models next quarter. The code must keep one message format for conversation turns, and it must read the reply text and token counts the same way for every model.

Which change meets these requirements with the LEAST code change?

Choose one answer.

  1. A. Keep InvokeModel, and add a separate request builder and response parser for each model family, chosen by the model ID at run time in the code.
  2. B. Change the calls to the Converse API, which uses one message format and one response structure for every model that supports messages.
  3. C. Call InvokeModelWithResponseStream instead, and keep the existing model-specific parsing code for each streamed chunk.
  4. D. Convert every prompt to plain text and send it with the InvokeModel body that the first model family uses for all models.
Show the answer and explanation

Answer: B

  • A. Wrong: This works, but each new model needs another builder and parser, so the code keeps growing. It does not give the team one message format with the least change.
  • B. Right: Correct. The Converse API gives one request format for every Bedrock model that supports messages, and it returns output, stop reason and usage in a standard shape. Trying another model usually means changing the model ID. Learn more: Carry out a conversation with the Converse API (opens in a new tab)
  • C. Wrong: Streaming changes how the reply arrives, not the request body. The chunks still differ by model, so the parsing code stays model-specific.
  • D. Wrong: A body built for one model family is not accepted by others, because each family expects its own request and response shape. Plain text alone does not give the team a single response structure.

Explanation

The Converse API gives one request shape across Bedrock models that support messages, and one normalized response with output, stop reason and usage. InvokeModel bodies are model-specific, so every new model adds parsing code. Moving the calls to Converse is the change that needs the least code.

Study

Keep practicing

Answer questions with a score at the end, or practice just this topic with the explanation after each one. No sign-up needed.

Want more on Calling Amazon Bedrock from application code? The 5 full-length practice sets have 8 more Calling Amazon Bedrock from application code questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets