Represents a chunk of a message, which can be concatenated with other message chunks. It includes a method _merge_kwargs_dict() for merging additional keyword arguments from another BaseMessageChunk into this one. It also overrides the __add__() method to support concatenation of BaseMessageChunk instances.

Hierarchy (view full)

Constructors

Properties

additional_kwargs: {
    function_call?: FunctionCall;
    tool_calls?: OpenAIToolCall[];
    [key: string]: unknown;
}

Additional keyword arguments

Type declaration

  • [key: string]: unknown
  • Optionalfunction_call?: FunctionCall

    Use "tool_calls" field on AIMessages instead

  • Optionaltool_calls?: OpenAIToolCall[]

    Use "tool_calls" field on AIMessages instead

The content of the message.

id?: string

An optional unique identifier for the message. This should ideally be provided by the provider/model which created the message.

name?: string

The name of the message sender in a multi-user chat.

response_metadata: Record<string, any>

Response metadata. For example: response headers, logprobs, token counts.

Accessors

Methods