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.
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: google-genai
3
- Version: 0.0.1
3
+ Version: 0.1.0
4
4
  Summary: GenAI Python SDK
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License: Apache-2.0
7
- Project-URL: Homepage, https://github.com/googlapis/genai-python
7
+ Project-URL: Homepage, https://github.com/googleapis/python-genai
8
8
  Classifier: Intended Audience :: Developers
9
9
  Classifier: License :: OSI Approved :: Apache Software License
10
10
  Classifier: Operating System :: OS Independent
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.9
14
14
  Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
17
18
  Classifier: Topic :: Internet
18
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
20
  Requires-Python: >=3.9
@@ -66,7 +67,7 @@ The `client.models` modules exposes model inferencing and model getters.
66
67
 
67
68
  ``` python
68
69
  response = client.models.generate_content(
69
- model='gemini-1.5-pro-002', contents='What is your name?'
70
+ model='gemini-2.0-flash-exp', contents='What is your name?'
70
71
  )
71
72
  print(response.text)
72
73
  ```
@@ -75,7 +76,7 @@ print(response.text)
75
76
 
76
77
  ``` python
77
78
  response = client.models.generate_content(
78
- model='gemini-1.5-pro-002',
79
+ model='gemini-2.0-flash-exp',
79
80
  contents='high',
80
81
  config=types.GenerateContentConfig(
81
82
  system_instruction='I say high, you say low',
@@ -92,7 +93,7 @@ dictionaries. You can get the type from `google.genai.types`.
92
93
 
93
94
  ``` python
