QuestionQ112

VerifiedTesting, Validation, and Troubleshooting

A retail company operates an application that provides product recommendations to customers on its website. The application uses Amazon Bedrock to generate these recommendations by dynamically building prompts and sending them to foundation models (FMs).

A GenAI developer deploys an update to the application that instructs the FM to include a specific promotional message whenever it generates a response to prompts. During testing, the developer finds that:

  • The promotional message does not always appear in the responses.
  • When the promotional message does appear, it does not always flow smoothly with the rest of the text.

The GenAI developer needs to guarantee that the promotional message always appears in the FM's responses.

Which solution meets this requirement?

Explanation

Prompt-only instructions to a foundation model are not deterministic — the model may omit the requested content or integrate it awkwardly. To guarantee that the promotional message is always present and reads naturally, the response must be processed after generation: run the prompt through Amazon Bedrock to get the initial recommendation, then use Amazon Bedrock Agents to programmatically insert the promotional message into the response (ensuring 100% inclusion), and rerank the result using the original prompt and the desired promotional message as context so the final text is coherent. This combination removes reliance on the FM's voluntary compliance with an embedded instruction and instead enforces the requirement architecturally, while still optimizing for natural flow.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!