Merge pull request #1641 from BerriAI/litellm_bedrock_region_based_pricing

feat(utils.py): support region based pricing for bedrock + use bedrock's token counts if given
This commit is contained in:
Krish Dholakia 2024-01-26 20:28:16 -08:00 committed by GitHub
commit b36f628fc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 150 additions and 37 deletions

View file

@ -586,6 +586,10 @@ def completion(
)
if model_response is not None and hasattr(model_response, "_hidden_params"):
model_response._hidden_params["custom_llm_provider"] = custom_llm_provider
model_response._hidden_params["region_name"] = kwargs.get(
"aws_region_name", None
) # support region-based pricing for bedrock
### REGISTER CUSTOM MODEL PRICING -- IF GIVEN ###
if input_cost_per_token is not None and output_cost_per_token is not None:
litellm.register_model(