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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.5.0' # x-release-please-version
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: google-genai
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: GenAI Python SDK
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License: Apache-2.0
@@ -436,10 +436,10 @@ response1 = client.models.generate_image(
436
436
  model='imagen-3.0-generate-001',
437
437
  prompt='An umbrella in the foreground, and a rainy night sky in the background',
438
438
  config=types.GenerateImageConfig(
439
- negative_prompt= "human",
439
+ negative_prompt= 'human',
440
440
  number_of_images= 1,
441
441
  include_rai_reason= True,
442
- output_mime_type= "image/jpeg"
442
+ output_mime_type= 'image/jpeg'
443
443
  )
444
444
  )
445
445
  response1.generated_images[0].image.show()
@@ -454,7 +454,11 @@ Upscale image is not supported in Google AI.
454
454
  response2 = client.models.upscale_image(
455
455
  model='imagen-3.0-generate-001',
456
456
  image=response1.generated_images[0].image,
457
- config=types.UpscaleImageConfig(upscale_factor="x2")
457
+ upscale_factor='x2',
458
+ config=types.UpscaleImageConfig(
459
+ include_rai_reason= True,
460
+ output_mime_type= 'image/jpeg',
461
+ ),
458
462
  )
459
463
  response2.generated_images[0].image.show()
460
464
  ```
@@ -497,6 +501,42 @@ response3 = client.models.edit_image(
497
501
  response3.generated_images[0].image.show()
498
502
  ```
499
503
 
504
+ ## Chats
505
+
506
+ Create a chat session to start a multi-turn conversations with the model.
507
+
508
+ ### Send Message
509
+
510
+ ```python
511
+ chat = client.chats.create(model='gemini-2.0-flash-exp')
512
+ response = chat.send_message('tell me a story')
513
+ print(response.text)
514
+ ```
515
+
516
+ ### Streaming
517
+
518
+ ```python
519
+ chat = client.chats.create(model='gemini-2.0-flash-exp')
520
+ for chunk in chat.send_message_stream('tell me a story'):
521
+ print(chunk.text)
522
+ ```
523
+
524
+ ### Async
525
+
526
+ ```python
527
+ chat = client.aio.chats.create(model='gemini-2.0-flash-exp')
528
+ response = await chat.send_message('tell me a story')
529
+ print(response.text)
530
+ ```
531
+
532
+ ### Async Streaming
533
+
534
+ ```python
535
+ chat = client.aio.chats.create(model='gemini-2.0-flash-exp')
536
+ async for chunk in chat.send_message_stream('tell me a story'):
537
+ print(chunk.text)
538
+ ```
539
+
500
540
  ## Files (Only Google AI)
501
541
 
