feat: add role-specific statistics to telemetry and UI (cont. #15234) (#18824)

Co-authored-by: Yuna Seol <yunaseol@google.com>
This commit is contained in:
Yuna Seol
2026-02-17 12:32:30 -05:00
committed by GitHub
parent 14aabbbe8b
commit 8aca3068cf
51 changed files with 826 additions and 20 deletions
+3
View File
@@ -27,6 +27,7 @@ import {
logWebFetchFallbackAttempt,
WebFetchFallbackAttemptEvent,
} from '../telemetry/index.js';
import { LlmRole } from '../telemetry/llmRole.js';
import { WEB_FETCH_TOOL_NAME } from './tool-names.js';
import { debugLogger } from '../utils/debugLogger.js';
import { retryWithBackoff } from '../utils/retry.js';
@@ -189,6 +190,7 @@ ${textContent}
{ model: 'web-fetch-fallback' },
[{ role: 'user', parts: [{ text: fallbackPrompt }] }],
signal,
LlmRole.UTILITY_TOOL,
);
const resultText = getResponseText(result) || '';
return {
@@ -278,6 +280,7 @@ ${textContent}
{ model: 'web-fetch' },
[{ role: 'user', parts: [{ text: userPrompt }] }],
signal, // Pass signal
LlmRole.UTILITY_TOOL,
);
debugLogger.debug(
+2
View File
@@ -17,6 +17,7 @@ import { getResponseText } from '../utils/partUtils.js';
import { debugLogger } from '../utils/debugLogger.js';
import { WEB_SEARCH_DEFINITION } from './definitions/coreTools.js';
import { resolveToolDeclaration } from './definitions/resolver.js';
import { LlmRole } from '../telemetry/llmRole.js';
interface GroundingChunkWeb {
uri?: string;
@@ -86,6 +87,7 @@ class WebSearchToolInvocation extends BaseToolInvocation<
{ model: 'web-search' },
[{ role: 'user', parts: [{ text: this.params.query }] }],
signal,
LlmRole.UTILITY_TOOL,
);
const responseText = getResponseText(response);