Repository navigation
Python: Support OpenAI models (GPT-6 Sol/Luna/Astra, GPT-5.x, gpt-oss) in the Bedrock chat connector - #14471
Closed
Lucas Kim (kimnamu) wants to merge 1 commit into
Closed
Python: Support OpenAI models (GPT-6 Sol/Luna/Astra, GPT-5.x, gpt-oss) in the Bedrock chat connector#14471Lucas Kim (kimnamu) wants to merge 1 commit into
Lucas Kim (kimnamu) wants to merge 1 commit into
Conversation
…he Bedrock chat connector BedrockModelProvider had no "openai" member, so any openai.* model ID (us.openai.gpt-6-sol, global.openai.gpt-6-luna, openai.gpt-oss-120b-1:0) failed with "does not contain a valid model provider name", and BEDROCK_MODEL_PROVIDER=openai failed validation. Once routed, every request was still rejected because the default empty stop list was sent as inferenceConfig.stopSequences=[]; OpenAI models on Bedrock reject the stopSequences field. Only send it when stop is set. Co-Authored-By: Claude <noreply@anthropic.com>
Lucas Kim (kimnamu)
had a problem deploying
to
github-app-auth
September 23, 2026 10:37 — with
GitHub Actions
Failure
Lucas Kim (kimnamu)
had a problem deploying
to
github-app-auth
September 23, 2026 10:37 — with
GitHub Actions
Failure
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues were identified that would block approval.
Review effort: Lite
Findings: None
What changed in this PR
Adds OpenAI model support to the Python Bedrock chat connector and prevents empty stop sequences from being sent.
Changes:
- Adds OpenAI provider routing and chat request handling.
- Omits default empty
stopSequences. - Extends unit tests for OpenAI IDs and stop settings.
| File | Description |
|---|---|
| python/tests/unit/connectors/ai/bedrock/services/test_bedrock_model_provider_utils.py | Updated as part of this pull request. |
| python/tests/unit/connectors/ai/bedrock/services/test_bedrock_chat_completion.py | Updated as part of this pull request. |
| python/semantic_kernel/connectors/ai/bedrock/services/model_provider/bedrock_openai.py | Updated as part of this pull request. |
| python/semantic_kernel/connectors/ai/bedrock/services/model_provider/bedrock_model_provider.py | Updated as part of this pull request. |
| python/semantic_kernel/connectors/ai/bedrock/services/bedrock_chat_completion.py | Updated as part of this pull request. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Member
|
Thank you for the contribution. We are not adding new features to Semantic Kernel (SK) at the moment, so I am closing this PR. Please consider creating a feature request issue in microsoft/agent-framework. |
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation and Context
Thanks to the Python team for the Bedrock connector (#9100) and its per-provider modules; OpenAI support follows the chat region of
bedrock_mistralai.py.Fixes #14470
BedrockChatCompletionrejected every OpenAI model ID on Bedrock (GPT-6 Sol/Luna/Astra, GPT-5.6, gpt-oss) withValueError: ... does not contain a valid model provider name.. With the provider forced, the defaultstopSequences: []got a 400.main)us./global.: plain, streaming, system prompt, tools (Auto, Required, streaming)ValueErrormax_tokens=20ValueErrorreasoningContentblock (#14468)max_tokens=20givesLENGTH, empty text)us./global.: "Say pong." non-streaming / streamingValueErrorreasoningContentblockValueErrorus./global.: plain, streaming, system prompt, tools (Auto, Required, streaming)ValueErrormax_tokens=20ValueErrorreasoningContentblock (#14468)max_tokens=20givesLENGTH, empty text)max_tokens=20ValueErrorreasoningContentblockValueErrorreasoningContentblock on every text checkBEDROCK_MODEL_PROVIDER=openai(Sol, Astra)ValidationError'pong'inferenceConfigsent{"stopSequences": []}{}{}stop=["world"]set by the usertemperatureset by the user on GPT-6OPENAImember),additionalModelRequestFieldsfor other providersDescription
bedrock_model_provider.py: addOPENAI = "openai"and oneCHAT_COMPLETION_ADDITIONAL_MODEL_REQUEST_FIELDS_MAPPINGentry.bedrock_openai.py(new): the chat region ofbedrock_mistralai.py, returningNone, with the Bedrock OpenAI parameters link.bedrock_chat_completion.py:"stopSequences": settings.stop or None, soremove_none_recursivelydrops the empty default like the other unset fields.openai.gptin the four provider parametrize lists, two GPT-6 profile IDs intest_inference_profile_with_bedrock_model, and a newtest_prepare_settings_for_request_with_stop. The oldassert all([parsed_settings["inferenceConfig"].values()])is always true (a one-item list), so the twoprepare_settingstests now assert== {}.Out of scope: text completion and embeddings for OpenAI stay unsupported, and a reasoning-effort setting would be a separate feature. GPT-6 Luna, gpt-oss and some Sol/Astra prompts need #14469 as well; the two PRs touch different lines and pass the Bedrock unit tests together (120).
Tests (red/green, lint) and live output
New tests kept, source reverted to
main:With the fix:
"Say pong.", 5 non-streaming + 5 streaming calls per model per round:
Wider check through
BedrockChatCompletion, this PR + #14469 (us.openai.gpt-6-lunashown; Sol, Astra, theglobal.IDs andus.openai.gpt-5.6-solgive the same OK/FAIL per check):Streaming speed matches raw boto3
converse_stream(this PR + #14469, "Write about 250 words explaining how a hash map works.",maxTokens=2000, 3 interleaved runs (Astra 5), medians):Contribution Checklist