Skip to content

Python: Bug: BedrockChatCompletion does not support Bedrock Application Inference Profiles #12833

@denny-nolan-kochcc

Description

@denny-nolan-kochcc

Describe the bug
When attempting to invoke a BedrockChatCompletion using an application inference profile, the model_id parameter is failing to resolve with the error Model ID {model_id} does not contain a valid model provider name..

This is because the Bedrock model provider resolver relies on the model_id parameter value containing the name of the model provider (ie 'anthropic', not to be confused with higher-level Bedrock model provider):

return next(provider for provider in cls if provider.value in model_id)

This model provider name is being used to map what parameters are being sent in the bedrock invoke_model() call to align the parameters with the given model provider.

When hosting more than one AI application in an AWS account, Application Inference Profiles are used so that model usage can be tracked by application (docs), rather than just by total usage of a model across the account. The code above seems to be oriented around the second approach, which uses a foundation model id or arn that contains the model provider name like this: us.anthropic.claude-sonnet-4-20250514-v1:0

Unfortunately, when hosting the same model in an application inference profile the value does not contain the model provider as you can see here: arn:aws:bedrock:us-east-1:<AccountID>:application-inference-profile/51i7czk0cv6z.

This feature is very important to productionizing and scaling the use of semantic kernel in our applications utilizing bedrock resources, and is a full blocker in our dev platform to using semantic kernel with Bedrock-hosted models as we require the use of application inference profiles for cost tracking.

To Reproduce
Steps to reproduce the behavior:

  1. Create an application inference profile in Bedrock. I used us.anthropic.claude-sonnet-4-20250514-v1:0 as the modelSource but this could likely be any model hosted in Bedrock.
  2. Set up a BedrockChatCompletion like this and provide the application inference profile arn from step 1 in the model_id parameter
  3. attempt to invoke the BedrockChatCompletion
  4. You will receive the error Model ID arn:aws:bedrock:us-east-1:<AccountID>:application-inference-profile/51i7czk0cv6z does not contain a valid model provider name.

Expected behavior
We would be able to provide an application inference profile arn along with a model provider id (ie anthropic) to the BedrockChatCompletion and successfully call the models defined in the inference profile.

Platform

  • Language: Python
  • Source: main branch
  • AI model: Bedrock - any model using application inference profile
  • IDE: VS Code
  • OS: Mac/linux

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codebugSomething isn't workingpythonPull requests for the Python Semantic Kernel

Type

Projects

Status

Bug

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions