forked from phoenix/litellm-mirror
fix(utils.py): fix exception raised
This commit is contained in:
parent
3469b5b911
commit
c04fa54d19
1 changed files with 13 additions and 1 deletions
|
@ -4123,7 +4123,19 @@ def get_llm_provider(
|
||||||
)
|
)
|
||||||
return model, custom_llm_provider, dynamic_api_key, api_base
|
return model, custom_llm_provider, dynamic_api_key, api_base
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception(f"GetLLMProvider Exception - {str(e)}\n\noriginal model: {model}")
|
if isinstance(e, litellm.exceptions.BadRequestError):
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
raise litellm.exceptions.BadRequestError( # type: ignore
|
||||||
|
message=f"GetLLMProvider Exception - {str(e)}\n\noriginal model: {model}",
|
||||||
|
model=model,
|
||||||
|
response=httpx.Response(
|
||||||
|
status_code=400,
|
||||||
|
content=error_str,
|
||||||
|
request=httpx.request(method="completion", url="https://github.com/BerriAI/litellm"), # type: ignore
|
||||||
|
),
|
||||||
|
llm_provider="",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_api_key(llm_provider: str, dynamic_api_key: Optional[str]):
|
def get_api_key(llm_provider: str, dynamic_api_key: Optional[str]):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue