GenAI: added reasoning tokens usage attribute#3222
GenAI: added reasoning tokens usage attribute#3222eavanvalkenburg wants to merge 2 commits intoopen-telemetry:mainfrom
Conversation
| - id: gen_ai.usage.reasoning_tokens | ||
| stability: development | ||
| type: int | ||
| brief: The number of tokens used in the GenAI reasoning or thinking. |
There was a problem hiding this comment.
We should probably explicit if the reasoning tokens are included in gen_ai.usage.output_tokens or not.
There was a problem hiding this comment.
That's a great point, updated to reflect this.
| | [`gen_ai.request.choice.count`](/docs/registry/attributes/gen-ai.md) |  | `Conditionally Required` if available, in the request, and !=1 | int | The target number of candidate completions to return. | `3` | | ||
| | [`gen_ai.request.model`](/docs/registry/attributes/gen-ai.md) |  | `Conditionally Required` If available. | string | The name of the GenAI model a request is being made to. [7] | `gpt-4` | | ||
| | [`gen_ai.request.seed`](/docs/registry/attributes/gen-ai.md) |  | `Conditionally Required` if applicable and if the request includes a seed | int | Requests with same seed value more likely to return same result. | `100` | | ||
| | [`gen_ai.usage.reasoning_tokens`](/docs/registry/attributes/gen-ai.md) |  | `Conditionally Required` when available | int | The number of tokens used in the GenAI reasoning or thinking, only set this if the GenAI model provides a separate count for reasoning tokens and they are not also included in input or output tokens. | `180` | |
There was a problem hiding this comment.
Why would reasoning tokens only be set if not included in output count? I think it'd be better to just state whether they're counted as part of output or not (ideally yes, so that output is consistent regardless of whether reasoning tokens are separated out by a provider), and then an implementation can do the math to ensure the values match the convention based on whether the provider includes reasoning in the output it reports.
There was a problem hiding this comment.
Agreed, they should be a subset of output tokens.
| type: int | ||
| brief: The number of tokens used in the GenAI response (completion). | ||
| examples: [180] | ||
| - id: gen_ai.usage.reasoning_tokens |
There was a problem hiding this comment.
Suggesting this pattern in https://github.com/open-telemetry/semantic-conventions/pull/3163/changes#r2705621129
| - id: gen_ai.usage.reasoning_tokens | |
| - id: gen_ai.usage.reasoning.output_tokens |
|
I recreated the PR there #3383 |
Fixes #3194
Changes
Adds reasoning tokens as a attribute to the
gen_ai.usagefield.Merge requirement checklist
[chore]