File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -640,6 +640,13 @@ def new_iterator() -> "Iterator[ChatCompletionChunk]":
640640 set_data_normalized (
641641 span , SPANDATA .GEN_AI_RESPONSE_TEXT , all_responses
642642 )
643+ _calculate_token_usage (
644+ messages ,
645+ response ,
646+ span ,
647+ all_responses ,
648+ integration .count_tokens ,
649+ )
643650
644651 if finish_span :
645652 span .__exit__ (None , None , None )
@@ -675,6 +682,13 @@ async def new_iterator_async() -> "AsyncIterator[ChatCompletionChunk]":
675682 set_data_normalized (
676683 span , SPANDATA .GEN_AI_RESPONSE_TEXT , all_responses
677684 )
685+ _calculate_token_usage (
686+ messages ,
687+ response ,
688+ span ,
689+ all_responses ,
690+ integration .count_tokens ,
691+ )
678692
679693 if finish_span :
680694 span .__exit__ (None , None , None )
You can’t perform that action at this time.
0 commit comments