Message for priming AI behavior.
The system message is usually passed in as the first of a sequence of input messages.
SystemMessage(
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?"),
]
# Define a chat model and invoke it with the messages
print(model.invoke(messages))The contents of the message.
Currently inherited from BaseMessage, but not used.
Currently inherited from BaseMessage, but not used.
The name of the function.
The unique identifier of the node.
Return standard, typed ContentBlock dicts from the message.
Prompt text.
Return True as this class is serializable.
Get the namespace of the LangChain object.
Return a unique identifier for this class for serialization purposes.
Convert the graph to a JSON-serializable format.
Serialize a "not implemented" object.