Message from an AI.
public class AiMessageMessage from an AI.
An 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 and standardized fields (e.g., tool calls, usage metadata) added by
the LangChain framework.
unexpectedly missing or null (e.g.
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
Usage metadata for a message, such as token counts.
Returns the raw JSON value of [content].
Returns the raw JSON value of [id].
Returns the raw JSON value of [invalidToolCalls].
Returns the raw JSON value of [name].
Returns the raw JSON value of [toolCalls].
Returns the raw JSON value of [type].
Returns the raw JSON value of [usageMetadata].
Returns a mutable builder for constructing an instance of [AiMessage].
unexpectedly missing or null (e.g.
unexpectedly missing or null (e.g.
unexpectedly missing or null (e.g.
Alias for calling [content] with
Content.ofUnnamedSchemaWithArrayParent0s(unnamedSchemaWithArrayParent0s)..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
Adds a single [InvalidToolCall] to [invalidToolCalls]..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
Adds a single [ToolCall] to [toolCalls]..
if the server responded with an unexpected value)..
if the server responded with an unexpected value)..
Usage metadata for a message, such as token counts.
Usage metadata for a message, such as token counts.
Usage metadata for a message, such as token counts.
Returns an immutable instance of [AiMessage].