A chunk of a tool call (yielded when streaming).
When merging ToolCallChunks (e.g., via AIMessageChunk.__add__),
all string attributes are concatenated. Chunks are only merged if their
values of index are equal and not None.
Example:
left_chunks = [ToolCallChunk(name="foo", args='{"a":', index=0)]
right_chunks = [ToolCallChunk(name=None, args="1}", index=0)]
(
AIMessageChunk(content="", tool_call_chunks=left_chunks)
+ AIMessageChunk(content="", tool_call_chunks=right_chunks)
).tool_call_chunks == [ToolCallChunk(name="foo", args='{"a":1}', index=0)]ToolCallChunk()Used for serialization.
An identifier associated with the tool call.
An identifier is needed to associate a tool call request with a tool call result in events when multiple concurrent tool calls are made.
The name of the tool to be called.
The arguments to the tool call.
The index of the tool call in a sequence.
Provider-specific metadata.