langchain_community.llms.azureml_endpoint.ContentFormatterBase¶
- class langchain_community.llms.azureml_endpoint.ContentFormatterBase[source]¶
Transform request and response of AzureML endpoint to match with required schema.
Attributes
acceptsThe MIME type of the response data returned from the endpoint
content_typeThe MIME type of the input data passed to the endpoint
format_error_msgsupported_api_typesSupported APIs for the given formatter.
Methods
__init__()escape_special_characters(prompt)Escapes any special characters in prompt
format_request_payload(prompt, model_kwargs)Formats the request body according to the input schema of the model.
format_response_payload(output[, api_type])Formats the response body according to the output schema of the model.
- __init__()¶
- static escape_special_characters(prompt: str) str[source]¶
Escapes any special characters in prompt
- Parameters
prompt (str) –
- Return type
str
- format_request_payload(prompt: str, model_kwargs: Dict, api_type: AzureMLEndpointApiType = AzureMLEndpointApiType.realtime) Any[source]¶
Formats the request body according to the input schema of the model. Returns bytes or seekable file like object in the format specified in the content_type request header.
- Parameters
prompt (str) –
model_kwargs (Dict) –
api_type (AzureMLEndpointApiType) –
- Return type
Any
- abstract format_response_payload(output: bytes, api_type: AzureMLEndpointApiType = AzureMLEndpointApiType.realtime) Generation[source]¶
Formats the response body according to the output schema of the model. Returns the data type that is received from the response.
- Parameters
output (bytes) –
api_type (AzureMLEndpointApiType) –
- Return type