File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -39,17 +39,24 @@ func (a *Accumulator) buildCompleteMessageFromResponsesStreamChunks(chunks []*Re
3939 Content : & schemas.ResponsesMessageContent {},
4040 }
4141 }
42- // Add content part to the message
42+ // Add content part to the message at the correct index
4343 if messageMap [* streamResp .OutputIndex ].Content == nil {
4444 messageMap [* streamResp .OutputIndex ].Content = & schemas.ResponsesMessageContent {}
4545 }
4646 if messageMap [* streamResp .OutputIndex ].Content .ContentBlocks == nil {
47- messageMap [* streamResp .OutputIndex ].Content .ContentBlocks = make ([]schemas.ResponsesMessageContentBlock , 0 )
47+ messageMap [* streamResp .OutputIndex ].Content .ContentBlocks = make ([]schemas.ResponsesMessageContentBlock , * streamResp . ContentIndex + 1 )
4848 }
49- messageMap [* streamResp .OutputIndex ].Content .ContentBlocks = append (
50- messageMap [* streamResp .OutputIndex ].Content .ContentBlocks ,
51- * streamResp .Part ,
52- )
49+
50+ // Ensure we have enough content blocks to accommodate the index
51+ for len (messageMap [* streamResp .OutputIndex ].Content .ContentBlocks ) <= * streamResp .ContentIndex {
52+ messageMap [* streamResp .OutputIndex ].Content .ContentBlocks = append (
53+ messageMap [* streamResp .OutputIndex ].Content .ContentBlocks ,
54+ schemas.ResponsesMessageContentBlock {},
55+ )
56+ }
57+
58+ // Assign the part at the correct index instead of appending
59+ messageMap [* streamResp .OutputIndex ].Content .ContentBlocks [* streamResp .ContentIndex ] = * streamResp .Part
5360 }
5461
5562 case schemas .ResponsesStreamResponseTypeOutputTextDelta :
Original file line number Diff line number Diff line change @@ -494,7 +494,10 @@ export interface ResponsesTool {
494494// Reasoning parameters
495495export interface ResponsesParametersReasoning {
496496 effort ?: "minimal" | "low" | "medium" | "high" ;
497- generate_summary ?: string ; // Deprecated
497+ /**
498+ * @deprecated Use `summary` instead
499+ */
500+ generate_summary ?: string ;
498501 summary ?: "auto" | "concise" | "detailed" ;
499502}
500503
You can’t perform that action at this time.
0 commit comments