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: """
@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 """
model:claude-3-5-sonnet-20240620label:en_US:claude-3-5-sonnet-20240620model_type:llmfeatures: - agent-thought - vision - tool-call - stream-tool-call - documentmodel_properties:mode:chatcontext_size:200000parameter_rules: - name:temperatureuse_template:temperature - name:top_puse_template:top_p - name:top_klabel:zh_Hans:取样数量en_US:Top ktype:inthelp:zh_Hans:仅从每个后续标记的前 K 个选项中采样。en_US:Only sample from the top K options for each subsequent token.required:false - name:max_tokensuse_template:max_tokensrequired:truedefault:8192min:1max:8192 - name:response_formatuse_template:response_formatpricing:input:'3.00'output:'15.00'unit:'0.000001'currency:USD