ToolCallAggregator class

Utility for aggregating incremental ToolCall deltas from streaming APIs.

Many providers (including OpenAI) stream tool calls in multiple chunks:

  • The first chunk usually contains id + function.name + initial arguments.
  • Subsequent chunks often only include additional arguments.

This helper lets you merge those deltas into a single ToolCall per id.

Constructors

ToolCallAggregator()

Properties

completedCalls List<ToolCall>
Get all aggregated ToolCalls that have a non-empty function.name.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addDelta(ToolCall delta) ToolCall
Add a ToolCall delta and return the aggregated ToolCall for this id.
clear() → void
Clear all internal state.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited