File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -947,12 +947,24 @@ def _get_output_attributes(template, result):
947947 attributes [SPANDATA .GEN_AI_USAGE_INPUT_TOKENS ] = (
948948 result .usage .input_tokens
949949 )
950+ elif hasattr (result .usage , "prompt_tokens" ) and isinstance (
951+ result .usage .prompt_tokens , int
952+ ):
953+ attributes [SPANDATA .GEN_AI_USAGE_INPUT_TOKENS ] = (
954+ result .usage .prompt_tokens
955+ )
950956 elif hasattr (result .usage , "output_tokens" ) and isinstance (
951957 result .usage .output_tokens , int
952958 ):
953959 attributes [SPANDATA .GEN_AI_USAGE_OUTPUT_TOKENS ] = (
954960 result .usage .output_tokens
955961 )
962+ elif hasattr (result .usage , "completion_tokens" ) and isinstance (
963+ result .usage .completion_tokens , int
964+ ):
965+ attributes [SPANDATA .GEN_AI_USAGE_OUTPUT_TOKENS ] = (
966+ result .usage .completion_tokens
967+ )
956968 elif hasattr (result .usage , "total_tokens" ) and isinstance (
957969 result .usage .total_tokens , int
958970 ):
You can’t perform that action at this time.
0 commit comments