Skip to content

OpenAI model usage issue for a Bedrock Agent - software.amazon.awssdk.services.bedrockruntime.model.ValidationException: This model doesn't support the stopSequences field

0

When using model from openAI openai.gpt-oss-20b-1:0 or openai.gpt-oss-120b-1:0 as model for an agent it throws this error:

ERROR SendMessage error: ValidationException: Validation failed with the PromptOverrideConfiguration that you provided. Check the following error message and retry after updating the PromptOverrideConfiguration for this agent: software.amazon.awssdk.services.bedrockruntime.model.ValidationException: This model doesn't support the stopSequences field. Remove stopSequences and try again. (Service: BedrockRuntime, Status Code: 400,

Enter image description here

From this doc https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-openai.html the equivalent field for stopSequences for gpt-oss model should be stop

1 Answer
0

Correct. Message completion is handled internally without needing explicit stop sequences in the OpenAI OSS models. To fix the error, you will want to use stop instead of stopSequences, as you mentioned.

To remedy this error, you will want to remove or replace the stopSequences field from your prompt override configuration then update your agent configuration to not include stop sequences when using these particular models.

OpenAI request body field mappings

Source: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-openai.html

AWS
EXPERT

answered 10 months ago

  • Seems like there is no easy way to get around this issue without implementing custom orchestration strategy which is huge pain in order to just not make bedrock invoke_agent not to use stopSequences. (seems like this default of the way bedrock invoking agent, and i have no way to override it) is there any good solution for this?

  • Correct, Minji. AWS Bedrock handles agent invocation stop sequences this way by default. Here are a few potential solutions for you to explore:

    1. Direct API integration where you could call the model directly using the invoke_model API. This would give you more control over the parameters. This would be the simplest and easiest to implement option.
    2. Create a custom action handler that wraps the model invocation
    3. Use a different agent framework that gives you more control over the parameters

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.