Replies: 1 comment
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: The Hello! That's an excellent question. You've correctly observed that the The reason for this is that However, you can achieve your goal of assessing costs by using an ADK Plugin, which is the standard mechanism for handling cross-cutting concerns like metrics collection. [2, 3] A plugin can intercept calls to the model, retrieve the usage metadata, and store it for your custom metric to use later. Here is a conceptual outline of how you could implement this:
While this requires a bit more setup than accessing a simple property, it provides a powerful way to collect detailed metrics. You can explore the concept further in the ADK documentation on Plugins. [3] I am now adding the [1] https://google.github.io/adk-docs/docs/evaluate/custom_metrics.html |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How can I access
metadata_usage, that is, the number of (input, output, and cached) tokens processed when implementing a custom evaluation metric? When using the UI, I can access the following information per invocation:usageMetadata:
cachedContentTokenCount: 0
candidatesTokenCount: 198
promptTokenCount: 15228
totalTokenCount: 15426
However, when trying to implement a custom evaluation metric, that assesses the overall costs, it seems that the invocation does not have a usageMetadata property (or something similar). For example, I tried to access it like so:
Am I missing something? Is it possible to somehow access the information from the actual_invocations? Or is it possible to access the event that has
Beta Was this translation helpful? Give feedback.
All reactions