diff --git a/google/genai/_interactions/types/usage.py b/google/genai/_interactions/types/usage.py index 61cf506a6..c10bf3a9e 100644 --- a/google/genai/_interactions/types/usage.py +++ b/google/genai/_interactions/types/usage.py @@ -23,6 +23,7 @@ __all__ = [ "Usage", "CachedTokensByModality", + "GroundingToolCount", "InputTokensByModality", "OutputTokensByModality", "ToolUseTokensByModality", @@ -39,6 +40,16 @@ class CachedTokensByModality(BaseModel): """Number of tokens for the modality.""" +class GroundingToolCount(BaseModel): + """The number of grounding tool counts.""" + + count: Optional[int] = None + """The number of grounding tool counts.""" + + type: Optional[Literal["google_search", "google_maps", "retrieval"]] = None + """The grounding tool type associated with the count.""" + + class InputTokensByModality(BaseModel): """The token count for a single response modality.""" @@ -75,6 +86,9 @@ class Usage(BaseModel): cached_tokens_by_modality: Optional[List[CachedTokensByModality]] = None """A breakdown of cached token usage by modality.""" + grounding_tool_count: Optional[List[GroundingToolCount]] = None + """Grounding tool count.""" + input_tokens_by_modality: Optional[List[InputTokensByModality]] = None """A breakdown of input token usage by modality.""" diff --git a/google/genai/_interactions/types/usage_param.py b/google/genai/_interactions/types/usage_param.py index b2806aae5..7f20157eb 100644 --- a/google/genai/_interactions/types/usage_param.py +++ b/google/genai/_interactions/types/usage_param.py @@ -23,6 +23,7 @@ __all__ = [ "UsageParam", "CachedTokensByModality", + "GroundingToolCount", "InputTokensByModality", "OutputTokensByModality", "ToolUseTokensByModality", @@ -39,6 +40,16 @@ class CachedTokensByModality(TypedDict, total=False): """Number of tokens for the modality.""" +class GroundingToolCount(TypedDict, total=False): + """The number of grounding tool counts.""" + + count: int + """The number of grounding tool counts.""" + + type: Literal["google_search", "google_maps", "retrieval"] + """The grounding tool type associated with the count.""" + + class InputTokensByModality(TypedDict, total=False): """The token count for a single response modality.""" @@ -75,6 +86,9 @@ class UsageParam(TypedDict, total=False): cached_tokens_by_modality: Iterable[CachedTokensByModality] """A breakdown of cached token usage by modality.""" + grounding_tool_count: Iterable[GroundingToolCount] + """Grounding tool count.""" + input_tokens_by_modality: Iterable[InputTokensByModality] """A breakdown of input token usage by modality."""