For organizations standardized on AWS Bedrock, AI Router can be configured to recommend only models available on your Bedrock instance. This ensures alignment with existing cloud infrastructure and mainting your input data private while still optimizing model selection within the Bedrock ecosystem.
In the first step compare your available models in Bedrock with our list of supported models, then add them to the models
parameter. Set the full_privacy
parameter to True
to ensure your input data is not exposed.
from airouter import AiRouter
client = AiRouter(
api_key="<THE-API-KEY-YOU-GENERATED>"
)
best_model = client.get_best_model(
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the meaning of life?"}
],
model=Model.CLAUDE_35_SONNET, # the default model
models=[
Model.CLAUDE_35_SONNET,
Model.CLAUDE_3_OPUS,
Model.CLAUDE_3_HAIKU,
Model.COMMAND_R_PLUS,
Model.MISTRAL_LARGE,
Model.LLAMA_31_8B,
Model.LLAMA_31_70B
], # the models to consider
full_privacy=True
)
if best_model == Model.CLAUDE_35_SONNET:
# call your bedrock claude-35-sonnet model
elif best_model == Model.CLAUDE_3_OPUS:
# call your bedrock claude-3-opus model
...