fix show api_base, model in timeout errors

This commit is contained in:
Ishaan Jaff 2024-04-24 14:01:32 -07:00
parent 1f7abb8d92
commit ca4fd85296

View file

@ -7415,11 +7415,18 @@ def exception_type(
exception_type = type(original_exception).__name__ exception_type = type(original_exception).__name__
else: else:
exception_type = "" exception_type = ""
_api_base = ""
try:
_api_base = litellm.get_api_base(
model=model, optional_params=extra_kwargs
)
except:
_api_base = ""
if "Request Timeout Error" in error_str or "Request timed out" in error_str: if "Request Timeout Error" in error_str or "Request timed out" in error_str:
exception_mapping_worked = True exception_mapping_worked = True
raise Timeout( raise Timeout(
message=f"APITimeoutError - Request timed out", message=f"APITimeoutError - Request timed out. \n model: {model} \n api_base: {_api_base} \n error_str: {error_str}",
model=model, model=model,
llm_provider=custom_llm_provider, llm_provider=custom_llm_provider,
) )