Skip to content

feat: customize model list using environment #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/api/models/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Usage,
UserMessage,
)
from api.setting import AWS_REGION, DEBUG, DEFAULT_MODEL, ENABLE_CROSS_REGION_INFERENCE
from api.setting import AWS_REGION, CUSTOM_MODEL_LIST, DEBUG, DEFAULT_MODEL, ENABLE_CROSS_REGION_INFERENCE

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -101,6 +101,10 @@ def list_bedrock_models() -> dict:
if not stream_supported or status not in ["ACTIVE", "LEGACY"]:
continue

# if the user provides a custom model list, filter only those models
if CUSTOM_MODEL_LIST and model_id not in CUSTOM_MODEL_LIST:
continue

inference_types = model.get("inferenceTypesSupported", [])
input_modalities = model["inputModalities"]
# Add on-demand model list
Expand Down
1 change: 1 addition & 0 deletions src/api/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
AWS_REGION = os.environ.get("AWS_REGION", "us-west-2")
DEFAULT_MODEL = os.environ.get("DEFAULT_MODEL", "anthropic.claude-3-sonnet-20240229-v1:0")
DEFAULT_EMBEDDING_MODEL = os.environ.get("DEFAULT_EMBEDDING_MODEL", "cohere.embed-multilingual-v3")
CUSTOM_MODEL_LIST = os.environ.get("CUSTOM_MODEL_LIST", "").split(",")
ENABLE_CROSS_REGION_INFERENCE = os.environ.get("ENABLE_CROSS_REGION_INFERENCE", "true").lower() != "false"