We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4dade58 + 82843e2 commit ed9596eCopy full SHA for ed9596e
1 file changed
sentry_sdk/integrations/openai.py
@@ -640,6 +640,13 @@ def new_iterator() -> "Iterator[ChatCompletionChunk]":
640
set_data_normalized(
641
span, SPANDATA.GEN_AI_RESPONSE_TEXT, all_responses
642
)
643
+ _calculate_token_usage(
644
+ messages,
645
+ response,
646
+ span,
647
+ all_responses,
648
+ integration.count_tokens,
649
+ )
650
651
if finish_span:
652
span.__exit__(None, None, None)
@@ -675,6 +682,13 @@ async def new_iterator_async() -> "AsyncIterator[ChatCompletionChunk]":
675
682
676
683
677
684
685
686
687
688
689
690
691
678
692
679
693
680
694
0 commit comments