GoogleUsage
Namespace: Vercel.AI.Google
public static class GoogleUsageConverts Gemini usageMetadata.
Inheritance: object
Methods
Section titled “Methods”Add(JsonElement?, JsonElement?)
Section titled “Add(JsonElement?, JsonElement?)”public static JsonElement? Add(JsonElement? a, JsonElement? b)Sums the usage metadata of two requests, such as the hops of a long decode response that was continued automatically. Numeric counts add, a missing count is the other side, and other fields come from <code class=“paramref”>b</code>.
Parameters
| Name | Type | Description |
|---|---|---|
a |
JsonElement? | |
b |
JsonElement? |
Returns: JsonElement?
Convert(JsonElement?)
Section titled “Convert(JsonElement?)”public static GoogleTokenUsage? Convert(JsonElement? usage)Adds tool-use prompt tokens to the input total and thought tokens to the output total. Returns null when <code class=“paramref”>usage</code> is missing.
Parameters
| Name | Type | Description |
|---|---|---|
usage |
JsonElement? |
Returns: GoogleTokenUsage
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product