mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
test: fix config import for proxy testing
This commit is contained in:
parent
c040b478fc
commit
b7e75b940a
3 changed files with 46 additions and 18 deletions
|
@ -748,6 +748,19 @@ def litellm_completion(*args, **kwargs):
|
|||
return StreamingResponse(data_generator(response), media_type='text/event-stream')
|
||||
return response
|
||||
|
||||
def get_litellm_model_info(model: dict = {}):
|
||||
model_info = model.get("model_info", {})
|
||||
model_to_lookup = model.get("litellm_params", {}).get("model", None)
|
||||
try:
|
||||
if "azure" in model_to_lookup:
|
||||
model_to_lookup = model_info.get("base_model", None)
|
||||
litellm_model_info = litellm.get_model_info(model_to_lookup)
|
||||
return litellm_model_info
|
||||
except:
|
||||
# this should not block returning on /model/info
|
||||
# if litellm does not have info on the model it should return {}
|
||||
return {}
|
||||
|
||||
@app.middleware("http")
|
||||
async def rate_limit_per_token(request: Request, call_next):
|
||||
global user_api_key_cache, general_settings
|
||||
|
@ -1101,19 +1114,6 @@ async def add_new_model(model_params: ModelParams):
|
|||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=f"Internal Server Error: {str(e)}")
|
||||
|
||||
def get_litellm_model_info(model: dict = {}):
|
||||
model_info = model.get("model_info", {})
|
||||
model_to_lookup = model.get("litellm_params", {}).get("model", None)
|
||||
try:
|
||||
if "azure" in model_to_lookup:
|
||||
model_to_lookup = model_info.get("base_model", None)
|
||||
litellm_model_info = litellm.get_model_info(model_to_lookup)
|
||||
return litellm_model_info
|
||||
except:
|
||||
# this should not block returning on /model/info
|
||||
# if litellm does not have info on the model it should return {}
|
||||
return {}
|
||||
|
||||
#### [BETA] - This is a beta endpoint, format might change based on user feedback https://github.com/BerriAI/litellm/issues/933. If you need a stable endpoint use /model/info
|
||||
@router.get("/v1/model/info", description="Provides more info about each model in /models, including config.yaml descriptions (except api key and api base)", tags=["model management"], dependencies=[Depends(user_api_key_auth)])
|
||||
async def model_info_v1(request: Request):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue