Commit c14258d
feat(bigquery): expose thinking and tool-use token columns in analytics views
Add usage_thinking_tokens and usage_tool_use_tokens to the LLM_RESPONSE
analytics view, sourced from the usage_metadata proto the plugin already logs
to attributes.usage_metadata (thoughts_token_count and
tool_use_prompt_token_count).
Per the genai GenerateContentResponseUsageMetadata contract, total_token_count =
prompt_token_count + candidates_token_count + tool_use_prompt_token_count +
thoughts_token_count, so thinking and tool-use tokens are separate addends
rather than subsets of prompt/candidates. Surfacing them lets analytics account
for them without double counting. Both fields are optional and resolve to NULL
for models/responses that do not report them, so the change stays
model-agnostic. No plugin logging change is needed since the full usage_metadata
is already persisted to attributes.
Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 9434937961 parent 2aeb1e1 commit c14258d
2 files changed
Lines changed: 30 additions & 0 deletions
File tree
- src/google/adk/plugins
- tests/unittests/plugins
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2060 | 2060 | | |
2061 | 2061 | | |
2062 | 2062 | | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
2063 | 2073 | | |
2064 | 2074 | | |
2065 | 2075 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5978 | 5978 | | |
5979 | 5979 | | |
5980 | 5980 | | |
| 5981 | + | |
| 5982 | + | |
| 5983 | + | |
| 5984 | + | |
| 5985 | + | |
| 5986 | + | |
| 5987 | + | |
| 5988 | + | |
| 5989 | + | |
| 5990 | + | |
| 5991 | + | |
| 5992 | + | |
| 5993 | + | |
| 5994 | + | |
| 5995 | + | |
| 5996 | + | |
| 5997 | + | |
| 5998 | + | |
| 5999 | + | |
| 6000 | + | |
5981 | 6001 | | |
5982 | 6002 | | |
5983 | 6003 | | |
| |||
0 commit comments