langchain_community.llms.sagemaker_endpoint.ContentHandlerBase

class langchain_community.llms.sagemaker_endpoint.ContentHandlerBase[source]

处理程序类,用于将LLM输入转换为SageMaker端点期望的格式。

同样,该类处理将SageMaker端点的输出转换为LLM类期望的格式。

Attributes

accepts

从端点返回的响应数据的MIME类型

content_type

传递给端点的输入数据的MIME类型。

Methods

__init__()

transform_input(prompt, model_kwargs)

将输入转换为模型可以接受的格式,作为请求主体。应该以 content_type 请求头中指定的格式返回字节或可寻址文件对象。

transform_output(output)

将模型的输出转换为LLM类所期望的字符串。

__init__()
abstract transform_input(prompt: INPUT_TYPE, model_kwargs: Dict) bytes[source]

将输入转换为模型可以接受的格式,作为请求主体。应该以 content_type 请求头中指定的格式返回字节或可寻址文件对象。

Parameters
  • prompt (INPUT_TYPE) –

  • model_kwargs (Dict) –

Return type

bytes

abstract transform_output(output: bytes) OUTPUT_TYPE[source]

将模型的输出转换为LLM类所期望的字符串。

Parameters

output (bytes) –

Return type

OUTPUT_TYPE

Examples using ContentHandlerBase