@@ -58,7 +58,7 @@ class ModelResponsePartsManager:
5858 """A list of parts (text or tool calls) that make up the current state of the model's response."""
5959 _vendor_id_to_part_index : dict [VendorId , int ] = field (default_factory = dict , init = False )
6060 """Maps a vendor's "part" ID (if provided) to the index in `_parts` where that part resides."""
61- _tag_buffer : dict [VendorId , str ] = field (default_factory = dict , init = False )
61+ _thinking_tag_buffer : dict [VendorId , str ] = field (default_factory = dict , init = False )
6262 """Buffers partial content when thinking tags might be split across chunks."""
6363
6464 def get_parts (self ) -> list [ModelResponsePart ]:
@@ -192,7 +192,7 @@ def _handle_text_delta_with_thinking_tags(
192192 ) -> Generator [ModelResponseStreamEvent , None , None ]:
193193 """Handle text delta with thinking tag detection and buffering for split tags."""
194194 start_tag , end_tag = thinking_tags
195- buffered = self ._tag_buffer .get (vendor_part_id , '' )
195+ buffered = self ._thinking_tag_buffer .get (vendor_part_id , '' )
196196 combined_content = buffered + content
197197
198198 part_index = self ._vendor_id_to_part_index .get (vendor_part_id )
@@ -201,24 +201,24 @@ def _handle_text_delta_with_thinking_tags(
201201 if existing_part is not None and isinstance (existing_part , ThinkingPart ):
202202 if combined_content == end_tag :
203203 self ._vendor_id_to_part_index .pop (vendor_part_id )
204- self ._tag_buffer .pop (vendor_part_id , None )
204+ self ._thinking_tag_buffer .pop (vendor_part_id , None )
205205 return
206206 else :
207- self ._tag_buffer .pop (vendor_part_id , None )
207+ self ._thinking_tag_buffer .pop (vendor_part_id , None )
208208 yield self .handle_thinking_delta (vendor_part_id = vendor_part_id , content = combined_content )
209209 return
210210
211211 if combined_content == start_tag :
212- self ._tag_buffer .pop (vendor_part_id , None )
212+ self ._thinking_tag_buffer .pop (vendor_part_id , None )
213213 self ._vendor_id_to_part_index .pop (vendor_part_id , None )
214214 yield self .handle_thinking_delta (vendor_part_id = vendor_part_id , content = '' )
215215 return
216216
217217 if content .startswith (start_tag [0 ]) and self ._could_be_tag_start (combined_content , start_tag ):
218- self ._tag_buffer [vendor_part_id ] = combined_content
218+ self ._thinking_tag_buffer [vendor_part_id ] = combined_content
219219 return
220220
221- self ._tag_buffer .pop (vendor_part_id , None )
221+ self ._thinking_tag_buffer .pop (vendor_part_id , None )
222222 yield from self ._handle_text_delta_simple (
223223 vendor_part_id = vendor_part_id ,
224224 content = combined_content ,
0 commit comments