Bases: BaseMessage
Message from an AI.
AIMessage is returned from a chat model as a response to a prompt.
This message represents the output of the model and consists of both the raw output as returned by the model together standardized fields (e.g., tool calls, usage metadata) added by the LangChain framework.
Pass in content as positional arg.
content β The content of the message.
kwargs β Additional arguments to pass to the parent class.
Reserved for additional payload data associated with the message.
For example, for a message from an AI, this could include tool calls as encoded by the model provider.
The string contents of the message.
Use to denote that a message is part of an example conversation.
At the moment, this is ignored by most models. Usage is discouraged.
An optional unique identifier for the message. This should ideally be provided by the provider/model which created the message.
coerce_numbers_to_str = True
If provided, tool calls with parsing errors associated with the message.
An optional name for the message.
This can be used to provide a human-readable name for the message.
Usage of this field is optional, and whether itβs used or not is up to the model implementation.
Response metadata. For example: response headers, logprobs, token counts, model name.
If provided, tool calls associated with the message.
The type of the message (used for deserialization). Defaults to βaiβ.
If provided, usage metadata for a message, such as token counts.
This is a standard representation of token usage that is consistent across models.
Print a pretty representation of the message.
None
Return a pretty representation of the message.
html (bool) β Whether to return an HTML-formatted string. Defaults to False.
A pretty representation of the message.
str
Get the text content of the message.
The text content of the message.
str
Examples using AIMessage
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4