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 54f4405de1f92..45a5b49a8b0d7 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 @@ -152,6 +152,9 @@ def validate_credentials(self, model: str, credentials: dict) -> None: if (completion_type is LLMMode.CHAT and json_result['object'] == ''): json_result['object'] = 'chat.completion' + elif (completion_type is LLMMode.COMPLETION and json_result['object'] == ''): + json_result['object'] = 'text_completion' + if (completion_type is LLMMode.CHAT and ('object' not in json_result or json_result['object'] != 'chat.completion')): raise CredentialsValidateFailedError(