From 9b8861e3e152e2e94001423363ab97dfb480f854 Mon Sep 17 00:00:00 2001 From: takatost Date: Wed, 17 Apr 2024 09:25:50 +0800 Subject: [PATCH] feat: increase read timeout of OpenAI Compatible API, Ollama, Nvidia LLM (#3538) --- api/core/model_runtime/model_providers/nvidia/llm/llm.py | 4 ++-- api/core/model_runtime/model_providers/ollama/llm/llm.py | 2 +- .../model_providers/openai_api_compatible/llm/llm.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/core/model_runtime/model_providers/nvidia/llm/llm.py b/api/core/model_runtime/model_providers/nvidia/llm/llm.py index 81291bf6c4..b1c2b77358 100644 --- a/api/core/model_runtime/model_providers/nvidia/llm/llm.py +++ b/api/core/model_runtime/model_providers/nvidia/llm/llm.py @@ -131,7 +131,7 @@ class NVIDIALargeLanguageModel(OAIAPICompatLargeLanguageModel): endpoint_url, headers=headers, json=data, - timeout=(10, 60) + timeout=(10, 300) ) if response.status_code != 200: @@ -232,7 +232,7 @@ class NVIDIALargeLanguageModel(OAIAPICompatLargeLanguageModel): endpoint_url, headers=headers, json=data, - timeout=(10, 60), + timeout=(10, 300), stream=stream ) diff --git a/api/core/model_runtime/model_providers/ollama/llm/llm.py b/api/core/model_runtime/model_providers/ollama/llm/llm.py index 3589ca77cc..fcb94084a5 100644 --- a/api/core/model_runtime/model_providers/ollama/llm/llm.py +++ b/api/core/model_runtime/model_providers/ollama/llm/llm.py @@ -201,7 +201,7 @@ class OllamaLargeLanguageModel(LargeLanguageModel): endpoint_url, headers=headers, json=data, - timeout=(10, 60), + timeout=(10, 300), stream=stream ) diff --git a/api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py b/api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py index 45a5b49a8b..e86755d693 100644 --- a/api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py +++ b/api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py @@ -138,7 +138,7 @@ class OAIAPICompatLargeLanguageModel(_CommonOAI_API_Compat, LargeLanguageModel): endpoint_url, headers=headers, json=data, - timeout=(10, 60) + timeout=(10, 300) ) if response.status_code != 200: @@ -334,7 +334,7 @@ class OAIAPICompatLargeLanguageModel(_CommonOAI_API_Compat, LargeLanguageModel): endpoint_url, headers=headers, json=data, - timeout=(10, 60), + timeout=(10, 300), stream=stream )