google-genai 0.3.0__py3-none-any.whl → 0.4.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
@@ -569,7 +569,9 @@ class Content(_common.BaseModel):
569
569
  )
570
570
  role: Optional[str] = Field(
571
571
  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.""",
572
+ description="""Optional. The producer of the content. Must be either 'user' or
573
+ 'model'. Useful to set for multi-turn conversations, otherwise can be
574
+ left blank or unset. If role is not specified, SDK will determine the role.""",
573
575
  )
574
576
 
575
577
 
@@ -581,7 +583,9 @@ class ContentDict(TypedDict, total=False):
581
583
  a different IANA MIME type."""
582
584
 
583
585
  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."""
586
+ """Optional. The producer of the content. Must be either 'user' or
587
+ 'model'. Useful to set for multi-turn conversations, otherwise can be
588
+ left blank or unset. If role is not specified, SDK will determine the role."""
585
589
 
586
590
 
587
591
  ContentOrDict = Union[Content, ContentDict]
@@ -598,7 +602,7 @@ class Schema(_common.BaseModel):
598
602
  Represents a select subset of an OpenAPI 3.0 schema object.
599
603
  """
600
604
 
601
- min_items: Optional[str] = Field(
605
+ min_items: Optional[int] = Field(
602
606
  default=None,
603
607
  description="""Optional. Minimum number of the elements for Type.ARRAY.""",
604
608
  )
@@ -625,22 +629,22 @@ class Schema(_common.BaseModel):
625
629
  default=None,
626
630
  description="""Optional. The value should be validated against any (one or more) of the subschemas in the list.""",
627
631
  )
628
- max_length: Optional[str] = Field(
632
+ max_length: Optional[int] = Field(
629
633
  default=None,
630
634
  description="""Optional. Maximum length of the Type.STRING""",
631
635
  )
632
636
  title: Optional[str] = Field(
633
637
  default=None, description="""Optional. The title of the Schema."""
634
638
  )
635
- min_length: Optional[str] = Field(
639
+ min_length: Optional[int] = Field(
636
640
  default=None,
637
641
  description="""Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING""",
638
642
  )
639
- min_properties: Optional[str] = Field(
643
+ min_properties: Optional[int] = Field(
640
644
  default=None,
641
645
  description="""Optional. Minimum number of the properties for Type.OBJECT.""",
642
646
  )
643
- max_items: Optional[str] = Field(
647
+ max_items: Optional[int] = Field(
644
648
  default=None,
645
649
  description="""Optional. Maximum number of the elements for Type.ARRAY.""",
646
650
  )
@@ -652,7 +656,7 @@ class Schema(_common.BaseModel):
652
656
  default=None,
653
657
  description="""Optional. Indicates if the value may be null.""",
654
658
  )
655
- max_properties: Optional[str] = Field(
659
+ max_properties: Optional[int] = Field(
656
660
  default=None,
657
661
  description="""Optional. Maximum number of the properties for Type.OBJECT.""",
658
662
  )
@@ -690,7 +694,7 @@ class SchemaDict(TypedDict, total=False):
690
694
  Represents a select subset of an OpenAPI 3.0 schema object.
691
695
  """
692
696
 
693
- min_items: Optional[str]
697
+ min_items: Optional[int]
694
698
  """Optional. Minimum number of the elements for Type.ARRAY."""
695
699
 
696
700
  example: Optional[Any]
@@ -711,19 +715,19 @@ class SchemaDict(TypedDict, total=False):
711
715
  any_of: list["SchemaDict"]
712
716
  """Optional. The value should be validated against any (one or more) of the subschemas in the list."""
713
717
 
714
- max_length: Optional[str]
718
+ max_length: Optional[int]
715
719
  """Optional. Maximum length of the Type.STRING"""
716
720
 
717
721
  title: Optional[str]
718
722
  """Optional. The title of the Schema."""
719
723
 
720
- min_length: Optional[str]
724
+ min_length: Optional[int]
721
725
  """Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING"""
722
726
 
723
- min_properties: Optional[str]
727
+ min_properties: Optional[int]
724
728
  """Optional. Minimum number of the properties for Type.OBJECT."""
725
729
 
726
- max_items: Optional[str]
730
+ max_items: Optional[int]
727
731
  """Optional. Maximum number of the elements for Type.ARRAY."""
728
732
 
729
733
  maximum: Optional[float]
@@ -732,7 +736,7 @@ class SchemaDict(TypedDict, total=False):
732
736
  nullable: Optional[bool]
733
737
  """Optional. Indicates if the value may be null."""
734
738
 
735
- max_properties: Optional[str]
739
+ max_properties: Optional[int]
736
740
  """Optional. Maximum number of the properties for Type.OBJECT."""
737
741
 
738
742
  type: Optional[Type]
@@ -820,11 +824,35 @@ class FunctionDeclaration(_common.BaseModel):
820
824
  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
825
  )
822
826
 
823
- @staticmethod
824
- def from_function(client, func: Callable) -> "FunctionDeclaration":
825
- """Converts a function to a FunctionDeclaration."""
827
+ @classmethod
828
+ def _get_variant(cls, client) -> str:
829
+ """Returns the function variant based on the provided client object."""
830
+ if client.vertexai:
831
+ return "VERTEX_AI"
832
+ else:
833
+ return "GOOGLE_AI"
834
+
835
+ @classmethod
836
+ def from_function_with_options(
837
+ cls,
838
+ func: Callable,
839
+ variant: Literal["GOOGLE_AI", "VERTEX_AI", "DEFAULT"] = "GOOGLE_AI",
840
+ ) -> "FunctionDeclaration":
841
+ """Converts a function to a FunctionDeclaration based on an API endpoint.
842
+
843
+ Supported endpoints are: 'GOOGLE_AI', 'VERTEX_AI', or 'DEFAULT'.
844
+ """
826
845
  from . import _automatic_function_calling_util
827
846
 
847
+ supported_variants = ["GOOGLE_AI", "VERTEX_AI", "DEFAULT"]
848
+ if variant not in supported_variants:
849
+ raise ValueError(
850
+ f"Unsupported variant: {variant}. Supported variants are:"
851
+ f" {', '.join(supported_variants)}"
852
+ )
853
+
854
+ # TODO: b/382524014 - Add support for DEFAULT API endpoint.
855
+
828
856
  parameters_properties = {}
829
857
  for name, param in inspect.signature(func).parameters.items():
830
858
  if param.kind in (
@@ -833,7 +861,7 @@ class FunctionDeclaration(_common.BaseModel):
833
861
  inspect.Parameter.POSITIONAL_ONLY,
834
862
  ):
835
863
  schema = _automatic_function_calling_util._parse_schema_from_parameter(
836
- client, param, func.__name__
864
+ variant, param, func.__name__
837
865
  )
838
866
  parameters_properties[name] = schema
839
867
  declaration = FunctionDeclaration(
@@ -845,13 +873,13 @@ class FunctionDeclaration(_common.BaseModel):
845
873
  type="OBJECT",
846
874
  properties=parameters_properties,
847
875
  )
848
- if client.vertexai:
876
+ if variant == "VERTEX_AI":
849
877
  declaration.parameters.required = (
850
878
  _automatic_function_calling_util._get_required_fields(
851
879
  declaration.parameters
852
880
  )
853
881
  )
854
- if not client.vertexai:
882
+ if not variant == "VERTEX_AI":
855
883
  return declaration
856
884
 
857
885
  return_annotation = inspect.signature(func).return_annotation
@@ -860,7 +888,7 @@ class FunctionDeclaration(_common.BaseModel):
860
888
 
861
889
  declaration.response = (
862
890
  _automatic_function_calling_util._parse_schema_from_parameter(
863
- client,
891
+ variant,
864
892
  inspect.Parameter(
865
893
  "return_value",
866
894
  inspect.Parameter.POSITIONAL_OR_KEYWORD,
@@ -871,6 +899,14 @@ class FunctionDeclaration(_common.BaseModel):
871
899
  )
872
900
  return declaration
873
901
 
902
+ @classmethod
903
+ def from_function(cls, client, func: Callable) -> "FunctionDeclaration":
904
+ """Converts a function to a FunctionDeclaration."""
905
+ return cls.from_function_with_options(
906
+ variant=cls._get_variant(client),
907
+ func=func,
908
+ )
909
+
874
910
 
875
911
  class FunctionDeclarationDict(TypedDict, total=False):
876
912
  """Defines a function that the model can generate JSON inputs for.
@@ -2417,7 +2453,10 @@ class GenerateContentResponse(_common.BaseModel):
2417
2453
  default=None, description="""Usage metadata about the response(s)."""
2418
2454
  )
2419
2455
  automatic_function_calling_history: Optional[list[Content]] = None
2420
- parsed: Union[pydantic.BaseModel, dict] = None
2456
+ parsed: Union[pydantic.BaseModel, dict] = Field(
2457
+ default=None,
2458
+ description="""Parsed response if response_schema is provided. Not available for streaming.""",
2459
+ )
2421
2460
 
2422
2461
  @property
2423
2462
  def text(self) -> Optional[str]:
@@ -2453,6 +2492,28 @@ class GenerateContentResponse(_common.BaseModel):
2453
2492
  # part.text == '' is different from part.text is None
2454
2493
  return text if any_text_part_text else None
2455
2494
 
2495
+ @property
2496
+ def function_calls(self) -> Optional[list[FunctionCall]]:
2497
+ """Returns the list of function calls in the response."""
2498
+ if (
2499
+ not self.candidates
2500
+ or not self.candidates[0].content
2501
+ or not self.candidates[0].content.parts
2502
+ ):
2503
+ return None
2504
+ if len(self.candidates) > 1:
2505
+ logging.warning(
2506
+ "Warning: there are multiple candidates in the response, returning"
2507
+ " function calls from the first one."
2508
+ )
2509
+ function_calls = [
2510
+ part.function_call
2511
+ for part in self.candidates[0].content.parts
2512
+ if part.function_call is not None
2513
+ ]
2514
+
2515
+ return function_calls if function_calls else None
2516
+
2456
2517
  @classmethod
2457
2518
  def _from_response(
2458
2519
  cls, response: dict[str, object], kwargs: dict[str, object]
@@ -2467,12 +2528,21 @@ class GenerateContentResponse(_common.BaseModel):
2467
2528
  response_schema, pydantic.BaseModel
2468
2529
  ):
2469
2530
  # Pydantic schema.
2470
- result.parsed = response_schema.model_validate_json(result.text)
2531
+ try:
2532
+ result.parsed = response_schema.model_validate_json(result.text)
2533
+ # may not be a valid json per stream response
2534
+ except pydantic.ValidationError:
2535
+ pass
2536
+
2471
2537
  elif isinstance(response_schema, dict) or isinstance(
2472
2538
  response_schema, pydantic.BaseModel
2473
2539
  ):
2474
2540
  # JSON schema.
2475
- result.parsed = json.loads(result.text)
2541
+ try:
2542
+ result.parsed = json.loads(result.text)
2543
+ # may not be a valid json per stream response
2544
+ except json.decoder.JSONDecodeError:
2545
+ pass
2476
2546
 
2477
2547
  return result
2478
2548
 
@@ -3522,10 +3592,6 @@ class _UpscaleImageAPIConfig(_common.BaseModel):
3522
3592
  http_options: Optional[dict[str, Any]] = Field(
3523
3593
  default=None, description="""Used to override HTTP request options."""
3524
3594
  )
3525
- upscale_factor: Optional[str] = Field(
3526
- default=None,
3527
- description="""The factor to which the image will be upscaled.""",
3528
- )
3529
3595
  include_rai_reason: Optional[bool] = Field(
3530
3596
  default=None,
3531
3597
  description="""Whether to include a reason for filtered-out images in the
@@ -3554,9 +3620,6 @@ class _UpscaleImageAPIConfigDict(TypedDict, total=False):
3554
3620
  http_options: Optional[dict[str, Any]]
3555
3621
  """Used to override HTTP request options."""
3556
3622
 
3557
- upscale_factor: Optional[str]
3558
- """The factor to which the image will be upscaled."""
3559
-
3560
3623
  include_rai_reason: Optional[bool]
3561
3624
  """Whether to include a reason for filtered-out images in the
3562
3625
  response."""
@@ -3589,6 +3652,10 @@ class _UpscaleImageAPIParameters(_common.BaseModel):
3589
3652
  image: Optional[Image] = Field(
3590
3653
  default=None, description="""The input image to upscale."""
3591
3654
  )
3655
+ upscale_factor: Optional[str] = Field(
3656
+ default=None,
3657
+ description="""The factor to upscale the image (x2 or x4).""",
3658
+ )
3592
3659
  config: Optional[_UpscaleImageAPIConfig] = Field(
3593
3660
  default=None, description="""Configuration for upscaling."""
3594
3661
  )
@@ -3603,6 +3670,9 @@ class _UpscaleImageAPIParametersDict(TypedDict, total=False):
3603
3670
  image: Optional[ImageDict]
3604
3671
  """The input image to upscale."""
3605
3672
 
3673
+ upscale_factor: Optional[str]
3674
+ """The factor to upscale the image (x2 or x4)."""
3675
+
3606
3676
  config: Optional[_UpscaleImageAPIConfigDict]
3607
3677
  """Configuration for upscaling."""
3608
3678
 
@@ -4193,7 +4263,7 @@ class TokensInfo(_common.BaseModel):
4193
4263
  default=None,
4194
4264
  description="""Optional. Optional fields for the role from the corresponding Content.""",
4195
4265
  )
4196
- token_ids: Optional[list[str]] = Field(
4266
+ token_ids: Optional[list[int]] = Field(
4197
4267
  default=None, description="""A list of token ids from the input."""
4198
4268
  )
4199
4269
  tokens: Optional[list[bytes]] = Field(
@@ -4207,7 +4277,7 @@ class TokensInfoDict(TypedDict, total=False):
4207
4277
  role: Optional[str]
4208
4278
  """Optional. Optional fields for the role from the corresponding Content."""
4209
4279
 
4210
- token_ids: Optional[list[str]]
4280
+ token_ids: Optional[list[int]]
4211
4281
  """A list of token ids from the input."""
4212
4282
 
4213
4283
  tokens: Optional[list[bytes]]
@@ -4355,7 +4425,7 @@ class SupervisedHyperParameters(_common.BaseModel):
4355
4425
  adapter_size: Optional[AdapterSize] = Field(
4356
4426
  default=None, description="""Optional. Adapter size for tuning."""
4357
4427
  )
4358
- epoch_count: Optional[str] = Field(
4428
+ epoch_count: Optional[int] = Field(
4359
4429
  default=None,
4360
4430
  description="""Optional. Number of complete passes the model makes over the entire training dataset during training.""",
4361
4431
  )
@@ -4371,7 +4441,7 @@ class SupervisedHyperParametersDict(TypedDict, total=False):
4371
4441
  adapter_size: Optional[AdapterSize]
4372
4442
  """Optional. Adapter size for tuning."""
4373
4443
 
4374
- epoch_count: Optional[str]
4444
+ epoch_count: Optional[int]
4375
4445
  """Optional. Number of complete passes the model makes over the entire training dataset during training."""
4376
4446
 
4377
4447
  learning_rate_multiplier: Optional[float]
@@ -4420,7 +4490,7 @@ SupervisedTuningSpecOrDict = Union[
4420
4490
  class DatasetDistributionDistributionBucket(_common.BaseModel):
4421
4491
  """Dataset bucket used to create a histogram for the distribution given a population of values."""
4422
4492
 
4423
- count: Optional[str] = Field(
4493
+ count: Optional[int] = Field(
4424
4494
  default=None,
4425
4495
  description="""Output only. Number of values in the bucket.""",
4426
4496
  )
@@ -4435,7 +4505,7 @@ class DatasetDistributionDistributionBucket(_common.BaseModel):
4435
4505
  class DatasetDistributionDistributionBucketDict(TypedDict, total=False):
4436
4506
  """Dataset bucket used to create a histogram for the distribution given a population of values."""
4437
4507
 
4438
- count: Optional[str]
4508
+ count: Optional[int]
4439
4509
  """Output only. Number of values in the bucket."""
4440
4510
 
4441
4511
  left: Optional[float]
@@ -4521,19 +4591,19 @@ DatasetDistributionOrDict = Union[DatasetDistribution, DatasetDistributionDict]
4521
4591
  class DatasetStats(_common.BaseModel):
4522
4592
  """Statistics computed over a tuning dataset."""
4523
4593
 
4524
- total_billable_character_count: Optional[str] = Field(
4594
+ total_billable_character_count: Optional[int] = Field(
4525
4595
  default=None,
4526
4596
  description="""Output only. Number of billable characters in the tuning dataset.""",
4527
4597
  )
4528
- total_tuning_character_count: Optional[str] = Field(
4598
+ total_tuning_character_count: Optional[int] = Field(
4529
4599
  default=None,
4530
4600
  description="""Output only. Number of tuning characters in the tuning dataset.""",
4531
4601
  )
4532
- tuning_dataset_example_count: Optional[str] = Field(
4602
+ tuning_dataset_example_count: Optional[int] = Field(
4533
4603
  default=None,
4534
4604
  description="""Output only. Number of examples in the tuning dataset.""",
4535
4605
  )
4536
- tuning_step_count: Optional[str] = Field(
4606
+ tuning_step_count: Optional[int] = Field(
4537
4607
  default=None,
4538
4608
  description="""Output only. Number of tuning steps for this Tuning Job.""",
4539
4609
  )
@@ -4558,16 +4628,16 @@ class DatasetStats(_common.BaseModel):
4558
4628
  class DatasetStatsDict(TypedDict, total=False):
4559
4629
  """Statistics computed over a tuning dataset."""
4560
4630
 
4561
- total_billable_character_count: Optional[str]
4631
+ total_billable_character_count: Optional[int]
4562
4632
  """Output only. Number of billable characters in the tuning dataset."""
4563
4633
 
4564
- total_tuning_character_count: Optional[str]
4634
+ total_tuning_character_count: Optional[int]
4565
4635
  """Output only. Number of tuning characters in the tuning dataset."""
4566
4636
 
4567
- tuning_dataset_example_count: Optional[str]
4637
+ tuning_dataset_example_count: Optional[int]
4568
4638
  """Output only. Number of examples in the tuning dataset."""
4569
4639
 
4570
- tuning_step_count: Optional[str]
4640
+ tuning_step_count: Optional[int]
4571
4641
  """Output only. Number of tuning steps for this Tuning Job."""
4572
4642
 
4573
4643
  user_dataset_examples: Optional[list[ContentDict]]
@@ -4646,7 +4716,7 @@ SupervisedTuningDatasetDistributionDatasetBucketOrDict = Union[
4646
4716
  class SupervisedTuningDatasetDistribution(_common.BaseModel):
4647
4717
  """Dataset distribution for Supervised Tuning."""
4648
4718
 
4649
- billable_sum: Optional[str] = Field(
4719
+ billable_sum: Optional[int] = Field(
4650
4720
  default=None,
4651
4721
  description="""Output only. Sum of a given population of values that are billable.""",
4652
4722
  )
@@ -4680,7 +4750,7 @@ class SupervisedTuningDatasetDistribution(_common.BaseModel):
4680
4750
  default=None,
4681
4751
  description="""Output only. The 95th percentile of the values in the population.""",
4682
4752
  )
4683
- sum: Optional[str] = Field(
4753
+ sum: Optional[int] = Field(
4684
4754
  default=None,
4685
4755
  description="""Output only. Sum of a given population of values.""",
4686
4756
  )
@@ -4689,7 +4759,7 @@ class SupervisedTuningDatasetDistribution(_common.BaseModel):
4689
4759
  class SupervisedTuningDatasetDistributionDict(TypedDict, total=False):
4690
4760
  """Dataset distribution for Supervised Tuning."""
4691
4761
 
4692
- billable_sum: Optional[str]
4762
+ billable_sum: Optional[int]
4693
4763
  """Output only. Sum of a given population of values that are billable."""
4694
4764
 
4695
4765
  buckets: Optional[list[SupervisedTuningDatasetDistributionDatasetBucketDict]]
@@ -4713,7 +4783,7 @@ class SupervisedTuningDatasetDistributionDict(TypedDict, total=False):
4713
4783
  p95: Optional[float]
4714
4784
  """Output only. The 95th percentile of the values in the population."""
4715
4785
 
4716
- sum: Optional[str]
4786
+ sum: Optional[int]
4717
4787
  """Output only. Sum of a given population of values."""
4718
4788
 
4719
4789
 
@@ -4725,31 +4795,31 @@ SupervisedTuningDatasetDistributionOrDict = Union[
4725
4795
  class SupervisedTuningDataStats(_common.BaseModel):
4726
4796
  """Tuning data statistics for Supervised Tuning."""
4727
4797
 
4728
- total_billable_character_count: Optional[str] = Field(
4798
+ total_billable_character_count: Optional[int] = Field(
4729
4799
  default=None,
4730
4800
  description="""Output only. Number of billable characters in the tuning dataset.""",
4731
4801
  )
4732
- total_billable_token_count: Optional[str] = Field(
4802
+ total_billable_token_count: Optional[int] = Field(
4733
4803
  default=None,
4734
4804
  description="""Output only. Number of billable tokens in the tuning dataset.""",
4735
4805
  )
4736
- total_truncated_example_count: Optional[str] = Field(
4806
+ total_truncated_example_count: Optional[int] = Field(
4737
4807
  default=None,
4738
4808
  description="""The number of examples in the dataset that have been truncated by any amount.""",
4739
4809
  )
4740
- total_tuning_character_count: Optional[str] = Field(
4810
+ total_tuning_character_count: Optional[int] = Field(
4741
4811
  default=None,
4742
4812
  description="""Output only. Number of tuning characters in the tuning dataset.""",
4743
4813
  )
4744
- truncated_example_indices: Optional[list[str]] = Field(
4814
+ truncated_example_indices: Optional[list[int]] = Field(
4745
4815
  default=None,
4746
4816
  description="""A partial sample of the indices (starting from 1) of the truncated examples.""",
4747
4817
  )
4748
- tuning_dataset_example_count: Optional[str] = Field(
4818
+ tuning_dataset_example_count: Optional[int] = Field(
4749
4819
  default=None,
4750
4820
  description="""Output only. Number of examples in the tuning dataset.""",
4751
4821
  )
4752
- tuning_step_count: Optional[str] = Field(
4822
+ tuning_step_count: Optional[int] = Field(
4753
4823
  default=None,
4754
4824
  description="""Output only. Number of tuning steps for this Tuning Job.""",
4755
4825
  )
@@ -4780,25 +4850,25 @@ class SupervisedTuningDataStats(_common.BaseModel):
4780
4850
  class SupervisedTuningDataStatsDict(TypedDict, total=False):
4781
4851
  """Tuning data statistics for Supervised Tuning."""
4782
4852
 
4783
- total_billable_character_count: Optional[str]
4853
+ total_billable_character_count: Optional[int]
4784
4854
  """Output only. Number of billable characters in the tuning dataset."""
4785
4855
 
4786
- total_billable_token_count: Optional[str]
4856
+ total_billable_token_count: Optional[int]
4787
4857
  """Output only. Number of billable tokens in the tuning dataset."""
4788
4858
 
4789
- total_truncated_example_count: Optional[str]
4859
+ total_truncated_example_count: Optional[int]
4790
4860
  """The number of examples in the dataset that have been truncated by any amount."""
4791
4861
 
4792
- total_tuning_character_count: Optional[str]
4862
+ total_tuning_character_count: Optional[int]
4793
4863
  """Output only. Number of tuning characters in the tuning dataset."""
4794
4864
 
4795
- truncated_example_indices: Optional[list[str]]
4865
+ truncated_example_indices: Optional[list[int]]
4796
4866
  """A partial sample of the indices (starting from 1) of the truncated examples."""
4797
4867
 
4798
- tuning_dataset_example_count: Optional[str]
4868
+ tuning_dataset_example_count: Optional[int]
4799
4869
  """Output only. Number of examples in the tuning dataset."""
4800
4870
 
4801
- tuning_step_count: Optional[str]
4871
+ tuning_step_count: Optional[int]
4802
4872
  """Output only. Number of tuning steps for this Tuning Job."""
4803
4873
 
4804
4874
  user_dataset_examples: Optional[list[ContentDict]]
@@ -4874,7 +4944,7 @@ class DistillationHyperParameters(_common.BaseModel):
4874
4944
  adapter_size: Optional[AdapterSize] = Field(
4875
4945
  default=None, description="""Optional. Adapter size for distillation."""
4876
4946
  )
4877
- epoch_count: Optional[str] = Field(
4947
+ epoch_count: Optional[int] = Field(
4878
4948
  default=None,
4879
4949
  description="""Optional. Number of complete passes the model makes over the entire training dataset during training.""",
4880
4950
  )
@@ -4890,7 +4960,7 @@ class DistillationHyperParametersDict(TypedDict, total=False):
4890
4960
  adapter_size: Optional[AdapterSize]
4891
4961
  """Optional. Adapter size for distillation."""
4892
4962
 
4893
- epoch_count: Optional[str]
4963
+ epoch_count: Optional[int]
4894
4964
  """Optional. Number of complete passes the model makes over the entire training dataset during training."""
4895
4965
 
4896
4966
  learning_rate_multiplier: Optional[float]
@@ -6492,7 +6562,7 @@ class CreateBatchJobConfig(_common.BaseModel):
6492
6562
  )
6493
6563
  dest: Optional[str] = Field(
6494
6564
  default=None,
6495
- description="""GCS or Bigquery URI prefix for the output predictions. Example:
6565
+ description="""GCS or BigQuery URI prefix for the output predictions. Example:
6496
6566
  "gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
6497
6567
  """,
6498
6568
  )
@@ -6509,7 +6579,7 @@ class CreateBatchJobConfigDict(TypedDict, total=False):
6509
6579
  """
6510
6580
 
6511
6581
  dest: Optional[str]
6512
- """GCS or Bigquery URI prefix for the output predictions. Example:
6582
+ """GCS or BigQuery URI prefix for the output predictions. Example:
6513
6583
  "gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
6514
6584
  """
6515
6585
 
@@ -6529,7 +6599,7 @@ class _CreateBatchJobParameters(_common.BaseModel):
6529
6599
  )
6530
6600
  src: Optional[str] = Field(
6531
6601
  default=None,
6532
- description="""GCS URI(-s) or Bigquery URI to your input data to run batch job.
6602
+ description="""GCS URI(-s) or BigQuery URI to your input data to run batch job.
6533
6603
  Example: "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId".
6534
6604
  """,
6535
6605
  )
@@ -6548,7 +6618,7 @@ class _CreateBatchJobParametersDict(TypedDict, total=False):
6548
6618
  """
6549
6619
 
6550
6620
  src: Optional[str]
6551
- """GCS URI(-s) or Bigquery URI to your input data to run batch job.
6621
+ """GCS URI(-s) or BigQuery URI to your input data to run batch job.
6552
6622
  Example: "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId".
6553
6623
  """
6554
6624
 
@@ -7150,10 +7220,6 @@ class UpscaleImageConfig(_common.BaseModel):
7150
7220
  http_options: Optional[dict[str, Any]] = Field(
7151
7221
  default=None, description="""Used to override HTTP request options."""
7152
7222
  )
7153
- upscale_factor: Optional[str] = Field(
7154
- default=None,
7155
- description="""The factor to which the image will be upscaled.""",
7156
- )
7157
7223
  include_rai_reason: Optional[bool] = Field(
7158
7224
  default=None,
7159
7225
  description="""Whether to include a reason for filtered-out images in the
@@ -7181,9 +7247,6 @@ class UpscaleImageConfigDict(TypedDict, total=False):
7181
7247
  http_options: Optional[dict[str, Any]]
7182
7248
  """Used to override HTTP request options."""
7183
7249
 
7184
- upscale_factor: Optional[str]
7185
- """The factor to which the image will be upscaled."""
7186
-
7187
7250
  include_rai_reason: Optional[bool]
7188
7251
  """Whether to include a reason for filtered-out images in the
7189
7252
  response."""
@@ -7208,6 +7271,10 @@ class UpscaleImageParameters(_common.BaseModel):
7208
7271
  image: Optional[Image] = Field(
7209
7272
  default=None, description="""The input image to upscale."""
7210
7273
  )
7274
+ upscale_factor: Optional[str] = Field(
7275
+ default=None,
7276
+ description="""The factor to upscale the image (x2 or x4).""",
7277
+ )
7211
7278
  config: Optional[UpscaleImageConfig] = Field(
7212
7279
  default=None, description="""Configuration for upscaling."""
7213
7280
  )
@@ -7222,6 +7289,9 @@ class UpscaleImageParametersDict(TypedDict, total=False):
7222
7289
  image: Optional[ImageDict]
7223
7290
  """The input image to upscale."""
7224
7291
 
7292
+ upscale_factor: Optional[str]
7293
+ """The factor to upscale the image (x2 or x4)."""
7294
+
7225
7295
  config: Optional[UpscaleImageConfigDict]
7226
7296
  """Configuration for upscaling."""
7227
7297
 
@@ -7655,7 +7725,7 @@ class LiveServerToolCallCancellation(_common.BaseModel):
7655
7725
  server turns.
7656
7726
  """
7657
7727
 
7658
- ids: Optional[list[int]] = Field(
7728
+ ids: Optional[list[str]] = Field(
7659
7729
  default=None, description="""The ids of the tool calls to be cancelled."""
7660
7730
  )
7661
7731
 
@@ -7668,7 +7738,7 @@ class LiveServerToolCallCancellationDict(TypedDict, total=False):
7668
7738
  server turns.
7669
7739
  """
7670
7740
 
7671
- ids: Optional[list[int]]
7741
+ ids: Optional[list[str]]
7672
7742
  """The ids of the tool calls to be cancelled."""
7673
7743
 
7674
7744
 
@@ -7956,7 +8026,7 @@ class LiveClientMessage(_common.BaseModel):
7956
8026
  default=None,
7957
8027
  description="""Incremental update of the current conversation delivered from the client.""",
7958
8028
  )
7959
- realtime_update: Optional[LiveClientRealtimeInput] = Field(
8029
+ realtime_input: Optional[LiveClientRealtimeInput] = Field(
7960
8030
  default=None, description="""User input that is sent in real time."""
7961
8031
  )
7962
8032
  tool_response: Optional[LiveClientToolResponse] = Field(
@@ -7974,7 +8044,7 @@ class LiveClientMessageDict(TypedDict, total=False):
7974
8044
  client_content: Optional[LiveClientContentDict]
7975
8045
  """Incremental update of the current conversation delivered from the client."""
7976
8046
 
7977
- realtime_update: Optional[LiveClientRealtimeInputDict]
8047
+ realtime_input: Optional[LiveClientRealtimeInputDict]
7978
8048
  """User input that is sent in real time."""
7979
8049
 
7980
8050
  tool_response: Optional[LiveClientToolResponseDict]
@@ -0,0 +1,16 @@
1
+ # Copyright 2024 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+
16
+ __version__ = '0.4.0' # x-release-please-version