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 @@ -642,6 +642,13 @@ def new_iterator() -> "Iterator[ChatCompletionChunk]":
642642 set_data_normalized (
643643 span , SPANDATA .GEN_AI_RESPONSE_TEXT , all_responses
644644 )
645+ _calculate_token_usage (
646+ messages ,
647+ response ,
648+ span ,
649+ all_responses ,
650+ integration .count_tokens ,
651+ )
645652
646653 if finish_span :
647654 span .__exit__ (None , None , None )
@@ -679,6 +686,13 @@ async def new_iterator_async() -> "AsyncIterator[ChatCompletionChunk]":
679686 set_data_normalized (
680687 span , SPANDATA .GEN_AI_RESPONSE_TEXT , all_responses
681688 )
689+ _calculate_token_usage (
690+ messages ,
691+ response ,
692+ span ,
693+ all_responses ,
694+ integration .count_tokens ,
695+ )
682696
683697 if finish_span :
684698 span .__exit__ (None , None , None )
You can’t perform that action at this time.
0 commit comments