mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
fix(health_check.py): return 'missing mode' error message, if error with health check, and mode is missing
This commit is contained in:
parent
51da6ab64e
commit
7fce6b0163
6 changed files with 17 additions and 17 deletions
|
@ -4779,7 +4779,9 @@ async def ahealth_check(
|
|||
For azure/openai -> completion.with_raw_response
|
||||
For rest -> litellm.acompletion()
|
||||
"""
|
||||
passed_in_mode: Optional[str] = None
|
||||
try:
|
||||
|
||||
model: Optional[str] = model_params.get("model", None)
|
||||
|
||||
if model is None:
|
||||
|
@ -4793,7 +4795,10 @@ async def ahealth_check(
|
|||
if model in litellm.model_cost and mode is None:
|
||||
mode = litellm.model_cost[model].get("mode")
|
||||
|
||||
mode = mode or "chat" # default to chat completion calls
|
||||
mode = mode
|
||||
passed_in_mode = mode
|
||||
if mode is None:
|
||||
mode = "chat" # default to chat completion calls
|
||||
|
||||
if custom_llm_provider == "azure":
|
||||
api_key = (
|
||||
|
@ -4883,13 +4888,14 @@ async def ahealth_check(
|
|||
response = {} # args like remaining ratelimit etc.
|
||||
return response
|
||||
except Exception as e:
|
||||
verbose_logger.error(
|
||||
verbose_logger.exception(
|
||||
"litellm.ahealth_check(): Exception occured - {}".format(str(e))
|
||||
)
|
||||
stack_trace = traceback.format_exc()
|
||||
if isinstance(stack_trace, str):
|
||||
stack_trace = stack_trace[:1000]
|
||||
if model not in litellm.model_cost and mode is None:
|
||||
|
||||
if passed_in_mode is None:
|
||||
return {
|
||||
"error": "Missing `mode`. Set the `mode` for the model - https://docs.litellm.ai/docs/proxy/health#embedding-models"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue