langchain_community.chat_models.azureml_endpoint
.CustomOpenAIChatContentFormatter¶
- class langchain_community.chat_models.azureml_endpoint.CustomOpenAIChatContentFormatter[source]¶
用于具有类似OpenAI API方案的模型的聊天内容格式化程序。
Attributes
SUPPORTED_ROLES
accepts
从端点返回的响应数据的MIME类型
content_type
输入数据传递到端点的MIME类型
format_error_msg
supported_api_types
给定格式化程序支持的API。Azure ML支持使用不同的托管方法部署模型。每种方法可能具有不同的API结构。
Methods
__init__
()escape_special_characters
(prompt)转义`prompt`中的任何特殊字符
format_messages_request_payload
(messages, ...)根据所选的API格式化请求
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_messages_request_payload(messages: List[BaseMessage], model_kwargs: Dict, api_type: AzureMLEndpointApiType) bytes [source]¶
根据所选的API格式化请求
- Parameters
messages (List[BaseMessage]) –
model_kwargs (Dict) –
api_type (AzureMLEndpointApiType) –
- Return type
bytes
- format_request_payload(prompt: str, model_kwargs: Dict, api_type: AzureMLEndpointApiType = AzureMLEndpointApiType.dedicated) Any ¶
根据模型的输入模式格式化请求体。根据请求头中指定的content_type返回字节或可寻址文件对象。
- Parameters
prompt (str) –
model_kwargs (Dict) –
api_type (AzureMLEndpointApiType) –
- Return type
Any
- format_response_payload(output: bytes, api_type: AzureMLEndpointApiType = AzureMLEndpointApiType.dedicated) ChatGeneration [source]¶
格式化响应
- Parameters
output (bytes) –
api_type (AzureMLEndpointApiType) –
- Return type