Unverified Commit 56c25bfb authored by Yeuoly's avatar Yeuoly Committed by GitHub

fix: bad xinference error (#2384)

parent b814f0b7
...@@ -70,7 +70,7 @@ class XinferenceAILargeLanguageModel(LargeLanguageModel): ...@@ -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): ...@@ -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]]]:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment