langchain_community.llms.azureml_endpoint
.ContentFormatterBase¶
- class langchain_community.llms.azureml_endpoint.ContentFormatterBase[source]¶
将AzureML端点的请求和响应转换为所需的模式。
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 [source]¶
转义`prompt`中的任何特殊字符
- Parameters
prompt (str) –
- Return type
str
- format_request_payload(prompt: str, model_kwargs: Dict, api_type: AzureMLEndpointApiType = AzureMLEndpointApiType.dedicated) Any [source]¶
根据模型的输入模式格式化请求体。根据请求头中指定的content_type返回字节或可寻址文件对象。
- Parameters
prompt (str) –
model_kwargs (Dict) –
api_type (AzureMLEndpointApiType) –
- Return type
Any
- abstract format_response_payload(output: bytes, api_type: AzureMLEndpointApiType = AzureMLEndpointApiType.dedicated) Generation [source]¶
根据模型的输出模式格式化响应主体。返回从响应接收到的数据类型。
- Parameters
output (bytes) –
api_type (AzureMLEndpointApiType) –
- Return type