Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions google/genai/_interactions/types/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
__all__ = [
"Usage",
"CachedTokensByModality",
"GroundingToolCount",
"InputTokensByModality",
"OutputTokensByModality",
"ToolUseTokensByModality",
Expand All @@ -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."""

Expand Down Expand Up @@ -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."""

Expand Down
14 changes: 14 additions & 0 deletions google/genai/_interactions/types/usage_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
__all__ = [
"UsageParam",
"CachedTokensByModality",
"GroundingToolCount",
"InputTokensByModality",
"OutputTokensByModality",
"ToolUseTokensByModality",
Expand All @@ -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."""

Expand Down Expand Up @@ -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."""

Expand Down
Loading