mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 12:49:11 +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:
|
elif 'generate' in extra_param.model_ability:
|
||||||
credentials['completion_type'] = 'completion'
|
credentials['completion_type'] = 'completion'
|
||||||
else:
|
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:
|
if extra_param.support_function_call:
|
||||||
credentials['support_function_call'] = True
|
credentials['support_function_call'] = True
|
||||||
|
@ -114,8 +114,10 @@ class XinferenceTextEmbeddingModel(TextEmbeddingModel):
|
|||||||
credentials['max_tokens'] = extra_args.max_tokens
|
credentials['max_tokens'] = extra_args.max_tokens
|
||||||
|
|
||||||
self._invoke(model=model, credentials=credentials, texts=['ping'])
|
self._invoke(model=model, credentials=credentials, texts=['ping'])
|
||||||
except (InvokeAuthorizationError, RuntimeError):
|
except InvokeAuthorizationError as e:
|
||||||
raise CredentialsValidateFailedError('Invalid api key')
|
raise CredentialsValidateFailedError(f'Failed to validate credentials for model {model}: {e}')
|
||||||
|
except RuntimeError as e:
|
||||||
|
raise CredentialsValidateFailedError(e)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _invoke_error_mapping(self) -> dict[type[InvokeError], list[type[Exception]]]:
|
def _invoke_error_mapping(self) -> dict[type[InvokeError], list[type[Exception]]]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user