fix: add drop_params support to BedrockCompletion for unsupported parameters #4047
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix: add drop_params support to BedrockCompletion for unsupported parameters
Summary
Fixes GitHub issue #4046 where certain Bedrock models (like
openai.gpt-oss-safeguard-120b) don't support thestopSequencesfield and throw an error: "This model doesn't support the stopSequences field."This PR adds support for
drop_paramsandadditional_drop_paramsparameters inBedrockCompletion._get_inference_config(), following the same pattern already implemented in the Azure provider. Users can now drop unsupported parameters from the inference config:Changes:
_get_inference_config()to check fordrop_paramsandadditional_drop_paramsinadditional_paramsand remove specified keys from the configReview & Testing Checklist for Human
openai.gpt-oss-safeguard-120bmodel or another model that doesn't supportstopSequencessupports_stop_words()still returnsTrue, the agent executor will still set stop words but they'll be dropped before the API call. Confirm this doesn't cause unexpected behavior in the agent loopstopSequences,topP) inadditional_drop_params, not internal attribute names (e.g.,stop_sequences,top_p)Notes
# type: ignore[misc]comment is needed becauseEnhancedInferenceConfigurationTypeDefis a TypedDict and popping arbitrary keys causes type checker complaints