langchain_community.llms.bedrock
.LLMInputOutputAdapter¶
- class langchain_community.llms.bedrock.LLMInputOutputAdapter[source]¶
适配器类,用于将 Langchain 从输入格式准备到 LLM 模型期望的格式。
它还提供了一个辅助函数,用于从模型响应中提取生成的文本。
属性
provider_to_output_key_map
方法
__init__
()aprepare_output_stream
(provider, response[, ...])prepare_input
(provider, model_kwargs[, ...])prepare_output
(provider, response)prepare_output_stream
(provider, response[, ...])- __init__()¶
- classmethod aprepare_output_stream(provider: str, response: Any, stop: Optional[List[str]] = None) AsyncIterator[GenerationChunk] [source]¶
- 参数
provider (str) –
response (Any) –
stop (Optional[List[str]]) –
- 返回类型
AsyncIterator[GenerationChunk]
- classmethod prepare_input(provider: str, model_kwargs: Dict[str, Any], prompt: Optional[str] = None, system: Optional[str] = None, messages: Optional[List[Dict]] = None) Dict[str, Any] [source]¶
- 参数
provider (str) –
model_kwargs (Dict[str, Any]) –
prompt (Optional[str]) –
system (Optional[str]) –
messages (Optional[List[Dict]]) –
- 返回类型
Dict[str, Any]
- classmethod prepare_output(provider: str, response: Any) dict [source]¶
- 参数
provider (str) –
response (Any) –
- 返回类型
字典对象
- classmethod prepare_output_stream(provider: str, response: Any, stop: Optional[List[str]] = None, messages_api: bool = False) Iterator[GenerationChunk] [source]¶
- 参数
provider (str) –
response (Any) –
stop (Optional[List[str]]) –
messages_api (布尔值) –
- 返回类型
迭代器[生成块]