google-genai 0.0.1__py3-none-any.whl → 0.1.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/__init__.py +2 -0
- google/genai/_api_client.py +1 -1
- google/genai/_automatic_function_calling_util.py +0 -44
- google/genai/_extra_utils.py +15 -0
- google/genai/_transformers.py +3 -2
- google/genai/batches.py +148 -0
- google/genai/caches.py +10 -0
- google/genai/chats.py +12 -2
- google/genai/live.py +74 -42
- google/genai/models.py +98 -11
- google/genai/tunings.py +241 -4
- google/genai/types.py +379 -85
- {google_genai-0.0.1.dist-info → google_genai-0.1.0.dist-info}/METADATA +52 -44
- google_genai-0.1.0.dist-info/RECORD +24 -0
- google_genai-0.0.1.dist-info/RECORD +0 -24
- {google_genai-0.0.1.dist-info → google_genai-0.1.0.dist-info}/LICENSE +0 -0
- {google_genai-0.0.1.dist-info → google_genai-0.1.0.dist-info}/WHEEL +0 -0
- {google_genai-0.0.1.dist-info → google_genai-0.1.0.dist-info}/top_level.txt +0 -0
google/genai/types.py
CHANGED
@@ -322,8 +322,13 @@ FileDataOrDict = Union[FileData, FileDataDict]
|
|
322
322
|
|
323
323
|
|
324
324
|
class FunctionCall(_common.BaseModel):
|
325
|
-
"""A
|
325
|
+
"""A function call."""
|
326
326
|
|
327
|
+
id: Optional[str] = Field(
|
328
|
+
default=None,
|
329
|
+
description="""The unique id of the function call. If populated, the client to execute the
|
330
|
+
`function_call` and return the response with the matching `id`.""",
|
331
|
+
)
|
327
332
|
args: Optional[dict[str, Any]] = Field(
|
328
333
|
default=None,
|
329
334
|
description="""Optional. Required. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details.""",
|
@@ -335,7 +340,11 @@ class FunctionCall(_common.BaseModel):
|
|
335
340
|
|
336
341
|
|
337
342
|
class FunctionCallDict(TypedDict, total=False):
|
338
|
-
"""A
|
343
|
+
"""A function call."""
|
344
|
+
|
345
|
+
id: Optional[str]
|
346
|
+
"""The unique id of the function call. If populated, the client to execute the
|
347
|
+
`function_call` and return the response with the matching `id`."""
|
339
348
|
|
340
349
|
args: Optional[dict[str, Any]]
|
341
350
|
"""Optional. Required. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details."""
|
@@ -348,12 +357,13 @@ FunctionCallOrDict = Union[FunctionCall, FunctionCallDict]
|
|
348
357
|
|
349
358
|
|
350
359
|
class FunctionResponse(_common.BaseModel):
|
351
|
-
"""
|
352
|
-
|
353
|
-
This should contain the result of a [FunctionCall] made based on model
|
354
|
-
prediction.
|
355
|
-
"""
|
360
|
+
"""A function response."""
|
356
361
|
|
362
|
+
id: Optional[str] = Field(
|
363
|
+
default=None,
|
364
|
+
description="""The id of the function call this response is for. Populated by the client
|
365
|
+
to match the corresponding function call `id`.""",
|
366
|
+
)
|
357
367
|
name: Optional[str] = Field(
|
358
368
|
default=None,
|
359
369
|
description="""Required. The name of the function to call. Matches [FunctionDeclaration.name] and [FunctionCall.name].""",
|
@@ -365,11 +375,11 @@ class FunctionResponse(_common.BaseModel):
|
|
365
375
|
|
366
376
|
|
367
377
|
class FunctionResponseDict(TypedDict, total=False):
|
368
|
-
"""
|
378
|
+
"""A function response."""
|
369
379
|
|
370
|
-
|
371
|
-
|
372
|
-
|
380
|
+
id: Optional[str]
|
381
|
+
"""The id of the function call this response is for. Populated by the client
|
382
|
+
to match the corresponding function call `id`."""
|
373
383
|
|
374
384
|
name: Optional[str]
|
375
385
|
"""Required. The name of the function to call. Matches [FunctionDeclaration.name] and [FunctionCall.name]."""
|
@@ -795,6 +805,57 @@ class FunctionDeclaration(_common.BaseModel):
|
|
795
805
|
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
806
|
)
|
797
807
|
|
808
|
+
@staticmethod
|
809
|
+
def from_function(client, func: Callable) -> "FunctionDeclaration":
|
810
|
+
"""Converts a function to a FunctionDeclaration."""
|
811
|
+
from . import _automatic_function_calling_util
|
812
|
+
|
813
|
+
parameters_properties = {}
|
814
|
+
for name, param in inspect.signature(func).parameters.items():
|
815
|
+
if param.kind in (
|
816
|
+
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
817
|
+
inspect.Parameter.KEYWORD_ONLY,
|
818
|
+
inspect.Parameter.POSITIONAL_ONLY,
|
819
|
+
):
|
820
|
+
schema = _automatic_function_calling_util._parse_schema_from_parameter(
|
821
|
+
client, param, func.__name__
|
822
|
+
)
|
823
|
+
parameters_properties[name] = schema
|
824
|
+
declaration = FunctionDeclaration(
|
825
|
+
name=func.__name__,
|
826
|
+
description=func.__doc__,
|
827
|
+
)
|
828
|
+
if parameters_properties:
|
829
|
+
declaration.parameters = Schema(
|
830
|
+
type="OBJECT",
|
831
|
+
properties=parameters_properties,
|
832
|
+
)
|
833
|
+
if client.vertexai:
|
834
|
+
declaration.parameters.required = (
|
835
|
+
_automatic_function_calling_util._get_required_fields(
|
836
|
+
declaration.parameters
|
837
|
+
)
|
838
|
+
)
|
839
|
+
if not client.vertexai:
|
840
|
+
return declaration
|
841
|
+
|
842
|
+
return_annotation = inspect.signature(func).return_annotation
|
843
|
+
if return_annotation is inspect._empty:
|
844
|
+
return declaration
|
845
|
+
|
846
|
+
declaration.response = (
|
847
|
+
_automatic_function_calling_util._parse_schema_from_parameter(
|
848
|
+
client,
|
849
|
+
inspect.Parameter(
|
850
|
+
"return_value",
|
851
|
+
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
852
|
+
annotation=return_annotation,
|
853
|
+
),
|
854
|
+
func.__name__,
|
855
|
+
)
|
856
|
+
)
|
857
|
+
return declaration
|
858
|
+
|
798
859
|
|
799
860
|
class FunctionDeclarationDict(TypedDict, total=False):
|
800
861
|
"""Defines a function that the model can generate JSON inputs for.
|
@@ -1218,6 +1279,15 @@ class AutomaticFunctionCallingConfig(_common.BaseModel):
|
|
1218
1279
|
If not set, SDK will set maximum number of remote calls to 10.
|
1219
1280
|
""",
|
1220
1281
|
)
|
1282
|
+
ignore_call_history: Optional[bool] = Field(
|
1283
|
+
default=None,
|
1284
|
+
description="""If automatic function calling is enabled,
|
1285
|
+
whether to ignore call history to the response.
|
1286
|
+
If not set, SDK will set ignore_call_history to false,
|
1287
|
+
and will append the call history to
|
1288
|
+
GenerateContentResponse.automatic_function_calling_history.
|
1289
|
+
""",
|
1290
|
+
)
|
1221
1291
|
|
1222
1292
|
|
1223
1293
|
class AutomaticFunctionCallingConfigDict(TypedDict, total=False):
|
@@ -1236,6 +1306,14 @@ class AutomaticFunctionCallingConfigDict(TypedDict, total=False):
|
|
1236
1306
|
If not set, SDK will set maximum number of remote calls to 10.
|
1237
1307
|
"""
|
1238
1308
|
|
1309
|
+
ignore_call_history: Optional[bool]
|
1310
|
+
"""If automatic function calling is enabled,
|
1311
|
+
whether to ignore call history to the response.
|
1312
|
+
If not set, SDK will set ignore_call_history to false,
|
1313
|
+
and will append the call history to
|
1314
|
+
GenerateContentResponse.automatic_function_calling_history.
|
1315
|
+
"""
|
1316
|
+
|
1239
1317
|
|
1240
1318
|
AutomaticFunctionCallingConfigOrDict = Union[
|
1241
1319
|
AutomaticFunctionCallingConfig, AutomaticFunctionCallingConfigDict
|
@@ -2314,6 +2392,7 @@ class GenerateContentResponse(_common.BaseModel):
|
|
2314
2392
|
usage_metadata: Optional[GenerateContentResponseUsageMetadata] = Field(
|
2315
2393
|
default=None, description="""Usage metadata about the response(s)."""
|
2316
2394
|
)
|
2395
|
+
automatic_function_calling_history: Optional[list[Content]] = None
|
2317
2396
|
parsed: Union[pydantic.BaseModel, dict] = None
|
2318
2397
|
|
2319
2398
|
@property
|
@@ -2393,57 +2472,114 @@ GenerateContentResponseOrDict = Union[
|
|
2393
2472
|
|
2394
2473
|
|
2395
2474
|
class EmbedContentConfig(_common.BaseModel):
|
2475
|
+
"""Class for configuring optional parameters for the embed_content method."""
|
2396
2476
|
|
2397
|
-
|
2398
|
-
|
2399
|
-
|
2400
|
-
|
2401
|
-
|
2477
|
+
http_options: Optional[dict[str, Any]] = Field(
|
2478
|
+
default=None, description="""Used to override HTTP request options."""
|
2479
|
+
)
|
2480
|
+
task_type: Optional[str] = Field(
|
2481
|
+
default=None,
|
2482
|
+
description="""Type of task for which the embedding will be used.
|
2483
|
+
""",
|
2484
|
+
)
|
2485
|
+
title: Optional[str] = Field(
|
2486
|
+
default=None,
|
2487
|
+
description="""Title for the text. Only applicable when TaskType is
|
2488
|
+
`RETRIEVAL_DOCUMENT`.
|
2489
|
+
""",
|
2490
|
+
)
|
2491
|
+
output_dimensionality: Optional[int] = Field(
|
2492
|
+
default=None,
|
2493
|
+
description="""Reduced dimension for the output embedding. If set,
|
2494
|
+
excessive values in the output embedding are truncated from the end.
|
2495
|
+
Supported by newer models since 2024 only. You cannot set this value if
|
2496
|
+
using the earlier model (`models/embedding-001`).
|
2497
|
+
""",
|
2498
|
+
)
|
2499
|
+
mime_type: Optional[str] = Field(
|
2500
|
+
default=None,
|
2501
|
+
description="""Vertex API only. The MIME type of the input.
|
2502
|
+
""",
|
2503
|
+
)
|
2504
|
+
auto_truncate: Optional[bool] = Field(
|
2505
|
+
default=None,
|
2506
|
+
description="""Vertex API only. Whether to silently truncate inputs longer than
|
2507
|
+
the max sequence length. If this option is set to false, oversized inputs
|
2508
|
+
will lead to an INVALID_ARGUMENT error, similar to other text APIs.
|
2509
|
+
""",
|
2510
|
+
)
|
2402
2511
|
|
2403
2512
|
|
2404
2513
|
class EmbedContentConfigDict(TypedDict, total=False):
|
2514
|
+
"""Class for configuring optional parameters for the embed_content method."""
|
2515
|
+
|
2516
|
+
http_options: Optional[dict[str, Any]]
|
2517
|
+
"""Used to override HTTP request options."""
|
2405
2518
|
|
2406
2519
|
task_type: Optional[str]
|
2407
|
-
"""
|
2520
|
+
"""Type of task for which the embedding will be used.
|
2521
|
+
"""
|
2408
2522
|
|
2409
2523
|
title: Optional[str]
|
2410
|
-
"""
|
2524
|
+
"""Title for the text. Only applicable when TaskType is
|
2525
|
+
`RETRIEVAL_DOCUMENT`.
|
2526
|
+
"""
|
2411
2527
|
|
2412
2528
|
output_dimensionality: Optional[int]
|
2413
|
-
"""
|
2529
|
+
"""Reduced dimension for the output embedding. If set,
|
2530
|
+
excessive values in the output embedding are truncated from the end.
|
2531
|
+
Supported by newer models since 2024 only. You cannot set this value if
|
2532
|
+
using the earlier model (`models/embedding-001`).
|
2533
|
+
"""
|
2414
2534
|
|
2415
2535
|
mime_type: Optional[str]
|
2416
|
-
"""
|
2536
|
+
"""Vertex API only. The MIME type of the input.
|
2537
|
+
"""
|
2417
2538
|
|
2418
2539
|
auto_truncate: Optional[bool]
|
2419
|
-
"""
|
2540
|
+
"""Vertex API only. Whether to silently truncate inputs longer than
|
2541
|
+
the max sequence length. If this option is set to false, oversized inputs
|
2542
|
+
will lead to an INVALID_ARGUMENT error, similar to other text APIs.
|
2543
|
+
"""
|
2420
2544
|
|
2421
2545
|
|
2422
2546
|
EmbedContentConfigOrDict = Union[EmbedContentConfig, EmbedContentConfigDict]
|
2423
2547
|
|
2424
2548
|
|
2425
2549
|
class _EmbedContentParameters(_common.BaseModel):
|
2550
|
+
"""Parameters for the embed_content method."""
|
2426
2551
|
|
2427
2552
|
model: Optional[str] = Field(
|
2428
2553
|
default=None,
|
2429
2554
|
description="""ID of the model to use. For a list of models, see `Google models
|
2430
2555
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_.""",
|
2431
2556
|
)
|
2432
|
-
contents: Optional[ContentListUnion] = Field(
|
2433
|
-
|
2557
|
+
contents: Optional[ContentListUnion] = Field(
|
2558
|
+
default=None,
|
2559
|
+
description="""The content to embed. Only the `parts.text` fields will be counted.
|
2560
|
+
""",
|
2561
|
+
)
|
2562
|
+
config: Optional[EmbedContentConfig] = Field(
|
2563
|
+
default=None,
|
2564
|
+
description="""Configuration that contains optional parameters.
|
2565
|
+
""",
|
2566
|
+
)
|
2434
2567
|
|
2435
2568
|
|
2436
2569
|
class _EmbedContentParametersDict(TypedDict, total=False):
|
2570
|
+
"""Parameters for the embed_content method."""
|
2437
2571
|
|
2438
2572
|
model: Optional[str]
|
2439
2573
|
"""ID of the model to use. For a list of models, see `Google models
|
2440
2574
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_."""
|
2441
2575
|
|
2442
2576
|
contents: Optional[ContentListUnionDict]
|
2443
|
-
"""
|
2577
|
+
"""The content to embed. Only the `parts.text` fields will be counted.
|
2578
|
+
"""
|
2444
2579
|
|
2445
2580
|
config: Optional[EmbedContentConfigDict]
|
2446
|
-
"""
|
2581
|
+
"""Configuration that contains optional parameters.
|
2582
|
+
"""
|
2447
2583
|
|
2448
2584
|
|
2449
2585
|
_EmbedContentParametersOrDict = Union[
|
@@ -2452,18 +2588,32 @@ _EmbedContentParametersOrDict = Union[
|
|
2452
2588
|
|
2453
2589
|
|
2454
2590
|
class ContentEmbeddingStatistics(_common.BaseModel):
|
2591
|
+
"""Statistics of the input text associated with the result of content embedding."""
|
2455
2592
|
|
2456
|
-
truncated: Optional[bool] = Field(
|
2457
|
-
|
2593
|
+
truncated: Optional[bool] = Field(
|
2594
|
+
default=None,
|
2595
|
+
description="""Vertex API only. If the input text was truncated due to having
|
2596
|
+
a length longer than the allowed maximum input.
|
2597
|
+
""",
|
2598
|
+
)
|
2599
|
+
token_count: Optional[float] = Field(
|
2600
|
+
default=None,
|
2601
|
+
description="""Vertex API only. Number of tokens of the input text.
|
2602
|
+
""",
|
2603
|
+
)
|
2458
2604
|
|
2459
2605
|
|
2460
2606
|
class ContentEmbeddingStatisticsDict(TypedDict, total=False):
|
2607
|
+
"""Statistics of the input text associated with the result of content embedding."""
|
2461
2608
|
|
2462
2609
|
truncated: Optional[bool]
|
2463
|
-
"""
|
2610
|
+
"""Vertex API only. If the input text was truncated due to having
|
2611
|
+
a length longer than the allowed maximum input.
|
2612
|
+
"""
|
2464
2613
|
|
2465
2614
|
token_count: Optional[float]
|
2466
|
-
"""
|
2615
|
+
"""Vertex API only. Number of tokens of the input text.
|
2616
|
+
"""
|
2467
2617
|
|
2468
2618
|
|
2469
2619
|
ContentEmbeddingStatisticsOrDict = Union[
|
@@ -2472,36 +2622,55 @@ ContentEmbeddingStatisticsOrDict = Union[
|
|
2472
2622
|
|
2473
2623
|
|
2474
2624
|
class ContentEmbedding(_common.BaseModel):
|
2625
|
+
"""The embedding generated from an input content."""
|
2475
2626
|
|
2476
|
-
values: Optional[list[float]] = Field(
|
2627
|
+
values: Optional[list[float]] = Field(
|
2628
|
+
default=None,
|
2629
|
+
description="""A list of floats representing an embedding.
|
2630
|
+
""",
|
2631
|
+
)
|
2477
2632
|
statistics: Optional[ContentEmbeddingStatistics] = Field(
|
2478
|
-
default=None,
|
2633
|
+
default=None,
|
2634
|
+
description="""Vertex API only. Statistics of the input text associated with this
|
2635
|
+
embedding.
|
2636
|
+
""",
|
2479
2637
|
)
|
2480
2638
|
|
2481
2639
|
|
2482
2640
|
class ContentEmbeddingDict(TypedDict, total=False):
|
2641
|
+
"""The embedding generated from an input content."""
|
2483
2642
|
|
2484
2643
|
values: Optional[list[float]]
|
2485
|
-
"""
|
2644
|
+
"""A list of floats representing an embedding.
|
2645
|
+
"""
|
2486
2646
|
|
2487
2647
|
statistics: Optional[ContentEmbeddingStatisticsDict]
|
2488
|
-
"""
|
2648
|
+
"""Vertex API only. Statistics of the input text associated with this
|
2649
|
+
embedding.
|
2650
|
+
"""
|
2489
2651
|
|
2490
2652
|
|
2491
2653
|
ContentEmbeddingOrDict = Union[ContentEmbedding, ContentEmbeddingDict]
|
2492
2654
|
|
2493
2655
|
|
2494
2656
|
class EmbedContentMetadata(_common.BaseModel):
|
2657
|
+
"""Request-level metadata for the Vertex Embed Content API."""
|
2495
2658
|
|
2496
2659
|
billable_character_count: Optional[int] = Field(
|
2497
|
-
default=None,
|
2660
|
+
default=None,
|
2661
|
+
description="""Vertex API only. The total number of billable characters included
|
2662
|
+
in the request.
|
2663
|
+
""",
|
2498
2664
|
)
|
2499
2665
|
|
2500
2666
|
|
2501
2667
|
class EmbedContentMetadataDict(TypedDict, total=False):
|
2668
|
+
"""Request-level metadata for the Vertex Embed Content API."""
|
2502
2669
|
|
2503
2670
|
billable_character_count: Optional[int]
|
2504
|
-
"""
|
2671
|
+
"""Vertex API only. The total number of billable characters included
|
2672
|
+
in the request.
|
2673
|
+
"""
|
2505
2674
|
|
2506
2675
|
|
2507
2676
|
EmbedContentMetadataOrDict = Union[
|
@@ -2510,22 +2679,32 @@ EmbedContentMetadataOrDict = Union[
|
|
2510
2679
|
|
2511
2680
|
|
2512
2681
|
class EmbedContentResponse(_common.BaseModel):
|
2682
|
+
"""Response for the embed_content method."""
|
2513
2683
|
|
2514
2684
|
embeddings: Optional[list[ContentEmbedding]] = Field(
|
2515
|
-
default=None,
|
2685
|
+
default=None,
|
2686
|
+
description="""The embeddings for each request, in the same order as provided in
|
2687
|
+
the batch request.
|
2688
|
+
""",
|
2516
2689
|
)
|
2517
2690
|
metadata: Optional[EmbedContentMetadata] = Field(
|
2518
|
-
default=None,
|
2691
|
+
default=None,
|
2692
|
+
description="""Vertex API only. Metadata about the request.
|
2693
|
+
""",
|
2519
2694
|
)
|
2520
2695
|
|
2521
2696
|
|
2522
2697
|
class EmbedContentResponseDict(TypedDict, total=False):
|
2698
|
+
"""Response for the embed_content method."""
|
2523
2699
|
|
2524
2700
|
embeddings: Optional[list[ContentEmbeddingDict]]
|
2525
|
-
"""
|
2701
|
+
"""The embeddings for each request, in the same order as provided in
|
2702
|
+
the batch request.
|
2703
|
+
"""
|
2526
2704
|
|
2527
2705
|
metadata: Optional[EmbedContentMetadataDict]
|
2528
|
-
"""
|
2706
|
+
"""Vertex API only. Metadata about the request.
|
2707
|
+
"""
|
2529
2708
|
|
2530
2709
|
|
2531
2710
|
EmbedContentResponseOrDict = Union[
|
@@ -2536,6 +2715,9 @@ EmbedContentResponseOrDict = Union[
|
|
2536
2715
|
class GenerateImageConfig(_common.BaseModel):
|
2537
2716
|
"""Class that represents the config for generating an image."""
|
2538
2717
|
|
2718
|
+
http_options: Optional[dict[str, Any]] = Field(
|
2719
|
+
default=None, description="""Used to override HTTP request options."""
|
2720
|
+
)
|
2539
2721
|
output_gcs_uri: Optional[str] = Field(
|
2540
2722
|
default=None,
|
2541
2723
|
description="""Cloud Storage URI used to store the generated images.
|
@@ -2616,6 +2798,9 @@ class GenerateImageConfig(_common.BaseModel):
|
|
2616
2798
|
class GenerateImageConfigDict(TypedDict, total=False):
|
2617
2799
|
"""Class that represents the config for generating an image."""
|
2618
2800
|
|
2801
|
+
http_options: Optional[dict[str, Any]]
|
2802
|
+
"""Used to override HTTP request options."""
|
2803
|
+
|
2619
2804
|
output_gcs_uri: Optional[str]
|
2620
2805
|
"""Cloud Storage URI used to store the generated images.
|
2621
2806
|
"""
|
@@ -3102,6 +3287,9 @@ _ReferenceImageAPIOrDict = Union[_ReferenceImageAPI, _ReferenceImageAPIDict]
|
|
3102
3287
|
class EditImageConfig(_common.BaseModel):
|
3103
3288
|
"""Configuration for editing an image."""
|
3104
3289
|
|
3290
|
+
http_options: Optional[dict[str, Any]] = Field(
|
3291
|
+
default=None, description="""Used to override HTTP request options."""
|
3292
|
+
)
|
3105
3293
|
output_gcs_uri: Optional[str] = Field(
|
3106
3294
|
default=None,
|
3107
3295
|
description="""Cloud Storage URI used to store the generated images.
|
@@ -3176,6 +3364,9 @@ class EditImageConfig(_common.BaseModel):
|
|
3176
3364
|
class EditImageConfigDict(TypedDict, total=False):
|
3177
3365
|
"""Configuration for editing an image."""
|
3178
3366
|
|
3367
|
+
http_options: Optional[dict[str, Any]]
|
3368
|
+
"""Used to override HTTP request options."""
|
3369
|
+
|
3179
3370
|
output_gcs_uri: Optional[str]
|
3180
3371
|
"""Cloud Storage URI used to store the generated images.
|
3181
3372
|
"""
|
@@ -3300,6 +3491,9 @@ class _UpscaleImageAPIConfig(_common.BaseModel):
|
|
3300
3491
|
to be modifiable or exposed to users in the SDK method.
|
3301
3492
|
"""
|
3302
3493
|
|
3494
|
+
http_options: Optional[dict[str, Any]] = Field(
|
3495
|
+
default=None, description="""Used to override HTTP request options."""
|
3496
|
+
)
|
3303
3497
|
upscale_factor: Optional[str] = Field(
|
3304
3498
|
default=None,
|
3305
3499
|
description="""The factor to which the image will be upscaled.""",
|
@@ -3329,6 +3523,9 @@ class _UpscaleImageAPIConfigDict(TypedDict, total=False):
|
|
3329
3523
|
to be modifiable or exposed to users in the SDK method.
|
3330
3524
|
"""
|
3331
3525
|
|
3526
|
+
http_options: Optional[dict[str, Any]]
|
3527
|
+
"""Used to override HTTP request options."""
|
3528
|
+
|
3332
3529
|
upscale_factor: Optional[str]
|
3333
3530
|
"""The factor to which the image will be upscaled."""
|
3334
3531
|
|
@@ -6139,22 +6336,39 @@ DeleteFileResponseOrDict = Union[DeleteFileResponse, DeleteFileResponseDict]
|
|
6139
6336
|
class BatchJobSource(_common.BaseModel):
|
6140
6337
|
"""Config class for `src` parameter."""
|
6141
6338
|
|
6142
|
-
format: Optional[str] = Field(
|
6143
|
-
|
6144
|
-
|
6339
|
+
format: Optional[str] = Field(
|
6340
|
+
default=None,
|
6341
|
+
description="""Storage format of the input files. Must be one of:
|
6342
|
+
'jsonl', 'bigquery'.
|
6343
|
+
""",
|
6344
|
+
)
|
6345
|
+
gcs_uri: Optional[list[str]] = Field(
|
6346
|
+
default=None,
|
6347
|
+
description="""The Google Cloud Storage URIs to input files.
|
6348
|
+
""",
|
6349
|
+
)
|
6350
|
+
bigquery_uri: Optional[str] = Field(
|
6351
|
+
default=None,
|
6352
|
+
description="""The BigQuery URI to input table.
|
6353
|
+
""",
|
6354
|
+
)
|
6145
6355
|
|
6146
6356
|
|
6147
6357
|
class BatchJobSourceDict(TypedDict, total=False):
|
6148
6358
|
"""Config class for `src` parameter."""
|
6149
6359
|
|
6150
6360
|
format: Optional[str]
|
6151
|
-
"""
|
6361
|
+
"""Storage format of the input files. Must be one of:
|
6362
|
+
'jsonl', 'bigquery'.
|
6363
|
+
"""
|
6152
6364
|
|
6153
6365
|
gcs_uri: Optional[list[str]]
|
6154
|
-
"""
|
6366
|
+
"""The Google Cloud Storage URIs to input files.
|
6367
|
+
"""
|
6155
6368
|
|
6156
6369
|
bigquery_uri: Optional[str]
|
6157
|
-
"""
|
6370
|
+
"""The BigQuery URI to input table.
|
6371
|
+
"""
|
6158
6372
|
|
6159
6373
|
|
6160
6374
|
BatchJobSourceOrDict = Union[BatchJobSource, BatchJobSourceDict]
|
@@ -6163,22 +6377,39 @@ BatchJobSourceOrDict = Union[BatchJobSource, BatchJobSourceDict]
|
|
6163
6377
|
class BatchJobDestination(_common.BaseModel):
|
6164
6378
|
"""Config class for `des` parameter."""
|
6165
6379
|
|
6166
|
-
format: Optional[str] = Field(
|
6167
|
-
|
6168
|
-
|
6380
|
+
format: Optional[str] = Field(
|
6381
|
+
default=None,
|
6382
|
+
description="""Storage format of the output files. Must be one of:
|
6383
|
+
'jsonl', 'bigquery'.
|
6384
|
+
""",
|
6385
|
+
)
|
6386
|
+
gcs_uri: Optional[str] = Field(
|
6387
|
+
default=None,
|
6388
|
+
description="""The Google Cloud Storage URI to the output file.
|
6389
|
+
""",
|
6390
|
+
)
|
6391
|
+
bigquery_uri: Optional[str] = Field(
|
6392
|
+
default=None,
|
6393
|
+
description="""The BigQuery URI to the output table.
|
6394
|
+
""",
|
6395
|
+
)
|
6169
6396
|
|
6170
6397
|
|
6171
6398
|
class BatchJobDestinationDict(TypedDict, total=False):
|
6172
6399
|
"""Config class for `des` parameter."""
|
6173
6400
|
|
6174
6401
|
format: Optional[str]
|
6175
|
-
"""
|
6402
|
+
"""Storage format of the output files. Must be one of:
|
6403
|
+
'jsonl', 'bigquery'.
|
6404
|
+
"""
|
6176
6405
|
|
6177
6406
|
gcs_uri: Optional[str]
|
6178
|
-
"""
|
6407
|
+
"""The Google Cloud Storage URI to the output file.
|
6408
|
+
"""
|
6179
6409
|
|
6180
6410
|
bigquery_uri: Optional[str]
|
6181
|
-
"""
|
6411
|
+
"""The BigQuery URI to the output table.
|
6412
|
+
"""
|
6182
6413
|
|
6183
6414
|
|
6184
6415
|
BatchJobDestinationOrDict = Union[BatchJobDestination, BatchJobDestinationDict]
|
@@ -6190,8 +6421,17 @@ class CreateBatchJobConfig(_common.BaseModel):
|
|
6190
6421
|
http_options: Optional[dict[str, Any]] = Field(
|
6191
6422
|
default=None, description="""Used to override HTTP request options."""
|
6192
6423
|
)
|
6193
|
-
display_name: Optional[str] = Field(
|
6194
|
-
|
6424
|
+
display_name: Optional[str] = Field(
|
6425
|
+
default=None,
|
6426
|
+
description="""The user-defined name of this BatchJob.
|
6427
|
+
""",
|
6428
|
+
)
|
6429
|
+
dest: Optional[str] = Field(
|
6430
|
+
default=None,
|
6431
|
+
description="""GCS or Bigquery URI prefix for the output predictions. Example:
|
6432
|
+
"gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
|
6433
|
+
""",
|
6434
|
+
)
|
6195
6435
|
|
6196
6436
|
|
6197
6437
|
class CreateBatchJobConfigDict(TypedDict, total=False):
|
@@ -6201,10 +6441,13 @@ class CreateBatchJobConfigDict(TypedDict, total=False):
|
|
6201
6441
|
"""Used to override HTTP request options."""
|
6202
6442
|
|
6203
6443
|
display_name: Optional[str]
|
6204
|
-
"""
|
6444
|
+
"""The user-defined name of this BatchJob.
|
6445
|
+
"""
|
6205
6446
|
|
6206
6447
|
dest: Optional[str]
|
6207
|
-
"""
|
6448
|
+
"""GCS or Bigquery URI prefix for the output predictions. Example:
|
6449
|
+
"gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
|
6450
|
+
"""
|
6208
6451
|
|
6209
6452
|
|
6210
6453
|
CreateBatchJobConfigOrDict = Union[
|
@@ -6215,10 +6458,21 @@ CreateBatchJobConfigOrDict = Union[
|
|
6215
6458
|
class _CreateBatchJobParameters(_common.BaseModel):
|
6216
6459
|
"""Config class for batches.create parameters."""
|
6217
6460
|
|
6218
|
-
model: Optional[str] = Field(
|
6219
|
-
|
6461
|
+
model: Optional[str] = Field(
|
6462
|
+
default=None,
|
6463
|
+
description="""The name of the model to produces the predictions via the BatchJob.
|
6464
|
+
""",
|
6465
|
+
)
|
6466
|
+
src: Optional[str] = Field(
|
6467
|
+
default=None,
|
6468
|
+
description="""GCS URI(-s) or Bigquery URI to your input data to run batch job.
|
6469
|
+
Example: "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId".
|
6470
|
+
""",
|
6471
|
+
)
|
6220
6472
|
config: Optional[CreateBatchJobConfig] = Field(
|
6221
|
-
default=None,
|
6473
|
+
default=None,
|
6474
|
+
description="""Optional parameters for creating a BatchJob.
|
6475
|
+
""",
|
6222
6476
|
)
|
6223
6477
|
|
6224
6478
|
|
@@ -6226,13 +6480,17 @@ class _CreateBatchJobParametersDict(TypedDict, total=False):
|
|
6226
6480
|
"""Config class for batches.create parameters."""
|
6227
6481
|
|
6228
6482
|
model: Optional[str]
|
6229
|
-
"""
|
6483
|
+
"""The name of the model to produces the predictions via the BatchJob.
|
6484
|
+
"""
|
6230
6485
|
|
6231
6486
|
src: Optional[str]
|
6232
|
-
"""
|
6487
|
+
"""GCS URI(-s) or Bigquery URI to your input data to run batch job.
|
6488
|
+
Example: "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId".
|
6489
|
+
"""
|
6233
6490
|
|
6234
6491
|
config: Optional[CreateBatchJobConfigDict]
|
6235
|
-
"""
|
6492
|
+
"""Optional parameters for creating a BatchJob.
|
6493
|
+
"""
|
6236
6494
|
|
6237
6495
|
|
6238
6496
|
_CreateBatchJobParametersOrDict = Union[
|
@@ -6303,9 +6561,21 @@ class BatchJob(_common.BaseModel):
|
|
6303
6561
|
default=None,
|
6304
6562
|
description="""Output only. Time when the Job was most recently updated.""",
|
6305
6563
|
)
|
6306
|
-
model: Optional[str] = Field(
|
6307
|
-
|
6308
|
-
|
6564
|
+
model: Optional[str] = Field(
|
6565
|
+
default=None,
|
6566
|
+
description="""The name of the model that produces the predictions via the BatchJob.
|
6567
|
+
""",
|
6568
|
+
)
|
6569
|
+
src: Optional[BatchJobSource] = Field(
|
6570
|
+
default=None,
|
6571
|
+
description="""Configuration for the input data.
|
6572
|
+
""",
|
6573
|
+
)
|
6574
|
+
dest: Optional[BatchJobDestination] = Field(
|
6575
|
+
default=None,
|
6576
|
+
description="""Configuration for the output data.
|
6577
|
+
""",
|
6578
|
+
)
|
6309
6579
|
|
6310
6580
|
|
6311
6581
|
class BatchJobDict(TypedDict, total=False):
|
@@ -6336,13 +6606,16 @@ class BatchJobDict(TypedDict, total=False):
|
|
6336
6606
|
"""Output only. Time when the Job was most recently updated."""
|
6337
6607
|
|
6338
6608
|
model: Optional[str]
|
6339
|
-
"""
|
6609
|
+
"""The name of the model that produces the predictions via the BatchJob.
|
6610
|
+
"""
|
6340
6611
|
|
6341
6612
|
src: Optional[BatchJobSourceDict]
|
6342
|
-
"""
|
6613
|
+
"""Configuration for the input data.
|
6614
|
+
"""
|
6343
6615
|
|
6344
6616
|
dest: Optional[BatchJobDestinationDict]
|
6345
|
-
"""
|
6617
|
+
"""Configuration for the output data.
|
6618
|
+
"""
|
6346
6619
|
|
6347
6620
|
|
6348
6621
|
BatchJobOrDict = Union[BatchJob, BatchJobDict]
|
@@ -6351,14 +6624,23 @@ BatchJobOrDict = Union[BatchJob, BatchJobDict]
|
|
6351
6624
|
class _GetBatchJobParameters(_common.BaseModel):
|
6352
6625
|
"""Config class for batches.get parameters."""
|
6353
6626
|
|
6354
|
-
name: Optional[str] = Field(
|
6627
|
+
name: Optional[str] = Field(
|
6628
|
+
default=None,
|
6629
|
+
description="""A fully-qualified BatchJob resource name or ID.
|
6630
|
+
Example: "projects/.../locations/.../batchPredictionJobs/456"
|
6631
|
+
or "456" when project and location are initialized in the client.
|
6632
|
+
""",
|
6633
|
+
)
|
6355
6634
|
|
6356
6635
|
|
6357
6636
|
class _GetBatchJobParametersDict(TypedDict, total=False):
|
6358
6637
|
"""Config class for batches.get parameters."""
|
6359
6638
|
|
6360
6639
|
name: Optional[str]
|
6361
|
-
"""
|
6640
|
+
"""A fully-qualified BatchJob resource name or ID.
|
6641
|
+
Example: "projects/.../locations/.../batchPredictionJobs/456"
|
6642
|
+
or "456" when project and location are initialized in the client.
|
6643
|
+
"""
|
6362
6644
|
|
6363
6645
|
|
6364
6646
|
_GetBatchJobParametersOrDict = Union[
|
@@ -6369,14 +6651,23 @@ _GetBatchJobParametersOrDict = Union[
|
|
6369
6651
|
class _CancelBatchJobParameters(_common.BaseModel):
|
6370
6652
|
"""Config class for batches.cancel parameters."""
|
6371
6653
|
|
6372
|
-
name: Optional[str] = Field(
|
6654
|
+
name: Optional[str] = Field(
|
6655
|
+
default=None,
|
6656
|
+
description="""A fully-qualified BatchJob resource name or ID.
|
6657
|
+
Example: "projects/.../locations/.../batchPredictionJobs/456"
|
6658
|
+
or "456" when project and location are initialized in the client.
|
6659
|
+
""",
|
6660
|
+
)
|
6373
6661
|
|
6374
6662
|
|
6375
6663
|
class _CancelBatchJobParametersDict(TypedDict, total=False):
|
6376
6664
|
"""Config class for batches.cancel parameters."""
|
6377
6665
|
|
6378
6666
|
name: Optional[str]
|
6379
|
-
"""
|
6667
|
+
"""A fully-qualified BatchJob resource name or ID.
|
6668
|
+
Example: "projects/.../locations/.../batchPredictionJobs/456"
|
6669
|
+
or "456" when project and location are initialized in the client.
|
6670
|
+
"""
|
6380
6671
|
|
6381
6672
|
|
6382
6673
|
_CancelBatchJobParametersOrDict = Union[
|
@@ -6457,14 +6748,23 @@ ListBatchJobResponseOrDict = Union[
|
|
6457
6748
|
class _DeleteBatchJobParameters(_common.BaseModel):
|
6458
6749
|
"""Config class for batches.delete parameters."""
|
6459
6750
|
|
6460
|
-
name: Optional[str] = Field(
|
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
|
+
)
|
6461
6758
|
|
6462
6759
|
|
6463
6760
|
class _DeleteBatchJobParametersDict(TypedDict, total=False):
|
6464
6761
|
"""Config class for batches.delete parameters."""
|
6465
6762
|
|
6466
6763
|
name: Optional[str]
|
6467
|
-
"""
|
6764
|
+
"""A fully-qualified BatchJob resource name or ID.
|
6765
|
+
Example: "projects/.../locations/.../batchPredictionJobs/456"
|
6766
|
+
or "456" when project and location are initialized in the client.
|
6767
|
+
"""
|
6468
6768
|
|
6469
6769
|
|
6470
6770
|
_DeleteBatchJobParametersOrDict = Union[
|
@@ -6733,6 +7033,9 @@ class UpscaleImageConfig(_common.BaseModel):
|
|
6733
7033
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_.
|
6734
7034
|
"""
|
6735
7035
|
|
7036
|
+
http_options: Optional[dict[str, Any]] = Field(
|
7037
|
+
default=None, description="""Used to override HTTP request options."""
|
7038
|
+
)
|
6736
7039
|
upscale_factor: Optional[str] = Field(
|
6737
7040
|
default=None,
|
6738
7041
|
description="""The factor to which the image will be upscaled.""",
|
@@ -6761,6 +7064,9 @@ class UpscaleImageConfigDict(TypedDict, total=False):
|
|
6761
7064
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_.
|
6762
7065
|
"""
|
6763
7066
|
|
7067
|
+
http_options: Optional[dict[str, Any]]
|
7068
|
+
"""Used to override HTTP request options."""
|
7069
|
+
|
6764
7070
|
upscale_factor: Optional[str]
|
6765
7071
|
"""The factor to which the image will be upscaled."""
|
6766
7072
|
|
@@ -7289,12 +7595,6 @@ class LiveServerMessage(_common.BaseModel):
|
|
7289
7595
|
return None
|
7290
7596
|
text = ""
|
7291
7597
|
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
7598
|
if isinstance(part.text, str):
|
7299
7599
|
text += part.text
|
7300
7600
|
return text if text else None
|
@@ -7311,12 +7611,6 @@ class LiveServerMessage(_common.BaseModel):
|
|
7311
7611
|
return None
|
7312
7612
|
concatenated_data = b""
|
7313
7613
|
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
7614
|
if part.inline_data and isinstance(part.inline_data.data, bytes):
|
7321
7615
|
concatenated_data += part.inline_data.data
|
7322
7616
|
return concatenated_data if len(concatenated_data) > 0 else None
|