502
542
  ``` python
@@ -539,19 +579,19 @@ else:
539
579
 
540
580
  cached_content = client.caches.create(
541
581
  model='gemini-1.5-pro-002',
542
- contents=[
543
- types.Content(
544
- role='user',
545
- parts=[
546
- types.Part.from_uri(
547
- file_uri=file_uris[0],
548
- mime_type='application/pdf'),
549
- types.Part.from_uri(
550
- file_uri=file_uris[1],
551
- mime_type='application/pdf',)])
552
- ],
553
- system_instruction='What is the sum of the two pdfs?',
554
582
  config=types.CreateCachedContentConfig(
583
+ contents=[
584
+ types.Content(
585
+ role='user',
586
+ parts=[
587
+ types.Part.from_uri(
588
+ file_uri=file_uris[0],
589
+ mime_type='application/pdf'),
590
+ types.Part.from_uri(
591
+ file_uri=file_uris[1],
592
+ mime_type='application/pdf',)])
593
+ ],
594
+ system_instruction='What is the sum of the two pdfs?',
555
595
  display_name='test cache',
556
596
  ttl='3600s',
557
597
  ),
@@ -0,0 +1,25 @@
1
+ google/genai/__init__.py,sha256=IYw-PcsdgjSpS1mU_ZcYkTfPocsJ4aVmrDxP7vX7c6Y,709
2
+ google/genai/_api_client.py,sha256=INqC2Atur_7DmXcxOpL6CLsvWKMPEc0bjKORlkp4KHw,20526
3
+ google/genai/_automatic_function_calling_util.py,sha256=qbMCO8x6THe1O7Bn-L97rlbDSYJoX_gUfztvKHh-u6E,10078
4
+ google/genai/_common.py,sha256=8jsMW0IUkSnrKaJ7phj-PuaB9ynJsgw_4wY3WyWNbpQ,7434
5
+ google/genai/_extra_utils.py,sha256=GQZnraFCrMffqrBEpurdcBmgrltRsnYgMizt-Ok6xX8,11098
6
+ google/genai/_replay_api_client.py,sha256=Y3aVXxIs674NWkWf5ix4gnf1rJroqbzQkHD98-sK6cE,14420
7
+ google/genai/_test_api_client.py,sha256=p771T27icmzENxKtyNDwPG1sTI7jaoJNFPwlwq9GK6o,4759
8
+ google/genai/_transformers.py,sha256=FXtghU18WniMl0fJ_XFKDgMcP1PgmbEJO8j_6slblQw,15125
9
+ google/genai/batches.py,sha256=Qu9x27dvXk2ComYM7yMhHXVr2bJoRVhMAUXB1yYa8Ow,37444
10
+ google/genai/caches.py,sha256=uKSPwcK9IhGhINwBp9LF6A2QyYi1Cr82hPBQY2ZQS3g,53938
11
+ google/genai/chats.py,sha256=GobIFlez3eTRWWDtUycnubrMz0hB3v3gvDVSdMFJTNc,7642
12
+ google/genai/client.py,sha256=2W4AkvNNI6JnjOCtl-swBIaB1Z89zPqnvUc7RCGy3uE,9488
13
+ google/genai/errors.py,sha256=ZqJvfuJ7oS334WBrq3otzdZfmhEgcM1OBZhHccYzDok,3665
14
+ google/genai/files.py,sha256=I3o9XN0fF4zbiJXvBS2Zlfl0Ii4wbUH1lxXGThGA3gQ,36006
15
+ google/genai/live.py,sha256=q0yskQSsbareINHF55N7j4pus16Mbi2SlFyKuVfTtgo,22944
16
+ google/genai/models.py,sha256=7QgdubqMQ-c7Yr5eT874MiaD7TrJQ1h6gN_y-39kn4A,158443
17
+ google/genai/pagers.py,sha256=hSHd-gLvEzYWwK85i8EcFNWUMKtszUs7Nw2r3L7d6_U,6686
18
+ google/genai/tunings.py,sha256=hllfrOsHzebDIEaNGwOG_M-l0oslygUl76Etc_kge60,49348
19
+ google/genai/types.py,sha256=Yq3oRhqVE_XpcPkAobHtj3Fza57cRz2vOVHxLiCbkvQ,267020
20
+ google/genai/version.py,sha256=EmmjY1OHuNfI55kc1trMCf_Z0_foZJb3HkT_T3bMUhU,626
21
+ google_genai-0.5.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
22
+ google_genai-0.5.0.dist-info/METADATA,sha256=d2DEgiATDtI8SH_moEZ4Iw-xSWvDEPMO1jd1dSAOFHM,20164
23
+ google_genai-0.5.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
24
+ google_genai-0.5.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
25
+ google_genai-0.5.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,24 +0,0 @@
1
- google/genai/__init__.py,sha256=rFj7z7zuHpBIR70hkGCm9mGZstrO4TgxaJcv-89xokQ,674
2
- google/genai/_api_client.py,sha256=05gZvxU9r1LcXmHEY9qscuDCm0O8GsxepYm8wpnO_3Y,16110
3
- google/genai/_automatic_function_calling_util.py,sha256=aiAIsHMyW6NM3ROS7J7n6BhTG_DuMeeTBVGZbAaCJFs,10048
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=D9AedHL5jgJAojDxJaLuD-HmDSpBjfV_6gt-ZTFfzLo,16227
7
- google/genai/_test_api_client.py,sha256=p771T27icmzENxKtyNDwPG1sTI7jaoJNFPwlwq9GK6o,4759
8
- google/genai/_transformers.py,sha256=_2p1HbZYeDYfQiu24gLBRwMh5HqzSRgDHy9XvZTvogQ,13900
9
- google/genai/batches.py,sha256=Wi4Kptampp2WepAqv_AawwNCR6MKVhLKmzJdYXDQ_aE,37148
10
- google/genai/caches.py,sha256=YSzKMwnxbiwev9TqPlUjCvxq8-3Ez-LMqYZiI5eSE_M,53468
11
- google/genai/chats.py,sha256=NK3zHE64odk22TJYEY2ywFqsCxBiCGWfU17GQkavEPk,7643
12
- google/genai/client.py,sha256=HH_lYnjPOwW-4Vgynyw4K8cwurT2g578Dc51H_uk7GY,9244
13
- google/genai/errors.py,sha256=ZqJvfuJ7oS334WBrq3otzdZfmhEgcM1OBZhHccYzDok,3665
14
- google/genai/files.py,sha256=dn3q8P9aTN9OG3PtA4AYDs9hF6Uk-jkMjgAW7dSlt_4,35573
15
- google/genai/live.py,sha256=T-pOtq7k43wE2VjQzqLrx-kqhotS66I2PY_NHBdv9G8,22056
16
- google/genai/models.py,sha256=T-ElWMqfzzhpcVaOuiTlqrwyxNGhaTyO8eAWULDYxvc,155294
17
- google/genai/pagers.py,sha256=hSHd-gLvEzYWwK85i8EcFNWUMKtszUs7Nw2r3L7d6_U,6686
18
- google/genai/tunings.py,sha256=tFTSEaECKZ6xeYcxUTIKUmXqPoDymYP3eyTcEKjnPa4,49010
19
- google/genai/types.py,sha256=TclDP-B52YJHt7mxabOQY8M9Sd2IMHJgADcYWYVsvew,264243
20
- google_genai-0.3.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
21
- google_genai-0.3.0.dist-info/METADATA,sha256=yYY6ejmQZExyP6h__U0ihpstvnuMIOu_XpcmT1-eVck,19278
22
- google_genai-0.3.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
23
- google_genai-0.3.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
24
- google_genai-0.3.0.dist-info/RECORD,,