GPT2ContentFormatter#

class langchain_community.llms.azureml_endpoint.GPT2ContentFormatter[source]#

Content handler for GPT2

Attributes

accepts

The MIME type of the response data returned from the endpoint

content_type

The MIME type of the input data passed to the endpoint

format_error_msg

supported_api_types

Supported APIs for the given formatter.

Methods

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.

static escape_special_characters(prompt: str) β†’ str#

Escapes any special characters in prompt

Parameters:

prompt (str)

Return type:

str

format_request_payload(prompt: str, model_kwargs: Dict, api_type: AzureMLEndpointApiType) β†’ bytes[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:
Return type:

bytes

format_response_payload(output: bytes, api_type: AzureMLEndpointApiType) β†’ 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:
Return type:

Generation