Thanks to the Python team for the Bedrock connector (#9100) and the per-provider modules under model_provider/, which keep a new provider down to a few lines.
Describe the bug
BedrockChatCompletion can't call any OpenAI model on Bedrock. GPT-6 Sol and Luna (on Bedrock since 2026-09-22), GPT-6 Astra, GPT-5.6 and gpt-oss-120b fail before any request is sent because BedrockModelProvider has no openai member. Setting the provider doesn't help either: BEDROCK_MODEL_PROVIDER=openai fails validation.
case (main ca40aa7, live us-east-1, "Say pong.") |
result |
us.openai.gpt-6-sol, us.openai.gpt-6-luna, global.openai.gpt-6-sol, global.openai.gpt-6-luna |
❌ ValueError: Model ID ... does not contain a valid model provider name. |
us.openai.gpt-6-astra, global.openai.gpt-6-astra |
❌ same ValueError |
us.openai.gpt-5.6-sol, openai.gpt-oss-120b-1:0 |
❌ same ValueError |
BEDROCK_MODEL_PROVIDER=openai (Sol and Astra) |
❌ ServiceInitializationError <- Input should be 'ai21', 'amazon', 'anthropic', 'cohere', 'meta' or 'mistral' |
model_provider=BedrockModelProvider.MISTRALAI (workaround attempt, Sol and Astra) |
❌ ValidationException: This model doesn't support the stopSequences field. |
us.anthropic.claude-haiku-4-5-20251001-v1:0 |
✅ 'pong' |
Two causes:
services/model_provider/bedrock_model_provider.py L24-43: the enum has ai21/amazon/anthropic/cohere/meta/mistral, and to_model_provider raises when none of them is in the model ID.
services/bedrock_chat_completion.py L214 always sends "stopSequences": settings.stop. stop defaults to [] and remove_none_recursively only drops None, so every request carries stopSequences: []. Claude and Nova accept that, but the OpenAI models reject the field even when the list is empty (raw boto3 below).
To Reproduce
# AWS_DEFAULT_REGION=us-east-1 python repro.py us.openai.gpt-6-sol
import asyncio
import sys
from semantic_kernel.connectors.ai.bedrock import BedrockChatCompletion, BedrockChatPromptExecutionSettings
from semantic_kernel.contents import ChatHistory
async def main(model_id: str):
svc = BedrockChatCompletion(model_id=model_id)
history = ChatHistory()
history.add_user_message("Say pong.")
print(await svc.get_chat_message_content(history, BedrockChatPromptExecutionSettings()))
asyncio.run(main(sys.argv[1]))
File "semantic_kernel/connectors/ai/bedrock/services/model_provider/bedrock_model_provider.py", line 43, in to_model_provider
raise ValueError(f"Model ID {model_id} does not contain a valid model provider name.")
ValueError: Model ID us.openai.gpt-6-sol does not contain a valid model provider name.
Raw boto3 converse, "Say pong.", only inferenceConfig differs
us.openai.gpt-6-sol inferenceConfig={} OK ['pong']
us.openai.gpt-6-sol inferenceConfig={'stopSequences': []} ERR This model doesn't support the stopSequences field. Remove stopSequences and try again.
us.openai.gpt-6-luna inferenceConfig={} OK ['pong']
us.openai.gpt-6-luna inferenceConfig={'stopSequences': []} ERR This model doesn't support the stopSequences field. Remove stopSequences and try again.
us.openai.gpt-6-astra inferenceConfig={} OK ['pong']
us.openai.gpt-6-astra inferenceConfig={'stopSequences': []} ERR This model doesn't support the stopSequences field. Remove stopSequences and try again.
global.openai.gpt-6-astra inferenceConfig={} OK ['pong']
global.openai.gpt-6-astra inferenceConfig={'stopSequences': []} ERR This model doesn't support the stopSequences field. Remove stopSequences and try again.
us.openai.gpt-5.6-sol inferenceConfig={} OK ['pong']
us.openai.gpt-5.6-sol inferenceConfig={'stopSequences': []} ERR This model doesn't support the stopSequences field. Remove stopSequences and try again.
openai.gpt-oss-120b-1:0 inferenceConfig={} OK ['pong']
openai.gpt-oss-120b-1:0 inferenceConfig={'stopSequences': []} ERR This model doesn't support the stopSequences field. Remove stopSequences and try again.
us.anthropic.claude-haiku-4-5-20251001-v1:0 inferenceConfig={} OK ['Pong.']
us.anthropic.claude-haiku-4-5-20251001-v1:0 inferenceConfig={'stopSequences': []} OK ['Pong.']
us.amazon.nova-lite-v1:0 inferenceConfig={} OK ['Pong! ...']
us.amazon.nova-lite-v1:0 inferenceConfig={'stopSequences': []} OK ['Pong! ...']
Expected behavior
OpenAI model IDs route like the other providers. The patch in #14471 does it: an OPENAI enum value with a bedrock_openai.py that mirrors bedrock_mistralai.py, and stopSequences sent only when stop is set. GPT-6 Sol and Astra then pass plain, streaming, system prompt and tool calls (Auto, Required, streaming). Responses with a reasoningContent block (often on Luna, nearly always on gpt-oss, Sol and Astra on image/2-turn/short max_tokens prompts) also need #14469 (#14468).
Platform
- Language: Python
- Source: main branch (ca40aa7, 1.44.1)
- AI model: Bedrock
us.openai.gpt-6-sol, us.openai.gpt-6-luna, global.openai.gpt-6-sol, global.openai.gpt-6-luna, us.openai.gpt-6-astra, global.openai.gpt-6-astra, us.openai.gpt-5.6-sol, openai.gpt-oss-120b-1:0
- IDE: none (script)
- OS: macOS
Additional context
Thanks to the Python team for the Bedrock connector (#9100) and the per-provider modules under
model_provider/, which keep a new provider down to a few lines.Describe the bug
BedrockChatCompletioncan't call any OpenAI model on Bedrock. GPT-6 Sol and Luna (on Bedrock since 2026-09-22), GPT-6 Astra, GPT-5.6 and gpt-oss-120b fail before any request is sent becauseBedrockModelProviderhas noopenaimember. Setting the provider doesn't help either:BEDROCK_MODEL_PROVIDER=openaifails validation.mainca40aa7, live us-east-1, "Say pong.")us.openai.gpt-6-sol,us.openai.gpt-6-luna,global.openai.gpt-6-sol,global.openai.gpt-6-lunaValueError: Model ID ... does not contain a valid model provider name.us.openai.gpt-6-astra,global.openai.gpt-6-astraValueErrorus.openai.gpt-5.6-sol,openai.gpt-oss-120b-1:0ValueErrorBEDROCK_MODEL_PROVIDER=openai(Sol and Astra)ServiceInitializationError<-Input should be 'ai21', 'amazon', 'anthropic', 'cohere', 'meta' or 'mistral'model_provider=BedrockModelProvider.MISTRALAI(workaround attempt, Sol and Astra)ValidationException: This model doesn't support the stopSequences field.us.anthropic.claude-haiku-4-5-20251001-v1:0'pong'Two causes:
services/model_provider/bedrock_model_provider.pyL24-43: the enum has ai21/amazon/anthropic/cohere/meta/mistral, andto_model_providerraises when none of them is in the model ID.services/bedrock_chat_completion.pyL214 always sends"stopSequences": settings.stop.stopdefaults to[]andremove_none_recursivelyonly dropsNone, so every request carriesstopSequences: []. Claude and Nova accept that, but the OpenAI models reject the field even when the list is empty (raw boto3 below).To Reproduce
Raw boto3
converse, "Say pong.", onlyinferenceConfigdiffersExpected behavior
OpenAI model IDs route like the other providers. The patch in #14471 does it: an
OPENAIenum value with abedrock_openai.pythat mirrorsbedrock_mistralai.py, andstopSequencessent only whenstopis set. GPT-6 Sol and Astra then pass plain, streaming, system prompt and tool calls (Auto, Required, streaming). Responses with areasoningContentblock (often on Luna, nearly always on gpt-oss, Sol and Astra on image/2-turn/shortmax_tokensprompts) also need #14469 (#14468).Platform
us.openai.gpt-6-sol,us.openai.gpt-6-luna,global.openai.gpt-6-sol,global.openai.gpt-6-luna,us.openai.gpt-6-astra,global.openai.gpt-6-astra,us.openai.gpt-5.6-sol,openai.gpt-oss-120b-1:0Additional context