mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
ui - return callbacks set on litellm
This commit is contained in:
parent
cb0350ef29
commit
de14e11d3e
1 changed files with 51 additions and 5 deletions
|
@ -1809,17 +1809,15 @@ class ProxyConfig:
|
||||||
}
|
}
|
||||||
|
|
||||||
## DB
|
## DB
|
||||||
if (
|
if prisma_client is not None and (
|
||||||
prisma_client is not None
|
general_settings.get("store_model_in_db", False) == True
|
||||||
and litellm.get_secret("SAVE_CONFIG_TO_DB", False) == True
|
|
||||||
):
|
):
|
||||||
prisma_setup(database_url=None) # in case it's not been connected yet
|
|
||||||
_tasks = []
|
_tasks = []
|
||||||
keys = [
|
keys = [
|
||||||
"model_list",
|
|
||||||
"general_settings",
|
"general_settings",
|
||||||
"router_settings",
|
"router_settings",
|
||||||
"litellm_settings",
|
"litellm_settings",
|
||||||
|
"environment_variables",
|
||||||
]
|
]
|
||||||
for k in keys:
|
for k in keys:
|
||||||
response = prisma_client.get_generic_data(
|
response = prisma_client.get_generic_data(
|
||||||
|
@ -1828,6 +1826,12 @@ class ProxyConfig:
|
||||||
_tasks.append(response)
|
_tasks.append(response)
|
||||||
|
|
||||||
responses = await asyncio.gather(*_tasks)
|
responses = await asyncio.gather(*_tasks)
|
||||||
|
for response in responses:
|
||||||
|
if response is not None:
|
||||||
|
param_name = getattr(response, "param_name", None)
|
||||||
|
param_value = getattr(response, "param_value", None)
|
||||||
|
if param_name is not None and param_value is not None:
|
||||||
|
config[param_name] = param_value
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
@ -7981,6 +7985,48 @@ async def update_config(config_info: ConfigYAML):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/get/config/callbacks",
|
||||||
|
tags=["config.yaml"],
|
||||||
|
include_in_schema=False,
|
||||||
|
dependencies=[Depends(user_api_key_auth)],
|
||||||
|
)
|
||||||
|
async def get_config():
|
||||||
|
"""
|
||||||
|
For Admin UI - allows admin to view config via UI
|
||||||
|
|
||||||
|
"""
|
||||||
|
global llm_router, llm_model_list, general_settings, proxy_config, proxy_logging_obj, master_key
|
||||||
|
try:
|
||||||
|
|
||||||
|
config_data = await proxy_config.get_config()
|
||||||
|
_environment_variables = config_data.get("environment_variables", {})
|
||||||
|
config_data = config_data["litellm_settings"]
|
||||||
|
|
||||||
|
# only store the keys and return the values as sk...***
|
||||||
|
for key, value in _environment_variables.items():
|
||||||
|
_environment_variables[key] = value[:5] + "*****"
|
||||||
|
config_data["environment_variables"] = _environment_variables
|
||||||
|
return {"data": config_data, "status": "success"}
|
||||||
|
except Exception as e:
|
||||||
|
traceback.print_exc()
|
||||||
|
if isinstance(e, HTTPException):
|
||||||
|
raise ProxyException(
|
||||||
|
message=getattr(e, "detail", f"Authentication Error({str(e)})"),
|
||||||
|
type="auth_error",
|
||||||
|
param=getattr(e, "param", "None"),
|
||||||
|
code=getattr(e, "status_code", status.HTTP_400_BAD_REQUEST),
|
||||||
|
)
|
||||||
|
elif isinstance(e, ProxyException):
|
||||||
|
raise e
|
||||||
|
raise ProxyException(
|
||||||
|
message="Authentication Error, " + str(e),
|
||||||
|
type="auth_error",
|
||||||
|
param=getattr(e, "param", "None"),
|
||||||
|
code=status.HTTP_400_BAD_REQUEST,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/config/yaml",
|
"/config/yaml",
|
||||||
tags=["config.yaml"],
|
tags=["config.yaml"],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue