google-genai 0.3.0__py3-none-any.whl → 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
google/genai/types.py CHANGED
@@ -13,6 +13,8 @@
13
13
  # limitations under the License.
14
14
  #
15
15
 
16
+ # Code generated by the Google Gen AI SDK generator DO NOT EDIT.
17
+
16
18
  import datetime
17
19
  import inspect
18
20
  import json
@@ -569,7 +571,9 @@ class Content(_common.BaseModel):
569
571
  )
570
572
  role: Optional[str] = Field(
571
573
  default=None,
572
- description="""Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.""",
574
+ description="""Optional. The producer of the content. Must be either 'user' or
575
+ 'model'. Useful to set for multi-turn conversations, otherwise can be
576
+ left blank or unset. If role is not specified, SDK will determine the role.""",
573
577
  )
574
578
 
575
579
 
@@ -581,7 +585,9 @@ class ContentDict(TypedDict, total=False):
581
585
  a different IANA MIME type."""
582
586
 
583
587
  role: Optional[str]
584
- """Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset."""
588
+ """Optional. The producer of the content. Must be either 'user' or
589
+ 'model'. Useful to set for multi-turn conversations, otherwise can be
590
+ left blank or unset. If role is not specified, SDK will determine the role."""
585
591
 
586
592
 
587
593
  ContentOrDict = Union[Content, ContentDict]
@@ -598,7 +604,7 @@ class Schema(_common.BaseModel):
598
604
  Represents a select subset of an OpenAPI 3.0 schema object.
599
605
  """
600
606
 
601
- min_items: Optional[str] = Field(
607
+ min_items: Optional[int] = Field(
602
608
  default=None,
603
609
  description="""Optional. Minimum number of the elements for Type.ARRAY.""",
604
610
  )
@@ -625,22 +631,22 @@ class Schema(_common.BaseModel):
625
631
  default=None,
626
632
  description="""Optional. The value should be validated against any (one or more) of the subschemas in the list.""",
627
633
  )
628
- max_length: Optional[str] = Field(
634
+ max_length: Optional[int] = Field(
629
635
  default=None,
630
636
  description="""Optional. Maximum length of the Type.STRING""",
631
637
  )
632
638
  title: Optional[str] = Field(
633
639
  default=None, description="""Optional. The title of the Schema."""
634
640
  )
635
- min_length: Optional[str] = Field(
641
+ min_length: Optional[int] = Field(
636
642
  default=None,
637
643
  description="""Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING""",
638
644
  )
639
- min_properties: Optional[str] = Field(
645
+ min_properties: Optional[int] = Field(
640
646
  default=None,
641
647
  description="""Optional. Minimum number of the properties for Type.OBJECT.""",
642
648
  )
643
- max_items: Optional[str] = Field(
649
+ max_items: Optional[int] = Field(
644
650
  default=None,
645
651
  description="""Optional. Maximum number of the elements for Type.ARRAY.""",
646
652
  )
@@ -652,7 +658,7 @@ class Schema(_common.BaseModel):
652
658
  default=None,
653
659
  description="""Optional. Indicates if the value may be null.""",
654
660
  )
655
- max_properties: Optional[str] = Field(
661
+ max_properties: Optional[int] = Field(
656
662
  default=None,
657
663
  description="""Optional. Maximum number of the properties for Type.OBJECT.""",
658
664
  )
@@ -690,7 +696,7 @@ class SchemaDict(TypedDict, total=False):
690
696
  Represents a select subset of an OpenAPI 3.0 schema object.
691
697
  """
692
698
 
693
- min_items: Optional[str]
699
+ min_items: Optional[int]
694
700
  """Optional. Minimum number of the elements for Type.ARRAY."""
695
701
 
696
702
  example: Optional[Any]
@@ -711,19 +717,19 @@ class SchemaDict(TypedDict, total=False):
711
717
  any_of: list["SchemaDict"]
712
718
  """Optional. The value should be validated against any (one or more) of the subschemas in the list."""
713
719
 
714
- max_length: Optional[str]
720
+ max_length: Optional[int]
715
721
  """Optional. Maximum length of the Type.STRING"""
716
722
 
717
723
  title: Optional[str]
718
724
  """Optional. The title of the Schema."""
719
725
 
720
- min_length: Optional[str]
726
+ min_length: Optional[int]
721
727
  """Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING"""
722
728
 
723
- min_properties: Optional[str]
729
+ min_properties: Optional[int]
724
730
  """Optional. Minimum number of the properties for Type.OBJECT."""
725
731
 
726
- max_items: Optional[str]
732
+ max_items: Optional[int]
727
733
  """Optional. Maximum number of the elements for Type.ARRAY."""
728
734
 
729
735
  maximum: Optional[float]
@@ -732,7 +738,7 @@ class SchemaDict(TypedDict, total=False):
732
738
  nullable: Optional[bool]
733
739
  """Optional. Indicates if the value may be null."""
734
740
 
735
- max_properties: Optional[str]
741
+ max_properties: Optional[int]
736
742
  """Optional. Maximum number of the properties for Type.OBJECT."""
737
743
 
738
744
  type: Optional[Type]
@@ -820,11 +826,35 @@ class FunctionDeclaration(_common.BaseModel):
820
826
  description="""Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. For function with no parameters, this can be left unset. Parameter names must start with a letter or an underscore and must only contain chars a-z, A-Z, 0-9, or underscores with a maximum length of 64. Example with 1 required and 1 optional parameter: type: OBJECT properties: param1: type: STRING param2: type: INTEGER required: - param1""",
821
827
  )
822
828
 
823
- @staticmethod
824
- def from_function(client, func: Callable) -> "FunctionDeclaration":
825
- """Converts a function to a FunctionDeclaration."""
829
+ @classmethod
830
+ def _get_variant(cls, client) -> str:
831
+ """Returns the function variant based on the provided client object."""
832
+ if client.vertexai:
833
+ return "VERTEX_AI"
834
+ else:
835
+ return "GOOGLE_AI"
836
+
837
+ @classmethod
838
+ def from_function_with_options(
839
+ cls,
840
+ func: Callable,
841
+ variant: Literal["GOOGLE_AI", "VERTEX_AI", "DEFAULT"] = "GOOGLE_AI",
842
+ ) -> "FunctionDeclaration":
843
+ """Converts a function to a FunctionDeclaration based on an API endpoint.
844
+
845
+ Supported endpoints are: 'GOOGLE_AI', 'VERTEX_AI', or 'DEFAULT'.
846
+ """
826
847
  from . import _automatic_function_calling_util
827
848
 
849
+ supported_variants = ["GOOGLE_AI", "VERTEX_AI", "DEFAULT"]
850
+ if variant not in supported_variants:
851
+ raise ValueError(
852
+ f"Unsupported variant: {variant}. Supported variants are:"
853
+ f" {', '.join(supported_variants)}"
854
+ )
855
+
856
+ # TODO: b/382524014 - Add support for DEFAULT API endpoint.
857
+
828
858
  parameters_properties = {}
829
859
  for name, param in inspect.signature(func).parameters.items():
830
860
  if param.kind in (
@@ -833,7 +863,7 @@ class FunctionDeclaration(_common.BaseModel):
833
863
  inspect.Parameter.POSITIONAL_ONLY,
834
864
  ):
835
865
  schema = _automatic_function_calling_util._parse_schema_from_parameter(
836
- client, param, func.__name__
866
+ variant, param, func.__name__
837
867
  )
838
868
  parameters_properties[name] = schema
839
869
  declaration = FunctionDeclaration(
@@ -845,13 +875,13 @@ class FunctionDeclaration(_common.BaseModel):
845
875
  type="OBJECT",
846
876
  properties=parameters_properties,
847
877
  )
848
- if client.vertexai:
878
+ if variant == "VERTEX_AI":
849
879
  declaration.parameters.required = (
850
880
  _automatic_function_calling_util._get_required_fields(
851
881
  declaration.parameters
852
882
  )
853
883
  )
854
- if not client.vertexai:
884
+ if not variant == "VERTEX_AI":
855
885
  return declaration
856
886
 
857
887
  return_annotation = inspect.signature(func).return_annotation
@@ -860,7 +890,7 @@ class FunctionDeclaration(_common.BaseModel):
860
890
 
861
891
  declaration.response = (
862
892
  _automatic_function_calling_util._parse_schema_from_parameter(
863
- client,
893
+ variant,
864
894
  inspect.Parameter(
865
895
  "return_value",
866
896
  inspect.Parameter.POSITIONAL_OR_KEYWORD,
@@ -871,6 +901,14 @@ class FunctionDeclaration(_common.BaseModel):
871
901
  )
872
902
  return declaration
873
903
 
904
+ @classmethod
905
+ def from_function(cls, client, func: Callable) -> "FunctionDeclaration":
906
+ """Converts a function to a FunctionDeclaration."""
907
+ return cls.from_function_with_options(
908
+ variant=cls._get_variant(client),
909
+ func=func,
910
+ )
911
+
874
912
 
875
913
  class FunctionDeclarationDict(TypedDict, total=False):
876
914
  """Defines a function that the model can generate JSON inputs for.
@@ -2417,7 +2455,10 @@ class GenerateContentResponse(_common.BaseModel):
2417
2455
  default=None, description="""Usage metadata about the response(s)."""
2418
2456
  )
2419
2457
  automatic_function_calling_history: Optional[list[Content]] = None
2420
- parsed: Union[pydantic.BaseModel, dict] = None
2458
+ parsed: Union[pydantic.BaseModel, dict] = Field(
2459
+ default=None,
2460
+ description="""Parsed response if response_schema is provided. Not available for streaming.""",
2461
+ )
2421
2462
 
2422
2463
  @property
2423
2464
  def text(self) -> Optional[str]:
@@ -2453,6 +2494,28 @@ class GenerateContentResponse(_common.BaseModel):
2453
2494
  # part.text == '' is different from part.text is None
2454
2495
  return text if any_text_part_text else None
2455
2496
 
2497
+ @property
2498
+ def function_calls(self) -> Optional[list[FunctionCall]]:
2499
+ """Returns the list of function calls in the response."""
2500
+ if (
2501
+ not self.candidates
2502
+ or not self.candidates[0].content
2503
+ or not self.candidates[0].content.parts
2504
+ ):
2505
+ return None
2506
+ if len(self.candidates) > 1:
2507
+ logging.warning(
2508
+ "Warning: there are multiple candidates in the response, returning"
2509
+ " function calls from the first one."
2510
+ )
2511
+ function_calls = [
2512
+ part.function_call
2513
+ for part in self.candidates[0].content.parts
2514
+ if part.function_call is not None
2515
+ ]
2516
+
2517
+ return function_calls if function_calls else None
2518
+
2456
2519
  @classmethod
2457
2520
  def _from_response(
2458
2521
  cls, response: dict[str, object], kwargs: dict[str, object]
@@ -2467,12 +2530,21 @@ class GenerateContentResponse(_common.BaseModel):
2467
2530
  response_schema, pydantic.BaseModel
2468
2531
  ):
2469
2532
  # Pydantic schema.
2470
- result.parsed = response_schema.model_validate_json(result.text)
2533
+ try:
2534
+ result.parsed = response_schema.model_validate_json(result.text)
2535
+ # may not be a valid json per stream response
2536
+ except pydantic.ValidationError:
2537
+ pass
2538
+
2471
2539
  elif isinstance(response_schema, dict) or isinstance(
2472
2540
  response_schema, pydantic.BaseModel
2473
2541
  ):
2474
2542
  # JSON schema.
2475
- result.parsed = json.loads(result.text)
2543
+ try:
2544
+ result.parsed = json.loads(result.text)
2545
+ # may not be a valid json per stream response
2546
+ except json.decoder.JSONDecodeError:
2547
+ pass
2476
2548
 
2477
2549
  return result
2478
2550
 
@@ -3522,10 +3594,6 @@ class _UpscaleImageAPIConfig(_common.BaseModel):
3522
3594
  http_options: Optional[dict[str, Any]] = Field(
3523
3595
  default=None, description="""Used to override HTTP request options."""
3524
3596
  )
3525
- upscale_factor: Optional[str] = Field(
3526
- default=None,
3527
- description="""The factor to which the image will be upscaled.""",
3528
- )
3529
3597
  include_rai_reason: Optional[bool] = Field(
3530
3598
  default=None,
3531
3599
  description="""Whether to include a reason for filtered-out images in the
@@ -3554,9 +3622,6 @@ class _UpscaleImageAPIConfigDict(TypedDict, total=False):
3554
3622
  http_options: Optional[dict[str, Any]]
3555
3623
  """Used to override HTTP request options."""
3556
3624
 
3557
- upscale_factor: Optional[str]
3558
- """The factor to which the image will be upscaled."""
3559
-
3560
3625
  include_rai_reason: Optional[bool]
3561
3626
  """Whether to include a reason for filtered-out images in the
3562
3627
  response."""
@@ -3589,6 +3654,10 @@ class _UpscaleImageAPIParameters(_common.BaseModel):
3589
3654
  image: Optional[Image] = Field(
3590
3655
  default=None, description="""The input image to upscale."""
3591
3656
  )
3657
+ upscale_factor: Optional[str] = Field(
3658
+ default=None,
3659
+ description="""The factor to upscale the image (x2 or x4).""",
3660
+ )
3592
3661
  config: Optional[_UpscaleImageAPIConfig] = Field(
3593
3662
  default=None, description="""Configuration for upscaling."""
3594
3663
  )
@@ -3603,6 +3672,9 @@ class _UpscaleImageAPIParametersDict(TypedDict, total=False):
3603
3672
  image: Optional[ImageDict]
3604
3673
  """The input image to upscale."""
3605
3674
 
3675
+ upscale_factor: Optional[str]
3676
+ """The factor to upscale the image (x2 or x4)."""
3677
+
3606
3678
  config: Optional[_UpscaleImageAPIConfigDict]
3607
3679
  """Configuration for upscaling."""
3608
3680
 
@@ -3791,13 +3863,23 @@ ModelOrDict = Union[Model, ModelDict]
3791
3863
 
3792
3864
  class ListModelsConfig(_common.BaseModel):
3793
3865
 
3866
+ http_options: Optional[dict[str, Any]] = Field(
3867
+ default=None, description="""Used to override HTTP request options."""
3868
+ )
3794
3869
  page_size: Optional[int] = Field(default=None, description="""""")
3795
3870
  page_token: Optional[str] = Field(default=None, description="""""")
3796
3871
  filter: Optional[str] = Field(default=None, description="""""")
3872
+ query_base: Optional[bool] = Field(
3873
+ default=None,
3874
+ description="""Set true to list base models, false to list tuned models.""",
3875
+ )
3797
3876
 
3798
3877
 
3799
3878
  class ListModelsConfigDict(TypedDict, total=False):
3800
3879
 
3880
+ http_options: Optional[dict[str, Any]]
3881
+ """Used to override HTTP request options."""
3882
+
3801
3883
  page_size: Optional[int]
3802
3884
  """"""
3803
3885
 
@@ -3807,6 +3889,9 @@ class ListModelsConfigDict(TypedDict, total=False):
3807
3889
  filter: Optional[str]
3808
3890
  """"""
3809
3891
 
3892
+ query_base: Optional[bool]
3893
+ """Set true to list base models, false to list tuned models."""
3894
+
3810
3895
 
3811
3896
  ListModelsConfigOrDict = Union[ListModelsConfig, ListModelsConfigDict]
3812
3897
 
@@ -4193,7 +4278,7 @@ class TokensInfo(_common.BaseModel):
4193
4278
  default=None,
4194
4279
  description="""Optional. Optional fields for the role from the corresponding Content.""",
4195
4280
  )
4196
- token_ids: Optional[list[str]] = Field(
4281
+ token_ids: Optional[list[int]] = Field(
4197
4282
  default=None, description="""A list of token ids from the input."""
4198
4283
  )
4199
4284
  tokens: Optional[list[bytes]] = Field(
@@ -4207,7 +4292,7 @@ class TokensInfoDict(TypedDict, total=False):
4207
4292
  role: Optional[str]
4208
4293
  """Optional. Optional fields for the role from the corresponding Content."""
4209
4294
 
4210
- token_ids: Optional[list[str]]
4295
+ token_ids: Optional[list[int]]
4211
4296
  """A list of token ids from the input."""
4212
4297
 
4213
4298
  tokens: Optional[list[bytes]]
@@ -4355,7 +4440,7 @@ class SupervisedHyperParameters(_common.BaseModel):
4355
4440
  adapter_size: Optional[AdapterSize] = Field(
4356
4441
  default=None, description="""Optional. Adapter size for tuning."""
4357
4442
  )
4358
- epoch_count: Optional[str] = Field(
4443
+ epoch_count: Optional[int] = Field(
4359
4444
  default=None,
4360
4445
  description="""Optional. Number of complete passes the model makes over the entire training dataset during training.""",
4361
4446
  )
@@ -4371,7 +4456,7 @@ class SupervisedHyperParametersDict(TypedDict, total=False):
4371
4456
  adapter_size: Optional[AdapterSize]
4372
4457
  """Optional. Adapter size for tuning."""
4373
4458
 
4374
- epoch_count: Optional[str]
4459
+ epoch_count: Optional[int]
4375
4460
  """Optional. Number of complete passes the model makes over the entire training dataset during training."""
4376
4461
 
4377
4462
  learning_rate_multiplier: Optional[float]
@@ -4420,7 +4505,7 @@ SupervisedTuningSpecOrDict = Union[
4420
4505
  class DatasetDistributionDistributionBucket(_common.BaseModel):
4421
4506
  """Dataset bucket used to create a histogram for the distribution given a population of values."""
4422
4507
 
4423
- count: Optional[str] = Field(
4508
+ count: Optional[int] = Field(
4424
4509
  default=None,
4425
4510
  description="""Output only. Number of values in the bucket.""",
4426
4511
  )
@@ -4435,7 +4520,7 @@ class DatasetDistributionDistributionBucket(_common.BaseModel):
4435
4520
  class DatasetDistributionDistributionBucketDict(TypedDict, total=False):
4436
4521
  """Dataset bucket used to create a histogram for the distribution given a population of values."""
4437
4522
 
4438
- count: Optional[str]
4523
+ count: Optional[int]
4439
4524
  """Output only. Number of values in the bucket."""
4440
4525
 
4441
4526
  left: Optional[float]
@@ -4521,19 +4606,19 @@ DatasetDistributionOrDict = Union[DatasetDistribution, DatasetDistributionDict]
4521
4606
  class DatasetStats(_common.BaseModel):
4522
4607
  """Statistics computed over a tuning dataset."""
4523
4608
 
4524
- total_billable_character_count: Optional[str] = Field(
4609
+ total_billable_character_count: Optional[int] = Field(
4525
4610
  default=None,
4526
4611
  description="""Output only. Number of billable characters in the tuning dataset.""",
4527
4612
  )
4528
- total_tuning_character_count: Optional[str] = Field(
4613
+ total_tuning_character_count: Optional[int] = Field(
4529
4614
  default=None,
4530
4615
  description="""Output only. Number of tuning characters in the tuning dataset.""",
4531
4616
  )
4532
- tuning_dataset_example_count: Optional[str] = Field(
4617
+ tuning_dataset_example_count: Optional[int] = Field(
4533
4618
  default=None,
4534
4619
  description="""Output only. Number of examples in the tuning dataset.""",
4535
4620
  )
4536
- tuning_step_count: Optional[str] = Field(
4621
+ tuning_step_count: Optional[int] = Field(
4537
4622
  default=None,
4538
4623
  description="""Output only. Number of tuning steps for this Tuning Job.""",
4539
4624
  )
@@ -4558,16 +4643,16 @@ class DatasetStats(_common.BaseModel):
4558
4643
  class DatasetStatsDict(TypedDict, total=False):
4559
4644
  """Statistics computed over a tuning dataset."""
4560
4645
 
4561
- total_billable_character_count: Optional[str]
4646
+ total_billable_character_count: Optional[int]
4562
4647
  """Output only. Number of billable characters in the tuning dataset."""
4563
4648
 
4564
- total_tuning_character_count: Optional[str]
4649
+ total_tuning_character_count: Optional[int]
4565
4650
  """Output only. Number of tuning characters in the tuning dataset."""
4566
4651
 
4567
- tuning_dataset_example_count: Optional[str]
4652
+ tuning_dataset_example_count: Optional[int]
4568
4653
  """Output only. Number of examples in the tuning dataset."""
4569
4654
 
4570
- tuning_step_count: Optional[str]
4655
+ tuning_step_count: Optional[int]
4571
4656
  """Output only. Number of tuning steps for this Tuning Job."""
4572
4657
 
4573
4658
  user_dataset_examples: Optional[list[ContentDict]]
@@ -4646,7 +4731,7 @@ SupervisedTuningDatasetDistributionDatasetBucketOrDict = Union[
4646
4731
  class SupervisedTuningDatasetDistribution(_common.BaseModel):
4647
4732
  """Dataset distribution for Supervised Tuning."""
4648
4733
 
4649
- billable_sum: Optional[str] = Field(
4734
+ billable_sum: Optional[int] = Field(
4650
4735
  default=None,
4651
4736
  description="""Output only. Sum of a given population of values that are billable.""",
4652
4737
  )
@@ -4680,7 +4765,7 @@ class SupervisedTuningDatasetDistribution(_common.BaseModel):
4680
4765
  default=None,
4681
4766
  description="""Output only. The 95th percentile of the values in the population.""",
4682
4767
  )
4683
- sum: Optional[str] = Field(
4768
+ sum: Optional[int] = Field(
4684
4769
  default=None,
4685
4770
  description="""Output only. Sum of a given population of values.""",
4686
4771
  )
@@ -4689,7 +4774,7 @@ class SupervisedTuningDatasetDistribution(_common.BaseModel):
4689
4774
  class SupervisedTuningDatasetDistributionDict(TypedDict, total=False):
4690
4775
  """Dataset distribution for Supervised Tuning."""
4691
4776
 
4692
- billable_sum: Optional[str]
4777
+ billable_sum: Optional[int]
4693
4778
  """Output only. Sum of a given population of values that are billable."""
4694
4779
 
4695
4780
  buckets: Optional[list[SupervisedTuningDatasetDistributionDatasetBucketDict]]
@@ -4713,7 +4798,7 @@ class SupervisedTuningDatasetDistributionDict(TypedDict, total=False):
4713
4798
  p95: Optional[float]
4714
4799
  """Output only. The 95th percentile of the values in the population."""
4715
4800
 
4716
- sum: Optional[str]
4801
+ sum: Optional[int]
4717
4802
  """Output only. Sum of a given population of values."""
4718
4803
 
4719
4804
 
@@ -4725,31 +4810,31 @@ SupervisedTuningDatasetDistributionOrDict = Union[
4725
4810
  class SupervisedTuningDataStats(_common.BaseModel):
4726
4811
  """Tuning data statistics for Supervised Tuning."""
4727
4812
 
4728
- total_billable_character_count: Optional[str] = Field(
4813
+ total_billable_character_count: Optional[int] = Field(
4729
4814
  default=None,
4730
4815
  description="""Output only. Number of billable characters in the tuning dataset.""",
4731
4816
  )
4732
- total_billable_token_count: Optional[str] = Field(
4817
+ total_billable_token_count: Optional[int] = Field(
4733
4818
  default=None,
4734
4819
  description="""Output only. Number of billable tokens in the tuning dataset.""",
4735
4820
  )
4736
- total_truncated_example_count: Optional[str] = Field(
4821
+ total_truncated_example_count: Optional[int] = Field(
4737
4822
  default=None,
4738
4823
  description="""The number of examples in the dataset that have been truncated by any amount.""",
4739
4824
  )
4740
- total_tuning_character_count: Optional[str] = Field(
4825
+ total_tuning_character_count: Optional[int] = Field(
4741
4826
  default=None,
4742
4827
  description="""Output only. Number of tuning characters in the tuning dataset.""",
4743
4828
  )
4744
- truncated_example_indices: Optional[list[str]] = Field(
4829
+ truncated_example_indices: Optional[list[int]] = Field(
4745
4830
  default=None,
4746
4831
  description="""A partial sample of the indices (starting from 1) of the truncated examples.""",
4747
4832
  )
4748
- tuning_dataset_example_count: Optional[str] = Field(
4833
+ tuning_dataset_example_count: Optional[int] = Field(
4749
4834
  default=None,
4750
4835
  description="""Output only. Number of examples in the tuning dataset.""",
4751
4836
  )
4752
- tuning_step_count: Optional[str] = Field(
4837
+ tuning_step_count: Optional[int] = Field(
4753
4838
  default=None,
4754
4839
  description="""Output only. Number of tuning steps for this Tuning Job.""",
4755
4840
  )
@@ -4780,25 +4865,25 @@ class SupervisedTuningDataStats(_common.BaseModel):
4780
4865
  class SupervisedTuningDataStatsDict(TypedDict, total=False):
4781
4866
  """Tuning data statistics for Supervised Tuning."""
4782
4867
 
4783
- total_billable_character_count: Optional[str]
4868
+ total_billable_character_count: Optional[int]
4784
4869
  """Output only. Number of billable characters in the tuning dataset."""
4785
4870
 
4786
- total_billable_token_count: Optional[str]
4871
+ total_billable_token_count: Optional[int]
4787
4872
  """Output only. Number of billable tokens in the tuning dataset."""
4788
4873
 
4789
- total_truncated_example_count: Optional[str]
4874
+ total_truncated_example_count: Optional[int]
4790
4875
  """The number of examples in the dataset that have been truncated by any amount."""
4791
4876
 
4792
- total_tuning_character_count: Optional[str]
4877
+ total_tuning_character_count: Optional[int]
4793
4878
  """Output only. Number of tuning characters in the tuning dataset."""
4794
4879
 
4795
- truncated_example_indices: Optional[list[str]]
4880
+ truncated_example_indices: Optional[list[int]]
4796
4881
  """A partial sample of the indices (starting from 1) of the truncated examples."""
4797
4882
 
4798
- tuning_dataset_example_count: Optional[str]
4883
+ tuning_dataset_example_count: Optional[int]
4799
4884
  """Output only. Number of examples in the tuning dataset."""
4800
4885
 
4801
- tuning_step_count: Optional[str]
4886
+ tuning_step_count: Optional[int]
4802
4887
  """Output only. Number of tuning steps for this Tuning Job."""
4803
4888
 
4804
4889
  user_dataset_examples: Optional[list[ContentDict]]
@@ -4874,7 +4959,7 @@ class DistillationHyperParameters(_common.BaseModel):
4874
4959
  adapter_size: Optional[AdapterSize] = Field(
4875
4960
  default=None, description="""Optional. Adapter size for distillation."""
4876
4961
  )
4877
- epoch_count: Optional[str] = Field(
4962
+ epoch_count: Optional[int] = Field(
4878
4963
  default=None,
4879
4964
  description="""Optional. Number of complete passes the model makes over the entire training dataset during training.""",
4880
4965
  )
@@ -4890,7 +4975,7 @@ class DistillationHyperParametersDict(TypedDict, total=False):
4890
4975
  adapter_size: Optional[AdapterSize]
4891
4976
  """Optional. Adapter size for distillation."""
4892
4977
 
4893
- epoch_count: Optional[str]
4978
+ epoch_count: Optional[int]
4894
4979
  """Optional. Number of complete passes the model makes over the entire training dataset during training."""
4895
4980
 
4896
4981
  learning_rate_multiplier: Optional[float]
@@ -6492,7 +6577,7 @@ class CreateBatchJobConfig(_common.BaseModel):
6492
6577
  )
6493
6578
  dest: Optional[str] = Field(
6494
6579
  default=None,
6495
- description="""GCS or Bigquery URI prefix for the output predictions. Example:
6580
+ description="""GCS or BigQuery URI prefix for the output predictions. Example:
6496
6581
  "gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
6497
6582
  """,
6498
6583
  )
@@ -6509,7 +6594,7 @@ class CreateBatchJobConfigDict(TypedDict, total=False):
6509
6594
  """
6510
6595
 
6511
6596
  dest: Optional[str]
6512
- """GCS or Bigquery URI prefix for the output predictions. Example:
6597
+ """GCS or BigQuery URI prefix for the output predictions. Example:
6513
6598
  "gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
6514
6599
  """
6515
6600
 
@@ -6529,7 +6614,7 @@ class _CreateBatchJobParameters(_common.BaseModel):
6529
6614
  )
6530
6615
  src: Optional[str] = Field(
6531
6616
  default=None,
6532
- description="""GCS URI(-s) or Bigquery URI to your input data to run batch job.
6617
+ description="""GCS URI(-s) or BigQuery URI to your input data to run batch job.
6533
6618
  Example: "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId".
6534
6619
  """,
6535
6620
  )
@@ -6548,7 +6633,7 @@ class _CreateBatchJobParametersDict(TypedDict, total=False):
6548
6633
  """
6549
6634
 
6550
6635
  src: Optional[str]
6551
- """GCS URI(-s) or Bigquery URI to your input data to run batch job.
6636
+ """GCS URI(-s) or BigQuery URI to your input data to run batch job.
6552
6637
  Example: "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId".
6553
6638
  """
6554
6639
 
@@ -7150,10 +7235,6 @@ class UpscaleImageConfig(_common.BaseModel):
7150
7235
  http_options: Optional[dict[str, Any]] = Field(
7151
7236
  default=None, description="""Used to override HTTP request options."""
7152
7237
  )
7153
- upscale_factor: Optional[str] = Field(
7154
- default=None,
7155
- description="""The factor to which the image will be upscaled.""",
7156
- )
7157
7238
  include_rai_reason: Optional[bool] = Field(
7158
7239
  default=None,
7159
7240
  description="""Whether to include a reason for filtered-out images in the
@@ -7181,9 +7262,6 @@ class UpscaleImageConfigDict(TypedDict, total=False):
7181
7262
  http_options: Optional[dict[str, Any]]
7182
7263
  """Used to override HTTP request options."""
7183
7264
 
7184
- upscale_factor: Optional[str]
7185
- """The factor to which the image will be upscaled."""
7186
-
7187
7265
  include_rai_reason: Optional[bool]
7188
7266
  """Whether to include a reason for filtered-out images in the
7189
7267
  response."""
@@ -7208,6 +7286,10 @@ class UpscaleImageParameters(_common.BaseModel):
7208
7286
  image: Optional[Image] = Field(
7209
7287
  default=None, description="""The input image to upscale."""
7210
7288
  )
7289
+ upscale_factor: Optional[str] = Field(
7290
+ default=None,
7291
+ description="""The factor to upscale the image (x2 or x4).""",
7292
+ )
7211
7293
  config: Optional[UpscaleImageConfig] = Field(
7212
7294
  default=None, description="""Configuration for upscaling."""
7213
7295
  )
@@ -7222,6 +7304,9 @@ class UpscaleImageParametersDict(TypedDict, total=False):
7222
7304
  image: Optional[ImageDict]
7223
7305
  """The input image to upscale."""
7224
7306
 
7307
+ upscale_factor: Optional[str]
7308
+ """The factor to upscale the image (x2 or x4)."""
7309
+
7225
7310
  config: Optional[UpscaleImageConfigDict]
7226
7311
  """Configuration for upscaling."""
7227
7312
 
@@ -7655,7 +7740,7 @@ class LiveServerToolCallCancellation(_common.BaseModel):
7655
7740
  server turns.
7656
7741
  """
7657
7742
 
7658
- ids: Optional[list[int]] = Field(
7743
+ ids: Optional[list[str]] = Field(
7659
7744
  default=None, description="""The ids of the tool calls to be cancelled."""
7660
7745
  )
7661
7746
 
@@ -7668,7 +7753,7 @@ class LiveServerToolCallCancellationDict(TypedDict, total=False):
7668
7753
  server turns.
7669
7754
  """
7670
7755
 
7671
- ids: Optional[list[int]]
7756
+ ids: Optional[list[str]]
7672
7757
  """The ids of the tool calls to be cancelled."""
7673
7758
 
7674
7759
 
@@ -7950,13 +8035,13 @@ class LiveClientMessage(_common.BaseModel):
7950
8035
 
7951
8036
  setup: Optional[LiveClientSetup] = Field(
7952
8037
  default=None,
7953
- description="""Message to be sent in the first and only first client message.""",
8038
+ description="""Message to be sent by the system when connecting to the API. SDK users should not send this message.""",
7954
8039
  )
7955
8040
  client_content: Optional[LiveClientContent] = Field(
7956
8041
  default=None,
7957
8042
  description="""Incremental update of the current conversation delivered from the client.""",
7958
8043
  )
7959
- realtime_update: Optional[LiveClientRealtimeInput] = Field(
8044
+ realtime_input: Optional[LiveClientRealtimeInput] = Field(
7960
8045
  default=None, description="""User input that is sent in real time."""
7961
8046
  )
7962
8047
  tool_response: Optional[LiveClientToolResponse] = Field(
@@ -7969,12 +8054,12 @@ class LiveClientMessageDict(TypedDict, total=False):
7969
8054
  """Messages sent by the client in the API call."""
7970
8055
 
7971
8056
  setup: Optional[LiveClientSetupDict]
7972
- """Message to be sent in the first and only first client message."""
8057
+ """Message to be sent by the system when connecting to the API. SDK users should not send this message."""
7973
8058
 
7974
8059
  client_content: Optional[LiveClientContentDict]
7975
8060
  """Incremental update of the current conversation delivered from the client."""
7976
8061
 
7977
- realtime_update: Optional[LiveClientRealtimeInputDict]
8062
+ realtime_input: Optional[LiveClientRealtimeInputDict]
7978
8063
  """User input that is sent in real time."""
7979
8064
 
7980
8065
  tool_response: Optional[LiveClientToolResponseDict]