94
95
  response = client.models.generate_content(
95
- model='gemini-1.5-flash-002',
96
+ model='gemini-2.0-flash-exp',
96
97
  contents=types.Part.from_text('Why is sky blue?'),
97
98
  config=types.GenerateContentConfig(
98
99
  temperature=0,
@@ -114,7 +115,7 @@ response
114
115
 
115
116
  ``` python
116
117
  response = client.models.generate_content(
117
- model='gemini-1.5-flash',
118
+ model='gemini-2.0-flash-exp',
118
119
  contents='Say something bad.',
119
120
  config=types.GenerateContentConfig(
120
121
  safety_settings= [types.SafetySetting(
@@ -143,7 +144,7 @@ def get_current_weather(location: str,) -> int:
143
144
  return 'sunny'
144
145
 
145
146
  response = client.models.generate_content(
146
- model='gemini-1.5-pro-002',
147
+ model='gemini-2.0-flash-exp',
147
148
  contents="What is the weather like in Boston?",
148
149
  config=types.GenerateContentConfig(tools=[get_current_weather],)
149
150
  )
@@ -171,7 +172,7 @@ tool = types.Tool(function_declarations=[function])
171
172
 
172
173
 
173
174
  response = client.models.generate_content(
174
- model='gemini-1.5-pro-002',
175
+ model='gemini-2.0-flash-exp',
175
176
  contents="What is the weather like in Boston?",
176
177
  config=types.GenerateContentConfig(tools=[tool],)
177
178
  )
@@ -191,7 +192,7 @@ function_response_part = types.Part.from_function_response(
191
192
  )
192
193
 
193
194
  response = client.models.generate_content(
194
- model='gemini-1.5-pro-002',
195
+ model='gemini-2.0-flash-exp',
195
196
  contents=[
196
197
  types.Part.from_text("What is the weather like in Boston?"),
197
198
  function_call_part,
@@ -221,7 +222,7 @@ class CountryInfo(BaseModel):
221
222
 
222
223
 
223
224
  response = client.models.generate_content(
224
- model='gemini-1.5-flash',
225
+ model='gemini-2.0-flash-exp',
225
226
  contents='Give me information of the United States.',
226
227
  config=types.GenerateContentConfig(
227
228
  response_mime_type= 'application/json',
@@ -233,7 +234,7 @@ print(response.text)
233
234
 
234
235
  ``` python
235
236
  response = client.models.generate_content(
236
- model='gemini-1.5-flash',
237
+ model='gemini-2.0-flash-exp',
237
238
  contents='Give me information of the United States.',
238
239
  config={
239
240
  'response_mime_type': 'application/json',
@@ -267,7 +268,7 @@ print(response.text)
267
268
 
268
269
  ``` python
269
270
  for chunk in client.models.generate_content_stream(
270
- model='gemini-1.5-flash', contents='Tell me a story in 300 words.'
271
+ model='gemini-2.0-flash-exp', contents='Tell me a story in 300 words.'
271
272
  ):
272
273
  print(chunk.text)
273
274
  ```
@@ -282,7 +283,7 @@ of `client.models.generate_content`
282
283
 
283
284
  ``` python
284
285
  request = await client.aio.models.generate_content(
285
- model='gemini-1.5-flash', contents='Tell me a story in 300 words.'
286
+ model='gemini-2.0-flash-exp', contents='Tell me a story in 300 words.'
286
287
  )
287
288
 
288
289
  print(response.text)
@@ -292,7 +293,7 @@ print(response.text)
292
293
 
293
294
  ``` python
294
295
  async for response in client.aio.models.generate_content_stream(
295
- model='gemini-1.5-flash', contents='Tell me a story in 300 words.'
296
+ model='gemini-2.0-flash-exp', contents='Tell me a story in 300 words.'
296
297
  ):
297
298
  print(response.text)
298
299
  ```
@@ -301,7 +302,7 @@ async for response in client.aio.models.generate_content_stream(
301
302
 
302
303
  ``` python
303
304
  response = client.models.count_tokens(
304
- model='gemini-1.5-flash',
305
+ model='gemini-2.0-flash-exp',
305
306
  contents='What is your name?',
306
307
  )
307
308
  print(response)
@@ -313,7 +314,7 @@ Compute tokens is not supported by Google AI.
313
314
 
314
315
  ``` python
315
316
  response = client.models.compute_tokens(
316
- model='gemini-1.5-flash',
317
+ model='gemini-2.0-flash-exp',
317
318
  contents='What is your name?',
318
319
  )
319
320
  print(response)
@@ -323,7 +324,7 @@ print(response)
323
324
 
324
325
  ``` python
325
326
  response = await client.aio.models.count_tokens(
326
- model='gemini-1.5-flash',
327
+ model='gemini-2.0-flash-exp',
327
328
  contents='What is your name?',
328
329
  )
329
330
  print(response)
@@ -360,14 +361,12 @@ Support for generate image in Google AI is behind an allowlist
360
361
  # Generate Image
361
362
  response1 = client.models.generate_image(
362
363
  model='imagen-3.0-generate-001',
363
- prompt='Robot holding a red skateboard',
364
+ prompt='An umbrella in the foreground, and a rainy night sky in the background',
364
365
  config=types.GenerateImageConfig(
366
+ negative_prompt= "human",
365
367
  number_of_images= 1,
366
- person_generation= "ALLOW_ADULT",
367
- safety_filter_level= "BLOCK_LOW_AND_ABOVE",
368
368
  include_rai_reason= True,
369
- add_watermark= True,
370
- aspect_ratio= "4:3"
369
+ output_mime_type= "image/jpeg"
371
370
  )
372
371
  )
373
372
  response1.generated_images[0].image.show()
@@ -375,9 +374,10 @@ response1.generated_images[0].image.show()
375
374
 
376
375
  #### Upscale Image
377
376
 
377
+ Upscale image is not supported in Google AI.
378
+
378
379
  ``` python
379
- # Upscale the generated image from the cell above
380
- from google.genai.types import Image
380
+ # Upscale the generated image from above
381
381
  response2 = client.models.upscale_image(
382
382
  model='imagen-3.0-generate-001',
383
383
  image=response1.generated_images[0].image,
@@ -388,21 +388,36 @@ response2.generated_images[0].image.show()
388
388
 
389
389
  #### Edit Image
390
390
 
391
+ Edit image is not supported in Google AI.
392
+
391
393
  ``` python
392
- # Edit the generated image from the first cell
393
- from google.genai.types import Image
394
+ # Edit the generated image from above
395
+ from google.genai.types import RawReferenceImage, MaskReferenceImage
396
+ raw_ref_image = RawReferenceImage(
397
+ reference_id=1,
398
+ reference_image=response1.generated_images[0].image,
399
+ )
400
+
401
+ # Model computes a mask of the background
402
+ mask_ref_image = MaskReferenceImage(
403
+ reference_id=2,
404
+ config=types.MaskReferenceConfig(
405
+ mask_mode='MASK_MODE_BACKGROUND',
406
+ mask_dilation=0,
407
+ ),
408
+ )
409
+
394
410
  response3 = client.models.edit_image(
395
- model='imagegeneration@006',
396
- prompt='holding yellow surfboard',
397
- image=response1.generated_images[0].image,
411
+ model='imagen-3.0-capability-preview-0930',
412
+ prompt='Sunlight and clear sky',
413
+ reference_images=[raw_ref_image, mask_ref_image],
398
414
  config=types.EditImageConfig(
399
- edit_mode="inpainting-insert",
400
- mask_type="semantic",
401
- segmentation_classes=[156],
415
+ edit_mode= 'EDIT_MODE_INPAINT_INSERTION',
402
416
  number_of_images= 1,
417
+ negative_prompt= 'human',
403
418
  include_rai_reason= True,
404
- product_position="reposition"
405
- )
419
+ output_mime_type= 'image/jpeg',
420
+ ),
406
421
  )
407
422
  response3.generated_images[0].image.show()
408
423
  ```
@@ -439,7 +454,7 @@ client.files.delete(name=file3.name)
439
454
  ### Create
440
455
 
441
456
  ``` python
442
- if client._api_client.vertexai:
457
+ if client.vertexai:
443
458
  file_uris = [
444
459
  'gs://cloud-samples-data/generative-ai/pdf/2312.11805v3.pdf',
445
460
  'gs://cloud-samples-data/generative-ai/pdf/2403.05530.pdf'
@@ -624,7 +639,7 @@ distillation_job = client.tunings.distill(
624
639
  config=genai.types.CreateDistillationJobConfig(
625
640
  epoch_count=1,
626
641
  pipeline_root_directory=(
627
- "gs://vertex-sdk-dev-staging-us-central1/tmp/distillation_pipeline_root"
642
+ "gs://my-bucket"
628
643
  ),
629
644
  ),
630
645
  )
@@ -689,14 +704,7 @@ Only supported in Vertex AI.
689
704
  # Specify model and source file only, destination and job display name will be auto-populated
690
705
  job = client.batches.create(
691
706
  model='gemini-1.5-flash-002',
692
- src='bq://vertex-sdk-dev.unified_genai_tests_batches.generate_content_requests',
693
- # # optionally specify destination and display_name by yourself
694
- # config = {
695
- # 'dest': 'bq://vertex-sdk-dev.unified_genai_tests_batches.generate_content_responses',
696
- # 'display_name': 'create_batch_job_demo'
697
- # }
698
- )
699
-
707
+ src='bq://my-project.my-dataset.my-table',
700
708
  job
701
709
  ```
702
710
 
@@ -0,0 +1,24 @@
1
+ google/genai/__init__.py,sha256=BkkJfmiA_SwVZvz_tSjJaEYEVh75HXC9UcH91FRSjUU,674
2
+ google/genai/_api_client.py,sha256=9fSVC8elIVV-EwU1-GmC95OxHptdWrIrLRNs6Dvcs8Y,15638
3
+ google/genai/_automatic_function_calling_util.py,sha256=E25_66RH3DbDIucq7x-93XWPPBwB9FnzwD1NCGyPrjM,10242
4
+ google/genai/_common.py,sha256=Yj5cBkq5QRNFSBqvpB949Rjo7cbIhdtKp5dJxMW_I6I,7971
5
+ google/genai/_extra_utils.py,sha256=GQZnraFCrMffqrBEpurdcBmgrltRsnYgMizt-Ok6xX8,11098
6
+ google/genai/_replay_api_client.py,sha256=QPNg4SBpOLS58bx-kuJQngxy1tbjMpCpJzmImCwYePA,16226
7
+ google/genai/_test_api_client.py,sha256=p771T27icmzENxKtyNDwPG1sTI7jaoJNFPwlwq9GK6o,4759
8
+ google/genai/_transformers.py,sha256=_zWNr7zFTrUFniECYaZUn0n4TdioLpj783l3-z1XvIE,13443
9
+ google/genai/batches.py,sha256=gAuFZOKosJj-GYHvftFdbBuw6Y9VkFC9scOjeUssAC0,34632
10
+ google/genai/caches.py,sha256=LJm2raykec7_iCHsVbEtX4v942mR-OSQvxTVKcBN2RA,53434
11
+ google/genai/chats.py,sha256=QcOqW87D5bpGQ_78xTu9y1G28dQx9iUEyqNFwPsAFdU,5686
12
+ google/genai/client.py,sha256=HH_lYnjPOwW-4Vgynyw4K8cwurT2g578Dc51H_uk7GY,9244
13
+ google/genai/errors.py,sha256=TrlUk1jz7r1aN1lrL3FZZ30LU4iMfSonm1ZwEAk07k4,3048
14
+ google/genai/files.py,sha256=9B1Xsb2R7jBAU3Ot-1Z4YJjC9gQEywzAfLT24yHN4EI,35567
15
+ google/genai/live.py,sha256=T-pOtq7k43wE2VjQzqLrx-kqhotS66I2PY_NHBdv9G8,22056
16
+ google/genai/models.py,sha256=1slDoZuGq91B7erpxeBaFGfv1PAcIPV4j1Gqg-aHhEs,154534
17
+ google/genai/pagers.py,sha256=hSHd-gLvEzYWwK85i8EcFNWUMKtszUs7Nw2r3L7d6_U,6686
18
+ google/genai/tunings.py,sha256=EYA9FykWZSkhcHkHcCO7VvYkFBVzQCWYX2umtIhlhQQ,47018
19
+ google/genai/types.py,sha256=73tKrlpCmV4PRb2HMYHVZXmiHTS2iK-CL89uJvNE54Q,260869
20
+ google_genai-0.1.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
21
+ google_genai-0.1.0.dist-info/METADATA,sha256=1AAUKL2kZ6sGbkfQdUr-rSWttYg1qFAVXe9mneSikSc,17260
22
+ google_genai-0.1.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
23
+ google_genai-0.1.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
24
+ google_genai-0.1.0.dist-info/RECORD,,
@@ -1,24 +0,0 @@
1
- google/genai/__init__.py,sha256=49gQv3uugzoY9BDHbhMKfHzYfn5CcttAm47Ecp6gvQs,651
2
- google/genai/_api_client.py,sha256=gzgQ7-Zu48trXpcr0WR6OqBk-BzujsFkNKBdifjS3U8,15637
3
- google/genai/_automatic_function_calling_util.py,sha256=Q7_wty4RNBoYBT2aHWf2EdJSJkqG965nri8F5NCLx20,11578
4
- google/genai/_common.py,sha256=Yj5cBkq5QRNFSBqvpB949Rjo7cbIhdtKp5dJxMW_I6I,7971
5
- google/genai/_extra_utils.py,sha256=TT3YieI_SxSWYyLJwhe7i33262vf2W0YTatBSF0dPHg,10684
6
- google/genai/_replay_api_client.py,sha256=QPNg4SBpOLS58bx-kuJQngxy1tbjMpCpJzmImCwYePA,16226
7
- google/genai/_test_api_client.py,sha256=p771T27icmzENxKtyNDwPG1sTI7jaoJNFPwlwq9GK6o,4759
8
- google/genai/_transformers.py,sha256=CYyQibFoW3ZZAOXrIb_BPZulLcmJvuBNJcCp3m3sGeQ,13475
9
- google/genai/batches.py,sha256=wpdyI5IFXDBLPzVkkEAcElPZEt76lWBkf7fNpqG9bb8,30406
10
- google/genai/caches.py,sha256=h4MX19ZUC7CAd7DY91FWPjUbTQHG-3-Oi4eDU-5nn40,53424
11
- google/genai/chats.py,sha256=80GWA431KehYTfAggMh6W3jHdDizbjk0RfO8MXilwDM,5342
12
- google/genai/client.py,sha256=HH_lYnjPOwW-4Vgynyw4K8cwurT2g578Dc51H_uk7GY,9244
13
- google/genai/errors.py,sha256=TrlUk1jz7r1aN1lrL3FZZ30LU4iMfSonm1ZwEAk07k4,3048
14
- google/genai/files.py,sha256=9B1Xsb2R7jBAU3Ot-1Z4YJjC9gQEywzAfLT24yHN4EI,35567
15
- google/genai/live.py,sha256=htpzNj8L8nionvbzQJLNZbwD4_1UQHTBGkgQVHXRkQo,20835
16
- google/genai/models.py,sha256=sQwTPqjxiv4jhP-Rn6nBlAyGBP_gK6lAUcVL56DwcwE,151681
17
- google/genai/pagers.py,sha256=hSHd-gLvEzYWwK85i8EcFNWUMKtszUs7Nw2r3L7d6_U,6686
18
- google/genai/tunings.py,sha256=srGxr4KlRxZ01lPT5ohtrNxqlA9I6RCbCLcxcfATY4s,39452
19
- google/genai/types.py,sha256=Fm-Y8CTYF6BY3ZE0EgzOCJ6C1SuygqT6Kfu4_Obw5Ko,250959
20
- google_genai-0.0.1.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
21
- google_genai-0.0.1.dist-info/METADATA,sha256=TgTn66RX2xEykoOUkwVsSncghI8TGug0GhHe5QfHDhE,17151
22
- google_genai-0.0.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
23
- google_genai-0.0.1.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
24
- google_genai-0.0.1.dist-info/RECORD,,