Source code for langchain_core.messages.human

from typing import List, Literal

from langchain_core.messages.base import BaseMessage, BaseMessageChunk


[docs]class HumanMessage(BaseMessage): """来自人类的消息。""" example: bool = False """该消息是否作为示例对话的一部分传递给模型。""" type: Literal["human"] = "human"
[docs] @classmethod def get_lc_namespace(cls) -> List[str]: """获取langchain对象的命名空间。""" return ["langchain", "schema", "messages"]
HumanMessage.update_forward_refs()
[docs]class HumanMessageChunk(HumanMessage, BaseMessageChunk): """人类消息块。""" # Ignoring mypy re-assignment here since we're overriding the value # to make sure that the chunk variant can be discriminated from the # non-chunk variant. type: Literal["HumanMessageChunk"] = "HumanMessageChunk" # type: ignore[assignment] # noqa: E501
[docs] @classmethod def get_lc_namespace(cls) -> List[str]: """获取langchain对象的命名空间。""" return ["langchain", "schema", "messages"]