provider:xinference# Specify vendor identifierlabel: # Vendor display name, can be set in en_US (English) and zh_Hans (Simplified Chinese). If zh_Hans is not set, en_US will be used by default.
en_US:Xorbits Inferenceicon_small: # Small icon, refer to other vendors' icons, stored in the _assets directory under the corresponding vendor implementation directory. Language strategy is the same as label.
en_US:icon_s_en.svgicon_large:# Large iconen_US:icon_l_en.svghelp:# Helptitle:en_US:How to deploy Xinferencezh_Hans:如何部署 Xinferenceurl:en_US:https://github.com/xorbitsai/inferencesupported_model_types:# Supported model types. Xinference supports LLM/Text Embedding/Rerank- llm- text-embedding- rerankconfigurate_methods: # Since Xinference is a locally deployed vendor and does not have predefined models, you need to deploy the required models according to Xinference's documentation. Therefore, only custom models are supported here.
- customizable-modelprovider_credential_schema:credential_form_schemas:
- variable:model_nametype:text-inputlabel:en_US:Model namezh_Hans:模型名称required:trueplaceholder:zh_Hans:填写模型名称en_US:Input model name
Xinferenceのローカルデプロイのアドレスを記入します。
- variable:server_urllabel:zh_Hans:服务器URLen_US:Server urltype:text-inputrequired:trueplaceholder:zh_Hans:在此输入Xinference的服务器地址,如 https://example.com/xxxen_US:Enter the url of your Xinference, for example https://example.com/xxx
各モデルには一意の model_uid があるため、ここで定義する必要があります。
- variable:model_uidlabel:zh_Hans:模型 UIDen_US:Model uidtype:text-inputrequired:trueplaceholder:zh_Hans:在此输入您的 Model UIDen_US:Enter the model uid
def_invoke(self,model:str,credentials:dict,prompt_messages: list[PromptMessage],model_parameters:dict,tools: Optional[list[PromptMessageTool]]=None,stop: Optional[List[str]]=None,stream:bool=True,user: Optional[str]=None) \-> Union[LLMResult, Generator]:""" Invoke large language model :param model: model name :param credentials: model credentials :param prompt_messages: prompt messages :param model_parameters: model parameters :param tools: tools for tool calling :param stop: stop words :param stream: is stream response :param user: unique user id :return: full response or stream response chunk generator result """
defget_num_tokens(self,model:str,credentials:dict,prompt_messages: list[PromptMessage],tools: Optional[list[PromptMessageTool]]=None) ->int:""" Get number of tokens for given prompt messages :param model: model name :param credentials: model credentials :param prompt_messages: prompt messages :param tools: tools for tool calling :return: """
defvalidate_credentials(self,model:str,credentials:dict) ->None:""" Validate model credentials :param model: model name :param credentials: model credentials :return: """
@propertydef_invoke_error_mapping(self) -> dict[type[InvokeError], list[type[Exception]]]:""" Map model invoke error to unified error The key is the error type thrown to the caller The value is the error type thrown by the model, which needs to be converted into a unified error type for the caller. :return: Invoke error mapping """