LLMContentHandler#

class langchain_community.llms.sagemaker_endpoint.LLMContentHandler[source]#

Content handler for LLM class.

Attributes

accepts

The MIME type of the response data returned from endpoint

content_type

The MIME type of the input data passed to endpoint

Methods

__init__()

transform_input(prompt,Β model_kwargs)

Transforms the input to a format that model can accept as the request Body.

transform_output(output)

Transforms the output from the model to string that the LLM class expects.

__init__()#
abstract transform_input(prompt: INPUT_TYPE, model_kwargs: Dict) β†’ bytes#

Transforms the input to a format that model can accept as the request Body. Should return bytes or seekable file like object in the format specified in the content_type request header.

Parameters:
  • prompt (INPUT_TYPE) –

  • model_kwargs (Dict) –

Return type:

bytes

abstract transform_output(output: bytes) β†’ OUTPUT_TYPE#

Transforms the output from the model to string that the LLM class expects.

Parameters:

output (bytes) –

Return type:

OUTPUT_TYPE

Examples using LLMContentHandler