Stopping a model from adding text after its JSON output
AIF-C01
Applications of Foundation Models
Easy
Question 17 of 65
A software company has a data pipeline that prompts a foundation model in Amazon Bedrock to return JSON. The model returns valid JSON but then adds a paragraph of explanation after the closing brace, which causes the downstream JSON parser to fail. The company wants the model to stop generating as soon as it closes the JSON object.
Which inference parameter will meet this requirement?
Show answer and explanation
BStop sequences
Stop sequences specify character sequences that instruct an Amazon Bedrock foundation model to stop generating further tokens as soon as the sequence is produced, ensuring the model halts immediately after outputting the closing JSON bracket. Modifying the response length threshold restricts the maximum number of tokens generated, which can arbitrarily cut off valid JSON or still permit unwanted text if the limit is too high. Modifying the temperature parameter adjusts the randomness of token selection but does not prevent the model from generating explanatory text after the JSON object. Modifying the top P sampling value narrows the pool of candidate tokens based on cumulative probability, which affects output diversity rather than halting generation at a designated boundary.
Source: docs.aws.amazon.com/
Anonymous, no account needed. Your tally stays in this browser.
Practice by topic: Amazon Bedrock questions