Skip to content

Commit

Permalink
Fix compatibility with region inference (#531)
Browse files Browse the repository at this point in the history
* #508 Fix compatibility with region inference and resolve issues with different regions

* Reformat following  CI (#531)
* Two spaces before comment
  • Loading branch information
chm10 committed Sep 17, 2024
1 parent a759f3d commit 34228f0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions backend/app/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,19 @@ def calculate_price(

def get_model_id(model: type_model_name) -> str:
# Ref: https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids-arns.html
region = BEDROCK_REGION.split("-")[0] # Cross-region inference
if model == "claude-v2":
return "anthropic.claude-v2:1"
elif model == "claude-instant-v1":
return "anthropic.claude-instant-v1"
elif model == "claude-v3-sonnet":
return "anthropic.claude-3-sonnet-20240229-v1:0"
return f"{region}.anthropic.claude-3-sonnet-20240229-v1:0"
elif model == "claude-v3-haiku":
return "anthropic.claude-3-haiku-20240307-v1:0"
return f"{region}.anthropic.claude-3-haiku-20240307-v1:0"
elif model == "claude-v3-opus":
return "anthropic.claude-3-opus-20240229-v1:0"
return f"{region}.anthropic.claude-3-opus-20240229-v1:0"
elif model == "claude-v3.5-sonnet":
return "anthropic.claude-3-5-sonnet-20240620-v1:0"
return f"{region}.anthropic.claude-3-5-sonnet-20240620-v1:0"
elif model == "mistral-7b-instruct":
return "mistral.mistral-7b-instruct-v0:2"
elif model == "mixtral-8x7b-instruct":
Expand Down

0 comments on commit 34228f0

Please sign in to comment.