Chat invocation
Send a user prompt to a chat model.
AI Agents · Class
HumanMessage represents a user's input in LangChain conversations. Create it with text or structured multimodal content and pass it to chat models or LangGraph state.
HumanMessage is the LangChain message type for representing input from a user. Construct one with text or structured content, then pass it to a chat model or graph as part of the conversation state.
new HumanMessage(content)| Name | Type | Description |
|---|---|---|
content | string | MessageContent | The user message content, supplied as text or structured multimodal content. |
A HumanMessage instance representing a user-authored message.
import { HumanMessage } from "@langchain/core/messages";
const message = new HumanMessage("What time is it?");
console.log(message.role); // "user"
console.log(message.content); // "What time is it?"Creates a user-authored message that can be included in a chat model's message array.
Send a user prompt to a chat model.
Seed or update a LangGraph conversation state.
Provide multimodal user input such as images or files.
AIMessageSystemMessageBaseMessageStateGraph