mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-05-01 21:20:19 +00:00
handle litellm APIError for the router and raise LLMProviderErrorRetryableTask (#750)
This commit is contained in:
parent
9cc290cc80
commit
b5d743d6eb
1 changed files with 2 additions and 3 deletions
|
|
@ -5,7 +5,6 @@ from asyncio import CancelledError
|
|||
from typing import Any
|
||||
|
||||
import litellm
|
||||
import openai
|
||||
import structlog
|
||||
|
||||
from skyvern.forge import app
|
||||
|
|
@ -107,8 +106,8 @@ class LLMAPIHandlerFactory:
|
|||
LOG.info("Calling LLM API", llm_key=llm_key, model=llm_config.model_name)
|
||||
response = await router.acompletion(model=main_model_group, messages=messages, **parameters)
|
||||
LOG.info("LLM API call successful", llm_key=llm_key, model=llm_config.model_name)
|
||||
except openai.OpenAIError as e:
|
||||
raise LLMProviderError(llm_key) from e
|
||||
except litellm.exceptions.APIError as e:
|
||||
raise LLMProviderErrorRetryableTask(llm_key) from e
|
||||
except Exception as e:
|
||||
LOG.exception(
|
||||
"LLM request failed unexpectedly",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue