google-genai 0.0.1__py3-none-any.whl → 0.2.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
@@ -154,6 +154,14 @@ DynamicRetrievalConfigMode = Literal["MODE_UNSPECIFIED", "MODE_DYNAMIC"]
154
154
  FunctionCallingConfigMode = Literal["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]
155
155
 
156
156
 
157
+ MediaResolution = Literal[
158
+ "MEDIA_RESOLUTION_UNSPECIFIED",
159
+ "MEDIA_RESOLUTION_LOW",
160
+ "MEDIA_RESOLUTION_MEDIUM",
161
+ "MEDIA_RESOLUTION_HIGH",
162
+ ]
163
+
164
+
157
165
  SafetyFilterLevel = Literal[
158
166
  "BLOCK_LOW_AND_ABOVE",
159
167
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -322,8 +330,13 @@ FileDataOrDict = Union[FileData, FileDataDict]
322
330
 
323
331
 
324
332
  class FunctionCall(_common.BaseModel):
325
- """A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing the parameters and their values."""
333
+ """A function call."""
326
334
 
335
+ id: Optional[str] = Field(
336
+ default=None,
337
+ description="""The unique id of the function call. If populated, the client to execute the
338
+ `function_call` and return the response with the matching `id`.""",
339
+ )
327
340
  args: Optional[dict[str, Any]] = Field(
328
341
  default=None,
329
342
  description="""Optional. Required. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details.""",
@@ -335,7 +348,11 @@ class FunctionCall(_common.BaseModel):
335
348
 
336
349
 
337
350
  class FunctionCallDict(TypedDict, total=False):
338
- """A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing the parameters and their values."""
351
+ """A function call."""
352
+
353
+ id: Optional[str]
354
+ """The unique id of the function call. If populated, the client to execute the
355
+ `function_call` and return the response with the matching `id`."""
339
356
 
340
357
  args: Optional[dict[str, Any]]
341
358
  """Optional. Required. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details."""
@@ -348,12 +365,13 @@ FunctionCallOrDict = Union[FunctionCall, FunctionCallDict]
348
365
 
349
366
 
350
367
  class FunctionResponse(_common.BaseModel):
351
- """The result output from a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function is used as context to the model.
352
-
353
- This should contain the result of a [FunctionCall] made based on model
354
- prediction.
355
- """
368
+ """A function response."""
356
369
 
370
+ id: Optional[str] = Field(
371
+ default=None,
372
+ description="""The id of the function call this response is for. Populated by the client
373
+ to match the corresponding function call `id`.""",
374
+ )
357
375
  name: Optional[str] = Field(
358
376
  default=None,
359
377
  description="""Required. The name of the function to call. Matches [FunctionDeclaration.name] and [FunctionCall.name].""",
@@ -365,11 +383,11 @@ class FunctionResponse(_common.BaseModel):
365
383
 
366
384
 
367
385
  class FunctionResponseDict(TypedDict, total=False):
368
- """The result output from a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function is used as context to the model.
386
+ """A function response."""
369
387
 
370
- This should contain the result of a [FunctionCall] made based on model
371
- prediction.
372
- """
388
+ id: Optional[str]
389
+ """The id of the function call this response is for. Populated by the client
390
+ to match the corresponding function call `id`."""
373
391
 
374
392
  name: Optional[str]
375
393
  """Required. The name of the function to call. Matches [FunctionDeclaration.name] and [FunctionCall.name]."""
@@ -795,6 +813,57 @@ class FunctionDeclaration(_common.BaseModel):
795
813
  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""",
796
814
  )
797
815
 
816
+ @staticmethod
817
+ def from_function(client, func: Callable) -> "FunctionDeclaration":
818
+ """Converts a function to a FunctionDeclaration."""
819
+ from . import _automatic_function_calling_util
820
+
821
+ parameters_properties = {}
822
+ for name, param in inspect.signature(func).parameters.items():
823
+ if param.kind in (
824
+ inspect.Parameter.POSITIONAL_OR_KEYWORD,
825
+ inspect.Parameter.KEYWORD_ONLY,
826
+ inspect.Parameter.POSITIONAL_ONLY,
827
+ ):
828
+ schema = _automatic_function_calling_util._parse_schema_from_parameter(
829
+ client, param, func.__name__
830
+ )
831
+ parameters_properties[name] = schema
832
+ declaration = FunctionDeclaration(
833
+ name=func.__name__,
834
+ description=func.__doc__,
835
+ )
836
+ if parameters_properties:
837
+ declaration.parameters = Schema(
838
+ type="OBJECT",
839
+ properties=parameters_properties,
840
+ )
841
+ if client.vertexai:
842
+ declaration.parameters.required = (
843
+ _automatic_function_calling_util._get_required_fields(
844
+ declaration.parameters
845
+ )
846
+ )
847
+ if not client.vertexai:
848
+ return declaration
849
+
850
+ return_annotation = inspect.signature(func).return_annotation
851
+ if return_annotation is inspect._empty:
852
+ return declaration
853
+
854
+ declaration.response = (
855
+ _automatic_function_calling_util._parse_schema_from_parameter(
856
+ client,
857
+ inspect.Parameter(
858
+ "return_value",
859
+ inspect.Parameter.POSITIONAL_OR_KEYWORD,
860
+ annotation=return_annotation,
861
+ ),
862
+ func.__name__,
863
+ )
864
+ )
865
+ return declaration
866
+
798
867
 
799
868
  class FunctionDeclarationDict(TypedDict, total=False):
800
869
  """Defines a function that the model can generate JSON inputs for.
@@ -1218,6 +1287,15 @@ class AutomaticFunctionCallingConfig(_common.BaseModel):
1218
1287
  If not set, SDK will set maximum number of remote calls to 10.
1219
1288
  """,
1220
1289
  )
1290
+ ignore_call_history: Optional[bool] = Field(
1291
+ default=None,
1292
+ description="""If automatic function calling is enabled,
1293
+ whether to ignore call history to the response.
1294
+ If not set, SDK will set ignore_call_history to false,
1295
+ and will append the call history to
1296
+ GenerateContentResponse.automatic_function_calling_history.
1297
+ """,
1298
+ )
1221
1299
 
1222
1300
 
1223
1301
  class AutomaticFunctionCallingConfigDict(TypedDict, total=False):
@@ -1236,6 +1314,14 @@ class AutomaticFunctionCallingConfigDict(TypedDict, total=False):
1236
1314
  If not set, SDK will set maximum number of remote calls to 10.
1237
1315
  """
1238
1316
 
1317
+ ignore_call_history: Optional[bool]
1318
+ """If automatic function calling is enabled,
1319
+ whether to ignore call history to the response.
1320
+ If not set, SDK will set ignore_call_history to false,
1321
+ and will append the call history to
1322
+ GenerateContentResponse.automatic_function_calling_history.
1323
+ """
1324
+
1239
1325
 
1240
1326
  AutomaticFunctionCallingConfigOrDict = Union[
1241
1327
  AutomaticFunctionCallingConfig, AutomaticFunctionCallingConfigDict
@@ -1446,6 +1532,11 @@ class GenerateContentConfig(_common.BaseModel):
1446
1532
  modalities that the model can return.
1447
1533
  """,
1448
1534
  )
1535
+ media_resolution: Optional[MediaResolution] = Field(
1536
+ default=None,
1537
+ description="""If specified, the media resolution specified will be used.
1538
+ """,
1539
+ )
1449
1540
  speech_config: Optional[SpeechConfigUnion] = Field(
1450
1541
  default=None,
1451
1542
  description="""The speech generation configuration.
@@ -1569,6 +1660,10 @@ class GenerateContentConfigDict(TypedDict, total=False):
1569
1660
  modalities that the model can return.
1570
1661
  """
1571
1662
 
1663
+ media_resolution: Optional[MediaResolution]
1664
+ """If specified, the media resolution specified will be used.
1665
+ """
1666
+
1572
1667
  speech_config: Optional[SpeechConfigUnionDict]
1573
1668
  """The speech generation configuration.
1574
1669
  """
@@ -2314,6 +2409,7 @@ class GenerateContentResponse(_common.BaseModel):
2314
2409
  usage_metadata: Optional[GenerateContentResponseUsageMetadata] = Field(
2315
2410
  default=None, description="""Usage metadata about the response(s)."""
2316
2411
  )
2412
+ automatic_function_calling_history: Optional[list[Content]] = None
2317
2413
  parsed: Union[pydantic.BaseModel, dict] = None
2318
2414
 
2319
2415
  @property
@@ -2393,57 +2489,114 @@ GenerateContentResponseOrDict = Union[
2393
2489
 
2394
2490
 
2395
2491
  class EmbedContentConfig(_common.BaseModel):
2492
+ """Class for configuring optional parameters for the embed_content method."""
2396
2493
 
2397
- task_type: Optional[str] = Field(default=None, description="""""")
2398
- title: Optional[str] = Field(default=None, description="""""")
2399
- output_dimensionality: Optional[int] = Field(default=None, description="""""")
2400
- mime_type: Optional[str] = Field(default=None, description="""""")
2401
- auto_truncate: Optional[bool] = Field(default=None, description="""""")
2494
+ http_options: Optional[dict[str, Any]] = Field(
2495
+ default=None, description="""Used to override HTTP request options."""
2496
+ )
2497
+ task_type: Optional[str] = Field(
2498
+ default=None,
2499
+ description="""Type of task for which the embedding will be used.
2500
+ """,
2501
+ )
2502
+ title: Optional[str] = Field(
2503
+ default=None,
2504
+ description="""Title for the text. Only applicable when TaskType is
2505
+ `RETRIEVAL_DOCUMENT`.
2506
+ """,
2507
+ )
2508
+ output_dimensionality: Optional[int] = Field(
2509
+ default=None,
2510
+ description="""Reduced dimension for the output embedding. If set,
2511
+ excessive values in the output embedding are truncated from the end.
2512
+ Supported by newer models since 2024 only. You cannot set this value if
2513
+ using the earlier model (`models/embedding-001`).
2514
+ """,
2515
+ )
2516
+ mime_type: Optional[str] = Field(
2517
+ default=None,
2518
+ description="""Vertex API only. The MIME type of the input.
2519
+ """,
2520
+ )
2521
+ auto_truncate: Optional[bool] = Field(
2522
+ default=None,
2523
+ description="""Vertex API only. Whether to silently truncate inputs longer than
2524
+ the max sequence length. If this option is set to false, oversized inputs
2525
+ will lead to an INVALID_ARGUMENT error, similar to other text APIs.
2526
+ """,
2527
+ )
2402
2528
 
2403
2529
 
2404
2530
  class EmbedContentConfigDict(TypedDict, total=False):
2531
+ """Class for configuring optional parameters for the embed_content method."""
2532
+
2533
+ http_options: Optional[dict[str, Any]]
2534
+ """Used to override HTTP request options."""
2405
2535
 
2406
2536
  task_type: Optional[str]
2407
- """"""
2537
+ """Type of task for which the embedding will be used.
2538
+ """
2408
2539
 
2409
2540
  title: Optional[str]
2410
- """"""
2541
+ """Title for the text. Only applicable when TaskType is
2542
+ `RETRIEVAL_DOCUMENT`.
2543
+ """
2411
2544
 
2412
2545
  output_dimensionality: Optional[int]
2413
- """"""
2546
+ """Reduced dimension for the output embedding. If set,
2547
+ excessive values in the output embedding are truncated from the end.
2548
+ Supported by newer models since 2024 only. You cannot set this value if
2549
+ using the earlier model (`models/embedding-001`).
2550
+ """
2414
2551
 
2415
2552
  mime_type: Optional[str]
2416
- """"""
2553
+ """Vertex API only. The MIME type of the input.
2554
+ """
2417
2555
 
2418
2556
  auto_truncate: Optional[bool]
2419
- """"""
2557
+ """Vertex API only. Whether to silently truncate inputs longer than
2558
+ the max sequence length. If this option is set to false, oversized inputs
2559
+ will lead to an INVALID_ARGUMENT error, similar to other text APIs.
2560
+ """
2420
2561
 
2421
2562
 
2422
2563
  EmbedContentConfigOrDict = Union[EmbedContentConfig, EmbedContentConfigDict]
2423
2564
 
2424
2565
 
2425
2566
  class _EmbedContentParameters(_common.BaseModel):
2567
+ """Parameters for the embed_content method."""
2426
2568
 
2427
2569
  model: Optional[str] = Field(
2428
2570
  default=None,
2429
2571
  description="""ID of the model to use. For a list of models, see `Google models
2430
2572
  <https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_.""",
2431
2573
  )
2432
- contents: Optional[ContentListUnion] = Field(default=None, description="""""")
2433
- config: Optional[EmbedContentConfig] = Field(default=None, description="""""")
2574
+ contents: Optional[ContentListUnion] = Field(
2575
+ default=None,
2576
+ description="""The content to embed. Only the `parts.text` fields will be counted.
2577
+ """,
2578
+ )
2579
+ config: Optional[EmbedContentConfig] = Field(
2580
+ default=None,
2581
+ description="""Configuration that contains optional parameters.
2582
+ """,
2583
+ )
2434
2584
 
2435
2585
 
2436
2586
  class _EmbedContentParametersDict(TypedDict, total=False):
2587
+ """Parameters for the embed_content method."""
2437
2588
 
2438
2589
  model: Optional[str]
2439
2590
  """ID of the model to use. For a list of models, see `Google models
2440
2591
  <https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_."""
2441
2592
 
2442
2593
  contents: Optional[ContentListUnionDict]
2443
- """"""
2594
+ """The content to embed. Only the `parts.text` fields will be counted.
2595
+ """
2444
2596
 
2445
2597
  config: Optional[EmbedContentConfigDict]
2446
- """"""
2598
+ """Configuration that contains optional parameters.
2599
+ """
2447
2600
 
2448
2601
 
2449
2602
  _EmbedContentParametersOrDict = Union[
@@ -2452,18 +2605,32 @@ _EmbedContentParametersOrDict = Union[
2452
2605
 
2453
2606
 
2454
2607
  class ContentEmbeddingStatistics(_common.BaseModel):
2608
+ """Statistics of the input text associated with the result of content embedding."""
2455
2609
 
2456
- truncated: Optional[bool] = Field(default=None, description="""""")
2457
- token_count: Optional[float] = Field(default=None, description="""""")
2610
+ truncated: Optional[bool] = Field(
2611
+ default=None,
2612
+ description="""Vertex API only. If the input text was truncated due to having
2613
+ a length longer than the allowed maximum input.
2614
+ """,
2615
+ )
2616
+ token_count: Optional[float] = Field(
2617
+ default=None,
2618
+ description="""Vertex API only. Number of tokens of the input text.
2619
+ """,
2620
+ )
2458
2621
 
2459
2622
 
2460
2623
  class ContentEmbeddingStatisticsDict(TypedDict, total=False):
2624
+ """Statistics of the input text associated with the result of content embedding."""
2461
2625
 
2462
2626
  truncated: Optional[bool]
2463
- """"""
2627
+ """Vertex API only. If the input text was truncated due to having
2628
+ a length longer than the allowed maximum input.
2629
+ """
2464
2630
 
2465
2631
  token_count: Optional[float]
2466
- """"""
2632
+ """Vertex API only. Number of tokens of the input text.
2633
+ """
2467
2634
 
2468
2635
 
2469
2636
  ContentEmbeddingStatisticsOrDict = Union[
@@ -2472,36 +2639,55 @@ ContentEmbeddingStatisticsOrDict = Union[
2472
2639
 
2473
2640
 
2474
2641
  class ContentEmbedding(_common.BaseModel):
2642
+ """The embedding generated from an input content."""
2475
2643
 
2476
- values: Optional[list[float]] = Field(default=None, description="""""")
2644
+ values: Optional[list[float]] = Field(
2645
+ default=None,
2646
+ description="""A list of floats representing an embedding.
2647
+ """,
2648
+ )
2477
2649
  statistics: Optional[ContentEmbeddingStatistics] = Field(
2478
- default=None, description=""""""
2650
+ default=None,
2651
+ description="""Vertex API only. Statistics of the input text associated with this
2652
+ embedding.
2653
+ """,
2479
2654
  )
2480
2655
 
2481
2656
 
2482
2657
  class ContentEmbeddingDict(TypedDict, total=False):
2658
+ """The embedding generated from an input content."""
2483
2659
 
2484
2660
  values: Optional[list[float]]
2485
- """"""
2661
+ """A list of floats representing an embedding.
2662
+ """
2486
2663
 
2487
2664
  statistics: Optional[ContentEmbeddingStatisticsDict]
2488
- """"""
2665
+ """Vertex API only. Statistics of the input text associated with this
2666
+ embedding.
2667
+ """
2489
2668
 
2490
2669
 
2491
2670
  ContentEmbeddingOrDict = Union[ContentEmbedding, ContentEmbeddingDict]
2492
2671
 
2493
2672
 
2494
2673
  class EmbedContentMetadata(_common.BaseModel):
2674
+ """Request-level metadata for the Vertex Embed Content API."""
2495
2675
 
2496
2676
  billable_character_count: Optional[int] = Field(
2497
- default=None, description=""""""
2677
+ default=None,
2678
+ description="""Vertex API only. The total number of billable characters included
2679
+ in the request.
2680
+ """,
2498
2681
  )
2499
2682
 
2500
2683
 
2501
2684
  class EmbedContentMetadataDict(TypedDict, total=False):
2685
+ """Request-level metadata for the Vertex Embed Content API."""
2502
2686
 
2503
2687
  billable_character_count: Optional[int]
2504
- """"""
2688
+ """Vertex API only. The total number of billable characters included
2689
+ in the request.
2690
+ """
2505
2691
 
2506
2692
 
2507
2693
  EmbedContentMetadataOrDict = Union[
@@ -2510,22 +2696,32 @@ EmbedContentMetadataOrDict = Union[
2510
2696
 
2511
2697
 
2512
2698
  class EmbedContentResponse(_common.BaseModel):
2699
+ """Response for the embed_content method."""
2513
2700
 
2514
2701
  embeddings: Optional[list[ContentEmbedding]] = Field(
2515
- default=None, description=""""""
2702
+ default=None,
2703
+ description="""The embeddings for each request, in the same order as provided in
2704
+ the batch request.
2705
+ """,
2516
2706
  )
2517
2707
  metadata: Optional[EmbedContentMetadata] = Field(
2518
- default=None, description=""""""
2708
+ default=None,
2709
+ description="""Vertex API only. Metadata about the request.
2710
+ """,
2519
2711
  )
2520
2712
 
2521
2713
 
2522
2714
  class EmbedContentResponseDict(TypedDict, total=False):
2715
+ """Response for the embed_content method."""
2523
2716
 
2524
2717
  embeddings: Optional[list[ContentEmbeddingDict]]
2525
- """"""
2718
+ """The embeddings for each request, in the same order as provided in
2719
+ the batch request.
2720
+ """
2526
2721
 
2527
2722
  metadata: Optional[EmbedContentMetadataDict]
2528
- """"""
2723
+ """Vertex API only. Metadata about the request.
2724
+ """
2529
2725
 
2530
2726
 
2531
2727
  EmbedContentResponseOrDict = Union[
@@ -2536,6 +2732,9 @@ EmbedContentResponseOrDict = Union[
2536
2732
  class GenerateImageConfig(_common.BaseModel):
2537
2733
  """Class that represents the config for generating an image."""
2538
2734
 
2735
+ http_options: Optional[dict[str, Any]] = Field(
2736
+ default=None, description="""Used to override HTTP request options."""
2737
+ )
2539
2738
  output_gcs_uri: Optional[str] = Field(
2540
2739
  default=None,
2541
2740
  description="""Cloud Storage URI used to store the generated images.
@@ -2616,6 +2815,9 @@ class GenerateImageConfig(_common.BaseModel):
2616
2815
  class GenerateImageConfigDict(TypedDict, total=False):
2617
2816
  """Class that represents the config for generating an image."""
2618
2817
 
2818
+ http_options: Optional[dict[str, Any]]
2819
+ """Used to override HTTP request options."""
2820
+
2619
2821
  output_gcs_uri: Optional[str]
2620
2822
  """Cloud Storage URI used to store the generated images.
2621
2823
  """
@@ -3102,6 +3304,9 @@ _ReferenceImageAPIOrDict = Union[_ReferenceImageAPI, _ReferenceImageAPIDict]
3102
3304
  class EditImageConfig(_common.BaseModel):
3103
3305
  """Configuration for editing an image."""
3104
3306
 
3307
+ http_options: Optional[dict[str, Any]] = Field(
3308
+ default=None, description="""Used to override HTTP request options."""
3309
+ )
3105
3310
  output_gcs_uri: Optional[str] = Field(
3106
3311
  default=None,
3107
3312
  description="""Cloud Storage URI used to store the generated images.
@@ -3176,6 +3381,9 @@ class EditImageConfig(_common.BaseModel):
3176
3381
  class EditImageConfigDict(TypedDict, total=False):
3177
3382
  """Configuration for editing an image."""
3178
3383
 
3384
+ http_options: Optional[dict[str, Any]]
3385
+ """Used to override HTTP request options."""
3386
+
3179
3387
  output_gcs_uri: Optional[str]
3180
3388
  """Cloud Storage URI used to store the generated images.
3181
3389
  """
@@ -3300,6 +3508,9 @@ class _UpscaleImageAPIConfig(_common.BaseModel):
3300
3508
  to be modifiable or exposed to users in the SDK method.
3301
3509
  """
3302
3510
 
3511
+ http_options: Optional[dict[str, Any]] = Field(
3512
+ default=None, description="""Used to override HTTP request options."""
3513
+ )
3303
3514
  upscale_factor: Optional[str] = Field(
3304
3515
  default=None,
3305
3516
  description="""The factor to which the image will be upscaled.""",
@@ -3329,6 +3540,9 @@ class _UpscaleImageAPIConfigDict(TypedDict, total=False):
3329
3540
  to be modifiable or exposed to users in the SDK method.
3330
3541
  """
3331
3542
 
3543
+ http_options: Optional[dict[str, Any]]
3544
+ """Used to override HTTP request options."""
3545
+
3332
3546
  upscale_factor: Optional[str]
3333
3547
  """The factor to which the image will be upscaled."""
3334
3548
 
@@ -4013,10 +4227,31 @@ ComputeTokensResponseOrDict = Union[
4013
4227
  ]
4014
4228
 
4015
4229
 
4230
+ class GetTuningJobConfig(_common.BaseModel):
4231
+ """Optional parameters for tunings.get method."""
4232
+
4233
+ http_options: Optional[dict[str, Any]] = Field(
4234
+ default=None, description="""Used to override HTTP request options."""
4235
+ )
4236
+
4237
+
4238
+ class GetTuningJobConfigDict(TypedDict, total=False):
4239
+ """Optional parameters for tunings.get method."""
4240
+
4241
+ http_options: Optional[dict[str, Any]]
4242
+ """Used to override HTTP request options."""
4243
+
4244
+
4245
+ GetTuningJobConfigOrDict = Union[GetTuningJobConfig, GetTuningJobConfigDict]
4246
+
4247
+
4016
4248
  class _GetTuningJobParameters(_common.BaseModel):
4017
4249
  """Parameters for the get method."""
4018
4250
 
4019
4251
  name: Optional[str] = Field(default=None, description="""""")
4252
+ config: Optional[GetTuningJobConfig] = Field(
4253
+ default=None, description="""Optional parameters for the request."""
4254
+ )
4020
4255
 
4021
4256
 
4022
4257
  class _GetTuningJobParametersDict(TypedDict, total=False):
@@ -4025,6 +4260,9 @@ class _GetTuningJobParametersDict(TypedDict, total=False):
4025
4260
  name: Optional[str]
4026
4261
  """"""
4027
4262
 
4263
+ config: Optional[GetTuningJobConfigDict]
4264
+ """Optional parameters for the request."""
4265
+
4028
4266
 
4029
4267
  _GetTuningJobParametersOrDict = Union[
4030
4268
  _GetTuningJobParameters, _GetTuningJobParametersDict
@@ -5045,6 +5283,9 @@ TuningValidationDatasetOrDict = Union[
5045
5283
  class CreateTuningJobConfig(_common.BaseModel):
5046
5284
  """Supervised fine-tuning job creation request - optional fields."""
5047
5285
 
5286
+ http_options: Optional[dict[str, Any]] = Field(
5287
+ default=None, description="""Used to override HTTP request options."""
5288
+ )
5048
5289
  validation_dataset: Optional[TuningValidationDataset] = Field(
5049
5290
  default=None,
5050
5291
  description="""Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.""",
@@ -5080,6 +5321,9 @@ class CreateTuningJobConfig(_common.BaseModel):
5080
5321
  class CreateTuningJobConfigDict(TypedDict, total=False):
5081
5322
  """Supervised fine-tuning job creation request - optional fields."""
5082
5323
 
5324
+ http_options: Optional[dict[str, Any]]
5325
+ """Used to override HTTP request options."""
5326
+
5083
5327
  validation_dataset: Optional[TuningValidationDatasetDict]
5084
5328
  """Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file."""
5085
5329
 
@@ -5205,6 +5449,9 @@ DistillationValidationDatasetOrDict = Union[
5205
5449
  class CreateDistillationJobConfig(_common.BaseModel):
5206
5450
  """Distillation job creation request - optional fields."""
5207
5451
 
5452
+ http_options: Optional[dict[str, Any]] = Field(
5453
+ default=None, description="""Used to override HTTP request options."""
5454
+ )
5208
5455
  validation_dataset: Optional[DistillationValidationDataset] = Field(
5209
5456
  default=None,
5210
5457
  description="""Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file.""",
@@ -5233,6 +5480,9 @@ class CreateDistillationJobConfig(_common.BaseModel):
5233
5480
  class CreateDistillationJobConfigDict(TypedDict, total=False):
5234
5481
  """Distillation job creation request - optional fields."""
5235
5482
 
5483
+ http_options: Optional[dict[str, Any]]
5484
+ """Used to override HTTP request options."""
5485
+
5236
5486
  validation_dataset: Optional[DistillationValidationDatasetDict]
5237
5487
  """Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file."""
5238
5488
 
@@ -6139,22 +6389,39 @@ DeleteFileResponseOrDict = Union[DeleteFileResponse, DeleteFileResponseDict]
6139
6389
  class BatchJobSource(_common.BaseModel):
6140
6390
  """Config class for `src` parameter."""
6141
6391
 
6142
- format: Optional[str] = Field(default=None, description="""""")
6143
- gcs_uri: Optional[list[str]] = Field(default=None, description="""""")
6144
- bigquery_uri: Optional[str] = Field(default=None, description="""""")
6392
+ format: Optional[str] = Field(
6393
+ default=None,
6394
+ description="""Storage format of the input files. Must be one of:
6395
+ 'jsonl', 'bigquery'.
6396
+ """,
6397
+ )
6398
+ gcs_uri: Optional[list[str]] = Field(
6399
+ default=None,
6400
+ description="""The Google Cloud Storage URIs to input files.
6401
+ """,
6402
+ )
6403
+ bigquery_uri: Optional[str] = Field(
6404
+ default=None,
6405
+ description="""The BigQuery URI to input table.
6406
+ """,
6407
+ )
6145
6408
 
6146
6409
 
6147
6410
  class BatchJobSourceDict(TypedDict, total=False):
6148
6411
  """Config class for `src` parameter."""
6149
6412
 
6150
6413
  format: Optional[str]
6151
- """"""
6414
+ """Storage format of the input files. Must be one of:
6415
+ 'jsonl', 'bigquery'.
6416
+ """
6152
6417
 
6153
6418
  gcs_uri: Optional[list[str]]
6154
- """"""
6419
+ """The Google Cloud Storage URIs to input files.
6420
+ """
6155
6421
 
6156
6422
  bigquery_uri: Optional[str]
6157
- """"""
6423
+ """The BigQuery URI to input table.
6424
+ """
6158
6425
 
6159
6426
 
6160
6427
  BatchJobSourceOrDict = Union[BatchJobSource, BatchJobSourceDict]
@@ -6163,22 +6430,39 @@ BatchJobSourceOrDict = Union[BatchJobSource, BatchJobSourceDict]
6163
6430
  class BatchJobDestination(_common.BaseModel):
6164
6431
  """Config class for `des` parameter."""
6165
6432
 
6166
- format: Optional[str] = Field(default=None, description="""""")
6167
- gcs_uri: Optional[str] = Field(default=None, description="""""")
6168
- bigquery_uri: Optional[str] = Field(default=None, description="""""")
6433
+ format: Optional[str] = Field(
6434
+ default=None,
6435
+ description="""Storage format of the output files. Must be one of:
6436
+ 'jsonl', 'bigquery'.
6437
+ """,
6438
+ )
6439
+ gcs_uri: Optional[str] = Field(
6440
+ default=None,
6441
+ description="""The Google Cloud Storage URI to the output file.
6442
+ """,
6443
+ )
6444
+ bigquery_uri: Optional[str] = Field(
6445
+ default=None,
6446
+ description="""The BigQuery URI to the output table.
6447
+ """,
6448
+ )
6169
6449
 
6170
6450
 
6171
6451
  class BatchJobDestinationDict(TypedDict, total=False):
6172
6452
  """Config class for `des` parameter."""
6173
6453
 
6174
6454
  format: Optional[str]
6175
- """"""
6455
+ """Storage format of the output files. Must be one of:
6456
+ 'jsonl', 'bigquery'.
6457
+ """
6176
6458
 
6177
6459
  gcs_uri: Optional[str]
6178
- """"""
6460
+ """The Google Cloud Storage URI to the output file.
6461
+ """
6179
6462
 
6180
6463
  bigquery_uri: Optional[str]
6181
- """"""
6464
+ """The BigQuery URI to the output table.
6465
+ """
6182
6466
 
6183
6467
 
6184
6468
  BatchJobDestinationOrDict = Union[BatchJobDestination, BatchJobDestinationDict]
@@ -6190,8 +6474,17 @@ class CreateBatchJobConfig(_common.BaseModel):
6190
6474
  http_options: Optional[dict[str, Any]] = Field(
6191
6475
  default=None, description="""Used to override HTTP request options."""
6192
6476
  )
6193
- display_name: Optional[str] = Field(default=None, description="""""")
6194
- dest: Optional[str] = Field(default=None, description="""""")
6477
+ display_name: Optional[str] = Field(
6478
+ default=None,
6479
+ description="""The user-defined name of this BatchJob.
6480
+ """,
6481
+ )
6482
+ dest: Optional[str] = Field(
6483
+ default=None,
6484
+ description="""GCS or Bigquery URI prefix for the output predictions. Example:
6485
+ "gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
6486
+ """,
6487
+ )
6195
6488
 
6196
6489
 
6197
6490
  class CreateBatchJobConfigDict(TypedDict, total=False):
@@ -6201,10 +6494,13 @@ class CreateBatchJobConfigDict(TypedDict, total=False):
6201
6494
  """Used to override HTTP request options."""
6202
6495
 
6203
6496
  display_name: Optional[str]
6204
- """"""
6497
+ """The user-defined name of this BatchJob.
6498
+ """
6205
6499
 
6206
6500
  dest: Optional[str]
6207
- """"""
6501
+ """GCS or Bigquery URI prefix for the output predictions. Example:
6502
+ "gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
6503
+ """
6208
6504
 
6209
6505
 
6210
6506
  CreateBatchJobConfigOrDict = Union[
@@ -6215,10 +6511,21 @@ CreateBatchJobConfigOrDict = Union[
6215
6511
  class _CreateBatchJobParameters(_common.BaseModel):
6216
6512
  """Config class for batches.create parameters."""
6217
6513
 
6218
- model: Optional[str] = Field(default=None, description="""""")
6219
- src: Optional[str] = Field(default=None, description="""""")
6514
+ model: Optional[str] = Field(
6515
+ default=None,
6516
+ description="""The name of the model to produces the predictions via the BatchJob.
6517
+ """,
6518
+ )
6519
+ src: Optional[str] = Field(
6520
+ default=None,
6521
+ description="""GCS URI(-s) or Bigquery URI to your input data to run batch job.
6522
+ Example: "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId".
6523
+ """,
6524
+ )
6220
6525
  config: Optional[CreateBatchJobConfig] = Field(
6221
- default=None, description=""""""
6526
+ default=None,
6527
+ description="""Optional parameters for creating a BatchJob.
6528
+ """,
6222
6529
  )
6223
6530
 
6224
6531
 
@@ -6226,13 +6533,17 @@ class _CreateBatchJobParametersDict(TypedDict, total=False):
6226
6533
  """Config class for batches.create parameters."""
6227
6534
 
6228
6535
  model: Optional[str]
6229
- """"""
6536
+ """The name of the model to produces the predictions via the BatchJob.
6537
+ """
6230
6538
 
6231
6539
  src: Optional[str]
6232
- """"""
6540
+ """GCS URI(-s) or Bigquery URI to your input data to run batch job.
6541
+ Example: "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId".
6542
+ """
6233
6543
 
6234
6544
  config: Optional[CreateBatchJobConfigDict]
6235
- """"""
6545
+ """Optional parameters for creating a BatchJob.
6546
+ """
6236
6547
 
6237
6548
 
6238
6549
  _CreateBatchJobParametersOrDict = Union[
@@ -6303,9 +6614,21 @@ class BatchJob(_common.BaseModel):
6303
6614
  default=None,
6304
6615
  description="""Output only. Time when the Job was most recently updated.""",
6305
6616
  )
6306
- model: Optional[str] = Field(default=None, description="""""")
6307
- src: Optional[BatchJobSource] = Field(default=None, description="""""")
6308
- dest: Optional[BatchJobDestination] = Field(default=None, description="""""")
6617
+ model: Optional[str] = Field(
6618
+ default=None,
6619
+ description="""The name of the model that produces the predictions via the BatchJob.
6620
+ """,
6621
+ )
6622
+ src: Optional[BatchJobSource] = Field(
6623
+ default=None,
6624
+ description="""Configuration for the input data.
6625
+ """,
6626
+ )
6627
+ dest: Optional[BatchJobDestination] = Field(
6628
+ default=None,
6629
+ description="""Configuration for the output data.
6630
+ """,
6631
+ )
6309
6632
 
6310
6633
 
6311
6634
  class BatchJobDict(TypedDict, total=False):
@@ -6336,29 +6659,65 @@ class BatchJobDict(TypedDict, total=False):
6336
6659
  """Output only. Time when the Job was most recently updated."""
6337
6660
 
6338
6661
  model: Optional[str]
6339
- """"""
6662
+ """The name of the model that produces the predictions via the BatchJob.
6663
+ """
6340
6664
 
6341
6665
  src: Optional[BatchJobSourceDict]
6342
- """"""
6666
+ """Configuration for the input data.
6667
+ """
6343
6668
 
6344
6669
  dest: Optional[BatchJobDestinationDict]
6345
- """"""
6670
+ """Configuration for the output data.
6671
+ """
6346
6672
 
6347
6673
 
6348
6674
  BatchJobOrDict = Union[BatchJob, BatchJobDict]
6349
6675
 
6350
6676
 
6677
+ class GetBatchJobConfig(_common.BaseModel):
6678
+ """Optional parameters."""
6679
+
6680
+ http_options: Optional[dict[str, Any]] = Field(
6681
+ default=None, description="""Used to override HTTP request options."""
6682
+ )
6683
+
6684
+
6685
+ class GetBatchJobConfigDict(TypedDict, total=False):
6686
+ """Optional parameters."""
6687
+
6688
+ http_options: Optional[dict[str, Any]]
6689
+ """Used to override HTTP request options."""
6690
+
6691
+
6692
+ GetBatchJobConfigOrDict = Union[GetBatchJobConfig, GetBatchJobConfigDict]
6693
+
6694
+
6351
6695
  class _GetBatchJobParameters(_common.BaseModel):
6352
6696
  """Config class for batches.get parameters."""
6353
6697
 
6354
- name: Optional[str] = Field(default=None, description="""""")
6698
+ name: Optional[str] = Field(
6699
+ default=None,
6700
+ description="""A fully-qualified BatchJob resource name or ID.
6701
+ Example: "projects/.../locations/.../batchPredictionJobs/456"
6702
+ or "456" when project and location are initialized in the client.
6703
+ """,
6704
+ )
6705
+ config: Optional[GetBatchJobConfig] = Field(
6706
+ default=None, description="""Optional parameters for the request."""
6707
+ )
6355
6708
 
6356
6709
 
6357
6710
  class _GetBatchJobParametersDict(TypedDict, total=False):
6358
6711
  """Config class for batches.get parameters."""
6359
6712
 
6360
6713
  name: Optional[str]
6361
- """"""
6714
+ """A fully-qualified BatchJob resource name or ID.
6715
+ Example: "projects/.../locations/.../batchPredictionJobs/456"
6716
+ or "456" when project and location are initialized in the client.
6717
+ """
6718
+
6719
+ config: Optional[GetBatchJobConfigDict]
6720
+ """Optional parameters for the request."""
6362
6721
 
6363
6722
 
6364
6723
  _GetBatchJobParametersOrDict = Union[
@@ -6366,17 +6725,52 @@ _GetBatchJobParametersOrDict = Union[
6366
6725
  ]
6367
6726
 
6368
6727
 
6728
+ class CancelBatchJobConfig(_common.BaseModel):
6729
+ """Optional parameters."""
6730
+
6731
+ http_options: Optional[dict[str, Any]] = Field(
6732
+ default=None, description="""Used to override HTTP request options."""
6733
+ )
6734
+
6735
+
6736
+ class CancelBatchJobConfigDict(TypedDict, total=False):
6737
+ """Optional parameters."""
6738
+
6739
+ http_options: Optional[dict[str, Any]]
6740
+ """Used to override HTTP request options."""
6741
+
6742
+
6743
+ CancelBatchJobConfigOrDict = Union[
6744
+ CancelBatchJobConfig, CancelBatchJobConfigDict
6745
+ ]
6746
+
6747
+
6369
6748
  class _CancelBatchJobParameters(_common.BaseModel):
6370
6749
  """Config class for batches.cancel parameters."""
6371
6750
 
6372
- name: Optional[str] = Field(default=None, description="""""")
6751
+ name: Optional[str] = Field(
6752
+ default=None,
6753
+ description="""A fully-qualified BatchJob resource name or ID.
6754
+ Example: "projects/.../locations/.../batchPredictionJobs/456"
6755
+ or "456" when project and location are initialized in the client.
6756
+ """,
6757
+ )
6758
+ config: Optional[CancelBatchJobConfig] = Field(
6759
+ default=None, description="""Optional parameters for the request."""
6760
+ )
6373
6761
 
6374
6762
 
6375
6763
  class _CancelBatchJobParametersDict(TypedDict, total=False):
6376
6764
  """Config class for batches.cancel parameters."""
6377
6765
 
6378
6766
  name: Optional[str]
6379
- """"""
6767
+ """A fully-qualified BatchJob resource name or ID.
6768
+ Example: "projects/.../locations/.../batchPredictionJobs/456"
6769
+ or "456" when project and location are initialized in the client.
6770
+ """
6771
+
6772
+ config: Optional[CancelBatchJobConfigDict]
6773
+ """Optional parameters for the request."""
6380
6774
 
6381
6775
 
6382
6776
  _CancelBatchJobParametersOrDict = Union[
@@ -6457,14 +6851,23 @@ ListBatchJobResponseOrDict = Union[
6457
6851
  class _DeleteBatchJobParameters(_common.BaseModel):
6458
6852
  """Config class for batches.delete parameters."""
6459
6853
 
6460
- name: Optional[str] = Field(default=None, description="""""")
6854
+ name: Optional[str] = Field(
6855
+ default=None,
6856
+ description="""A fully-qualified BatchJob resource name or ID.
6857
+ Example: "projects/.../locations/.../batchPredictionJobs/456"
6858
+ or "456" when project and location are initialized in the client.
6859
+ """,
6860
+ )
6461
6861
 
6462
6862
 
6463
6863
  class _DeleteBatchJobParametersDict(TypedDict, total=False):
6464
6864
  """Config class for batches.delete parameters."""
6465
6865
 
6466
6866
  name: Optional[str]
6467
- """"""
6867
+ """A fully-qualified BatchJob resource name or ID.
6868
+ Example: "projects/.../locations/.../batchPredictionJobs/456"
6869
+ or "456" when project and location are initialized in the client.
6870
+ """
6468
6871
 
6469
6872
 
6470
6873
  _DeleteBatchJobParametersOrDict = Union[
@@ -6733,6 +7136,9 @@ class UpscaleImageConfig(_common.BaseModel):
6733
7136
  <https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_.
6734
7137
  """
6735
7138
 
7139
+ http_options: Optional[dict[str, Any]] = Field(
7140
+ default=None, description="""Used to override HTTP request options."""
7141
+ )
6736
7142
  upscale_factor: Optional[str] = Field(
6737
7143
  default=None,
6738
7144
  description="""The factor to which the image will be upscaled.""",
@@ -6761,6 +7167,9 @@ class UpscaleImageConfigDict(TypedDict, total=False):
6761
7167
  <https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_.
6762
7168
  """
6763
7169
 
7170
+ http_options: Optional[dict[str, Any]]
7171
+ """Used to override HTTP request options."""
7172
+
6764
7173
  upscale_factor: Optional[str]
6765
7174
  """The factor to which the image will be upscaled."""
6766
7175
 
@@ -7289,12 +7698,6 @@ class LiveServerMessage(_common.BaseModel):
7289
7698
  return None
7290
7699
  text = ""
7291
7700
  for part in self.server_content.model_turn.parts:
7292
- for field_name, field_value in part.dict(exclude={"text"}).items():
7293
- if field_value is not None:
7294
- raise ValueError(
7295
- "LiveServerMessage.text only supports text parts, but got"
7296
- f" {field_name} part{part}"
7297
- )
7298
7701
  if isinstance(part.text, str):
7299
7702
  text += part.text
7300
7703
  return text if text else None
@@ -7311,12 +7714,6 @@ class LiveServerMessage(_common.BaseModel):
7311
7714
  return None
7312
7715
  concatenated_data = b""
7313
7716
  for part in self.server_content.model_turn.parts:
7314
- for field_name, field_value in part.dict(exclude={"inline_data"}).items():
7315
- if field_value is not None:
7316
- raise ValueError(
7317
- "LiveServerMessage.text only supports inline_data parts, but got"
7318
- f" {field_name} part{part}"
7319
- )
7320
7717
  if part.inline_data and isinstance(part.inline_data.data, bytes):
7321
7718
  concatenated_data += part.inline_data.data
7322
7719
  return concatenated_data if len(concatenated_data) > 0 else None