Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion agent/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ func (resp *Response) Usage() message.UsageDetails {
return usage
}

// Coalesce merges adjacent compatible content items within each message.
// Coalesce merges compatible content items within each message (adjacent
// text/reasoning/data runs, and call-ID-keyed results regardless of position).
func (resp *Response) Coalesce() {
if resp == nil {
return
Expand Down
6 changes: 4 additions & 2 deletions message/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -1142,8 +1142,10 @@ func (t *WebSearchToolResultContent) MarshalJSON() ([]byte, error) {

func (t WebSearchToolResultContent) kind() contentKind { return "webSearchToolResult" }

// Coalesce combines adjacent compatible content elements and returns the
// resulting slice. It may reuse and modify the receiver's backing array.
// Coalesce combines compatible content elements and returns the resulting
// slice: adjacent runs of text, reasoning, and data content, plus
// image-generation and web-search results that share a call ID regardless of
// position. It may reuse and modify the receiver's backing array.
func (contents Contents) Coalesce() Contents {
var sb strings.Builder
mergeText := func(contents []Content, start, end int) string {
Expand Down
Loading