From 2a27dad2fb624b427ca10849adb4d4b9aba7fae1 Mon Sep 17 00:00:00 2001 From: takatost Date: Sat, 19 Aug 2023 14:16:41 +0800 Subject: [PATCH] fix: run model serval ex not return (#915) --- api/core/model_providers/models/llm/azure_openai_model.py | 2 +- api/core/model_providers/models/llm/openai_model.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/core/model_providers/models/llm/azure_openai_model.py b/api/core/model_providers/models/llm/azure_openai_model.py index b2f6159b4f..66acaaeaa1 100644 --- a/api/core/model_providers/models/llm/azure_openai_model.py +++ b/api/core/model_providers/models/llm/azure_openai_model.py @@ -166,7 +166,7 @@ class AzureOpenAIModel(BaseLLM): elif isinstance(ex, openai.error.RateLimitError): return LLMRateLimitError('Azure ' + str(ex)) elif isinstance(ex, openai.error.AuthenticationError): - raise LLMAuthorizationError('Azure ' + str(ex)) + return LLMAuthorizationError('Azure ' + str(ex)) elif isinstance(ex, openai.error.OpenAIError): return LLMBadRequestError('Azure ' + ex.__class__.__name__ + ":" + str(ex)) else: diff --git a/api/core/model_providers/models/llm/openai_model.py b/api/core/model_providers/models/llm/openai_model.py index e3dab3e9d7..e7026c0241 100644 --- a/api/core/model_providers/models/llm/openai_model.py +++ b/api/core/model_providers/models/llm/openai_model.py @@ -185,7 +185,7 @@ class OpenAIModel(BaseLLM): elif isinstance(ex, openai.error.RateLimitError): return LLMRateLimitError(str(ex)) elif isinstance(ex, openai.error.AuthenticationError): - raise LLMAuthorizationError(str(ex)) + return LLMAuthorizationError(str(ex)) elif isinstance(ex, openai.error.OpenAIError): return LLMBadRequestError(ex.__class__.__name__ + ":" + str(ex)) else: