From 7f3dec7bee584a91eb35a2fb9d1381bdb32669da Mon Sep 17 00:00:00 2001 From: Jyong <76649700+JohnJyong@users.noreply.github.com> Date: Wed, 6 Mar 2024 16:45:40 +0800 Subject: [PATCH] fix error msg format issue (#2715) Co-authored-by: jyong --- .../model_providers/baichuan/text_embedding/text_embedding.py | 2 +- .../model_providers/jina/text_embedding/text_embedding.py | 2 +- .../model_providers/localai/text_embedding/text_embedding.py | 2 +- .../model_providers/minimax/text_embedding/text_embedding.py | 2 +- .../model_providers/openllm/text_embedding/text_embedding.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/core/model_runtime/model_providers/baichuan/text_embedding/text_embedding.py b/api/core/model_runtime/model_providers/baichuan/text_embedding/text_embedding.py index da4ba5588..535714f66 100644 --- a/api/core/model_runtime/model_providers/baichuan/text_embedding/text_embedding.py +++ b/api/core/model_runtime/model_providers/baichuan/text_embedding/text_embedding.py @@ -108,7 +108,7 @@ class BaichuanTextEmbeddingModel(TextEmbeddingModel): try: response = post(url, headers=headers, data=dumps(data)) except Exception as e: - raise InvokeConnectionError(e) + raise InvokeConnectionError(str(e)) if response.status_code != 200: try: diff --git a/api/core/model_runtime/model_providers/jina/text_embedding/text_embedding.py b/api/core/model_runtime/model_providers/jina/text_embedding/text_embedding.py index 5c146972c..da922232c 100644 --- a/api/core/model_runtime/model_providers/jina/text_embedding/text_embedding.py +++ b/api/core/model_runtime/model_providers/jina/text_embedding/text_embedding.py @@ -57,7 +57,7 @@ class JinaTextEmbeddingModel(TextEmbeddingModel): try: response = post(url, headers=headers, data=dumps(data)) except Exception as e: - raise InvokeConnectionError(e) + raise InvokeConnectionError(str(e)) if response.status_code != 200: try: diff --git a/api/core/model_runtime/model_providers/localai/text_embedding/text_embedding.py b/api/core/model_runtime/model_providers/localai/text_embedding/text_embedding.py index 39143127e..c95007d27 100644 --- a/api/core/model_runtime/model_providers/localai/text_embedding/text_embedding.py +++ b/api/core/model_runtime/model_providers/localai/text_embedding/text_embedding.py @@ -59,7 +59,7 @@ class LocalAITextEmbeddingModel(TextEmbeddingModel): try: response = post(join(url, 'embeddings'), headers=headers, data=dumps(data), timeout=10) except Exception as e: - raise InvokeConnectionError(e) + raise InvokeConnectionError(str(e)) if response.status_code != 200: try: diff --git a/api/core/model_runtime/model_providers/minimax/text_embedding/text_embedding.py b/api/core/model_runtime/model_providers/minimax/text_embedding/text_embedding.py index edf4d6005..85dc6ef51 100644 --- a/api/core/model_runtime/model_providers/minimax/text_embedding/text_embedding.py +++ b/api/core/model_runtime/model_providers/minimax/text_embedding/text_embedding.py @@ -65,7 +65,7 @@ class MinimaxTextEmbeddingModel(TextEmbeddingModel): try: response = post(url, headers=headers, data=dumps(data)) except Exception as e: - raise InvokeConnectionError(e) + raise InvokeConnectionError(str(e)) if response.status_code != 200: raise InvokeServerUnavailableError(response.text) diff --git a/api/core/model_runtime/model_providers/openllm/text_embedding/text_embedding.py b/api/core/model_runtime/model_providers/openllm/text_embedding/text_embedding.py index 33847c0cb..4dbd0678e 100644 --- a/api/core/model_runtime/model_providers/openllm/text_embedding/text_embedding.py +++ b/api/core/model_runtime/model_providers/openllm/text_embedding/text_embedding.py @@ -53,7 +53,7 @@ class OpenLLMTextEmbeddingModel(TextEmbeddingModel): # cloud not connect to the server raise InvokeAuthorizationError(f"Invalid server URL: {e}") except Exception as e: - raise InvokeConnectionError(e) + raise InvokeConnectionError(str(e)) if response.status_code != 200: if response.status_code == 400: