mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +08:00
fix: bad xinference error (#2384)
This commit is contained in:
parent
b814f0b7e3
commit
56c25bfb78
|
@ -70,7 +70,7 @@ class XinferenceAILargeLanguageModel(LargeLanguageModel):
|
|||
elif 'generate' in extra_param.model_ability:
|
||||
credentials['completion_type'] = 'completion'
|
||||
else:
|
||||
raise ValueError(f'xinference model ability {extra_param.model_ability} is not supported')
|
||||
raise ValueError(f'xinference model ability {extra_param.model_ability} is not supported, check if you have the right model type')
|
||||
|
||||
if extra_param.support_function_call:
|
||||
credentials['support_function_call'] = True
|
||||
|
|
|
@ -114,8 +114,10 @@ class XinferenceTextEmbeddingModel(TextEmbeddingModel):
|
|||
credentials['max_tokens'] = extra_args.max_tokens
|
||||
|
||||
self._invoke(model=model, credentials=credentials, texts=['ping'])
|
||||
except (InvokeAuthorizationError, RuntimeError):
|
||||
raise CredentialsValidateFailedError('Invalid api key')
|
||||
except InvokeAuthorizationError as e:
|
||||
raise CredentialsValidateFailedError(f'Failed to validate credentials for model {model}: {e}')
|
||||
except RuntimeError as e:
|
||||
raise CredentialsValidateFailedError(e)
|
||||
|
||||
@property
|
||||
def _invoke_error_mapping(self) -> dict[type[InvokeError], list[type[Exception]]]:
|
||||
|
|
Loading…
Reference in New Issue
Block a user