@@ -185,6 +185,15 @@ class BlockedReason(_common.CaseInSensitiveEnum):
185
185
PROHIBITED_CONTENT = 'PROHIBITED_CONTENT'
186
186
187
187
188
+ class Modality (_common .CaseInSensitiveEnum ):
189
+ """Server content modalities."""
190
+
191
+ MODALITY_UNSPECIFIED = 'MODALITY_UNSPECIFIED'
192
+ TEXT = 'TEXT'
193
+ IMAGE = 'IMAGE'
194
+ AUDIO = 'AUDIO'
195
+
196
+
188
197
class DeploymentResourcesType (_common .CaseInSensitiveEnum ):
189
198
""""""
190
199
@@ -334,15 +343,6 @@ class FileSource(_common.CaseInSensitiveEnum):
334
343
GENERATED = 'GENERATED'
335
344
336
345
337
- class Modality (_common .CaseInSensitiveEnum ):
338
- """Server content modalities."""
339
-
340
- MODALITY_UNSPECIFIED = 'MODALITY_UNSPECIFIED'
341
- TEXT = 'TEXT'
342
- IMAGE = 'IMAGE'
343
- AUDIO = 'AUDIO'
344
-
345
-
346
346
class VideoMetadata (_common .BaseModel ):
347
347
"""Metadata describes the input video content."""
348
348
@@ -2840,40 +2840,107 @@ class GenerateContentResponsePromptFeedbackDict(TypedDict, total=False):
2840
2840
]
2841
2841
2842
2842
2843
+ class ModalityTokenCount (_common .BaseModel ):
2844
+ """Represents token counting info for a single modality."""
2845
+
2846
+ modality : Optional [Modality ] = Field (
2847
+ default = None ,
2848
+ description = """The modality associated with this token count.""" ,
2849
+ )
2850
+ token_count : Optional [int ] = Field (
2851
+ default = None , description = """Number of tokens."""
2852
+ )
2853
+
2854
+
2855
+ class ModalityTokenCountDict (TypedDict , total = False ):
2856
+ """Represents token counting info for a single modality."""
2857
+
2858
+ modality : Optional [Modality ]
2859
+ """The modality associated with this token count."""
2860
+
2861
+ token_count : Optional [int ]
2862
+ """Number of tokens."""
2863
+
2864
+
2865
+ ModalityTokenCountOrDict = Union [ModalityTokenCount , ModalityTokenCountDict ]
2866
+
2867
+
2843
2868
class GenerateContentResponseUsageMetadata (_common .BaseModel ):
2844
2869
"""Usage metadata about response(s)."""
2845
2870
2871
+ cache_tokens_details : Optional [list [ModalityTokenCount ]] = Field (
2872
+ default = None ,
2873
+ description = """Output only. List of modalities of the cached content in the request input.""" ,
2874
+ )
2846
2875
cached_content_token_count : Optional [int ] = Field (
2847
2876
default = None ,
2848
2877
description = """Output only. Number of tokens in the cached part in the input (the cached content).""" ,
2849
2878
)
2850
2879
candidates_token_count : Optional [int ] = Field (
2851
2880
default = None , description = """Number of tokens in the response(s)."""
2852
2881
)
2882
+ candidates_tokens_details : Optional [list [ModalityTokenCount ]] = Field (
2883
+ default = None ,
2884
+ description = """Output only. List of modalities that were returned in the response.""" ,
2885
+ )
2853
2886
prompt_token_count : Optional [int ] = Field (
2854
2887
default = None ,
2855
2888
description = """Number of tokens in the request. When `cached_content` is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content.""" ,
2856
2889
)
2890
+ prompt_tokens_details : Optional [list [ModalityTokenCount ]] = Field (
2891
+ default = None ,
2892
+ description = """Output only. List of modalities that were processed in the request input.""" ,
2893
+ )
2894
+ thoughts_token_count : Optional [int ] = Field (
2895
+ default = None ,
2896
+ description = """Output only. Number of tokens present in thoughts output.""" ,
2897
+ )
2898
+ tool_use_prompt_token_count : Optional [int ] = Field (
2899
+ default = None ,
2900
+ description = """Output only. Number of tokens present in tool-use prompt(s).""" ,
2901
+ )
2902
+ tool_use_prompt_tokens_details : Optional [list [ModalityTokenCount ]] = Field (
2903
+ default = None ,
2904
+ description = """Output only. List of modalities that were processed for tool-use request inputs.""" ,
2905
+ )
2857
2906
total_token_count : Optional [int ] = Field (
2858
2907
default = None ,
2859
- description = """Total token count for prompt and response candidates.""" ,
2908
+ description = """Total token count for prompt, response candidates, and tool-use prompts (if present) .""" ,
2860
2909
)
2861
2910
2862
2911
2863
2912
class GenerateContentResponseUsageMetadataDict (TypedDict , total = False ):
2864
2913
"""Usage metadata about response(s)."""
2865
2914
2915
+ cache_tokens_details : Optional [list [ModalityTokenCountDict ]]
2916
+ """Output only. List of modalities of the cached content in the request input."""
2917
+
2866
2918
cached_content_token_count : Optional [int ]
2867
2919
"""Output only. Number of tokens in the cached part in the input (the cached content)."""
2868
2920
2869
2921
candidates_token_count : Optional [int ]
2870
2922
"""Number of tokens in the response(s)."""
2871
2923
2924
+ candidates_tokens_details : Optional [list [ModalityTokenCountDict ]]
2925
+ """Output only. List of modalities that were returned in the response."""
2926
+
2872
2927
prompt_token_count : Optional [int ]
2873
2928
"""Number of tokens in the request. When `cached_content` is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content."""
2874
2929
2930
+ prompt_tokens_details : Optional [list [ModalityTokenCountDict ]]
2931
+ """Output only. List of modalities that were processed in the request input."""
2932
+
2933
+ thoughts_token_count : Optional [int ]
2934
+ """Output only. Number of tokens present in thoughts output."""
2935
+
2936
+ tool_use_prompt_token_count : Optional [int ]
2937
+ """Output only. Number of tokens present in tool-use prompt(s)."""
2938
+
2939
+ tool_use_prompt_tokens_details : Optional [list [ModalityTokenCountDict ]]
2940
+ """Output only. List of modalities that were processed for tool-use request inputs."""
2941
+
2875
2942
total_token_count : Optional [int ]
2876
- """Total token count for prompt and response candidates."""
2943
+ """Total token count for prompt, response candidates, and tool-use prompts (if present) ."""
2877
2944
2878
2945
2879
2946
GenerateContentResponseUsageMetadataOrDict = Union [
0 commit comments