mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 05:37:20 +08:00
Remove prod/ prefix from litellm proxy model path (#12200)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -73,36 +73,22 @@ PERMITTED_CORS_ORIGINS = [
|
||||
|
||||
|
||||
def build_litellm_proxy_model_path(model_name: str) -> str:
|
||||
"""
|
||||
Build the LiteLLM proxy model path based on environment and model name.
|
||||
|
||||
This utility constructs the full model path for LiteLLM proxy based on:
|
||||
- Environment type (staging vs prod)
|
||||
- The provided model name
|
||||
"""Build the LiteLLM proxy model path based on model name.
|
||||
|
||||
Args:
|
||||
model_name: The base model name (e.g., 'claude-3-7-sonnet-20250219')
|
||||
|
||||
Returns:
|
||||
The full LiteLLM proxy model path (e.g., 'litellm_proxy/prod/claude-3-7-sonnet-20250219')
|
||||
The full LiteLLM proxy model path (e.g., 'litellm_proxy/claude-3-7-sonnet-20250219')
|
||||
"""
|
||||
|
||||
if 'prod' in model_name or 'litellm' in model_name or 'proxy' in model_name:
|
||||
if 'litellm' in model_name:
|
||||
raise ValueError("Only include model name, don't include prefix")
|
||||
|
||||
prefix = 'litellm_proxy/'
|
||||
|
||||
if not IS_STAGING_ENV and not IS_LOCAL_ENV:
|
||||
prefix += 'prod/'
|
||||
|
||||
return prefix + model_name
|
||||
return 'litellm_proxy/' + model_name
|
||||
|
||||
|
||||
def get_default_litellm_model():
|
||||
"""
|
||||
Construct proxy for litellm model based on user settings and environment type (staging vs prod)
|
||||
if not set explicitly
|
||||
"""
|
||||
"""Construct proxy for litellm model based on user settings if not set explicitly."""
|
||||
if LITELLM_DEFAULT_MODEL:
|
||||
return LITELLM_DEFAULT_MODEL
|
||||
model = USER_SETTINGS_VERSION_TO_MODEL[CURRENT_USER_SETTINGS_VERSION]
|
||||
|
||||
Reference in New Issue
Block a user