Message from the user.
A HumanMessage is a message that is passed in from a user to the model.
HumanMessage(
self,
content: str | list[str | dict] | None = None,
content_blocks: list[types.ContentBlock] | None = None,
**kwargs: Any = {}
)Example:
from langchain_core.messages import HumanMessage, SystemMessage
messages = [
SystemMessage(content="You are a helpful assistant! Your name is Bob."),
HumanMessage(content="What is your name?"),
]
# Instantiate a chat model and invoke it with the messages
model = ...
print(model.invoke(messages))The contents of the message.
Reserved for additional payload data associated with the message.
Examples: response headers, logprobs, token counts, model name.
An optional name for the message.
An optional unique identifier for the message.
Load content blocks from the message content.
Get the text content of the message as a string.