langchain_community.llms.azureml_endpoint.HFContentFormatter

class langchain_community.llms.azureml_endpoint.HFContentFormatter[source]

HuggingFace目录中LLMs的内容处理程序。

Attributes

accepts

从端点返回的响应数据的MIME类型

content_type

输入数据传递到端点的MIME类型

format_error_msg

supported_api_types

给定格式化程序支持的API。Azure ML支持使用不同的托管方法部署模型。每种方法可能具有不同的API结构。

Methods

__init__()

escape_special_characters(prompt)

转义`prompt`中的任何特殊字符

format_request_payload(prompt, model_kwargs, ...)

根据模型的输入模式格式化请求体。根据请求头中指定的content_type返回字节或可寻址文件对象。

format_response_payload(output, api_type)

根据模型的输出模式格式化响应主体。返回从响应接收到的数据类型。

__init__()
static escape_special_characters(prompt: str) str

转义`prompt`中的任何特殊字符

Parameters

prompt (str) –

Return type

str

format_request_payload(prompt: str, model_kwargs: Dict, api_type: AzureMLEndpointApiType) bytes[source]

根据模型的输入模式格式化请求体。根据请求头中指定的content_type返回字节或可寻址文件对象。

Parameters
Return type

bytes

format_response_payload(output: bytes, api_type: AzureMLEndpointApiType) Generation[source]

根据模型的输出模式格式化响应主体。返回从响应接收到的数据类型。

Parameters
Return type

Generation