@@ -235,22 +235,16 @@ def __init__(self):
235235
236236 def update_from_chunk (self , chunk : Dict [str , Any ], timing : Any ) -> None :
237237 """Update response state from a chunk."""
238- print ("DEBUG: Entering update_from_chunk" )
239- print (f"DEBUG: Current usage stats: { self .usage_stats } " )
240- print (f"DEBUG: Chunk: { chunk } " )
241-
242238 # Update usage stats if present
243239 if "usage" in chunk :
244240 usage = chunk ["usage" ]
245241 if usage is not None :
246- print (f"DEBUG: Updating usage stats with: { usage } " )
247242 # Update usage stats preserving existing values if not provided
248243 self .usage_stats .update ({
249244 "prompt_tokens" : usage .get ("prompt_tokens" , self .usage_stats ["prompt_tokens" ]),
250245 "completion_tokens" : usage .get ("completion_tokens" , self .usage_stats ["completion_tokens" ]),
251246 "total_tokens" : usage .get ("total_tokens" , self .usage_stats ["total_tokens" ])
252247 })
253- print (f"DEBUG: Updated usage stats: { self .usage_stats } " )
254248
255249 # Get the delta from the chunk
256250 delta = chunk .get ("choices" , [{}])[0 ]
@@ -290,7 +284,6 @@ def update_from_chunk(self, chunk: Dict[str, Any], timing: Any) -> None:
290284 self .usage_stats ["completion_tokens" ] / timing_stats ["generation_time" ]
291285 )
292286
293- print (f"DEBUG: Final usage stats in update_from_chunk: { self .usage_stats } " )
294287
295288 def _update_tool_calls (self , new_tool_calls : List [Dict [str , Any ]]) -> None :
296289 """Update tool calls, handling both full and partial updates."""
@@ -327,23 +320,17 @@ def has_updates(self) -> bool:
327320 has_usage = self .usage_stats ["prompt_tokens" ] > 0 or self .usage_stats ["completion_tokens" ] > 0
328321 has_finish = bool (self .finish_reason )
329322
330- print (f"DEBUG: has_updates check - content: { has_content } , tool_calls: { has_tool_calls } , usage: { has_usage } , finish: { has_finish } " )
331-
332323 return has_content or has_tool_calls or has_usage or has_finish
333324
334325 def to_output (self , buffer : str , transformer : Any ) -> LLMOutput :
335- """Convert current state to LLMOutput."""
336- print ("DEBUG: Entering to_output" )
337- print (f"DEBUG: Usage stats before conversion: { self .usage_stats } " )
338-
326+ """Convert current state to LLMOutput."""
339327 buffer , output , _ = transformer (self .content , buffer )
340328
341329 # Add tool calls if present
342330 if self .tool_calls :
343331 output .tool_calls = self .tool_calls
344332
345333 # Add usage stats
346- print (f"DEBUG: Creating LLMUsage with stats: { self .usage_stats } " )
347334 output .usage = LLMUsage (
348335 stop_reason = self .usage_stats ["stop_reason" ],
349336 time_to_first_token = self .timing_stats ["time_to_first_token" ] or 0.0 ,
@@ -354,7 +341,6 @@ def to_output(self, buffer: str, transformer: Any) -> LLMOutput:
354341 reasoning_time = self .timing_stats ["reasoning_time" ],
355342 reasoning_tokens = self .timing_stats ["reasoning_tokens" ]
356343 )
357- print (f"DEBUG: Created output usage: { output .usage } " )
358344
359345 return output , buffer
360346
0 commit comments