google-genai 1.19.0__tar.gz → 1.21.0__tar.gz

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.
Files changed (41) hide show
  1. {google_genai-1.19.0 → google_genai-1.21.0}/PKG-INFO +47 -1
  2. google_genai-1.19.0/google_genai.egg-info/PKG-INFO → google_genai-1.21.0/README.md +43 -31
  3. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_api_client.py +449 -137
  4. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_common.py +88 -1
  5. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_live_converters.py +174 -414
  6. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_replay_api_client.py +10 -9
  7. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_tokens_converters.py +81 -176
  8. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_transformers.py +19 -40
  9. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/batches.py +47 -64
  10. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/caches.py +132 -222
  11. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/chats.py +9 -14
  12. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/client.py +1 -1
  13. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/errors.py +32 -6
  14. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/files.py +89 -103
  15. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/live.py +15 -20
  16. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/live_music.py +4 -5
  17. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/models.py +412 -558
  18. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/operations.py +36 -68
  19. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/tokens.py +11 -6
  20. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/tunings.py +65 -113
  21. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/types.py +305 -92
  22. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/version.py +1 -1
  23. google_genai-1.19.0/README.md → google_genai-1.21.0/google_genai.egg-info/PKG-INFO +77 -0
  24. {google_genai-1.19.0 → google_genai-1.21.0}/google_genai.egg-info/requires.txt +4 -0
  25. {google_genai-1.19.0 → google_genai-1.21.0}/pyproject.toml +5 -1
  26. {google_genai-1.19.0 → google_genai-1.21.0}/LICENSE +0 -0
  27. {google_genai-1.19.0 → google_genai-1.21.0}/MANIFEST.in +0 -0
  28. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/__init__.py +0 -0
  29. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_adapters.py +0 -0
  30. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_api_module.py +0 -0
  31. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_automatic_function_calling_util.py +0 -0
  32. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_base_url.py +0 -0
  33. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_extra_utils.py +0 -0
  34. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_mcp_utils.py +0 -0
  35. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/_test_api_client.py +0 -0
  36. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/pagers.py +0 -0
  37. {google_genai-1.19.0 → google_genai-1.21.0}/google/genai/py.typed +0 -0
  38. {google_genai-1.19.0 → google_genai-1.21.0}/google_genai.egg-info/SOURCES.txt +0 -0
  39. {google_genai-1.19.0 → google_genai-1.21.0}/google_genai.egg-info/dependency_links.txt +0 -0
  40. {google_genai-1.19.0 → google_genai-1.21.0}/google_genai.egg-info/top_level.txt +0 -0
  41. {google_genai-1.19.0 → google_genai-1.21.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-genai
3
- Version: 1.19.0
3
+ Version: 1.21.0
4
4
  Summary: GenAI Python SDK
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License: Apache-2.0
@@ -25,8 +25,11 @@ Requires-Dist: google-auth<3.0.0,>=2.14.1
25
25
  Requires-Dist: httpx<1.0.0,>=0.28.1
26
26
  Requires-Dist: pydantic<3.0.0,>=2.0.0
27
27
  Requires-Dist: requests<3.0.0,>=2.28.1
28
+ Requires-Dist: tenacity<9.0.0,>=8.2.3
28
29
  Requires-Dist: websockets<15.1.0,>=13.0.0
29
30
  Requires-Dist: typing-extensions<5.0.0,>=4.11.0
31
+ Provides-Extra: aiohttp
32
+ Requires-Dist: aiohttp<4.0.0; extra == "aiohttp"
30
33
  Dynamic: license-file
31
34
 
32
35
  # Google Gen AI SDK
@@ -140,6 +143,49 @@ client = genai.Client(
140
143
  )
141
144
  ```
142
145
 
146
+ ### Faster async client option: Aiohttp
147
+
148
+ By default we use httpx for both sync and async client implementations. In order
149
+ to have faster performance, you may install `google-genai[aiohttp]`. In Gen AI
150
+ SDK we configure `trust_env=True` to match with the default behavior of httpx.
151
+ Additional args of `aiohttp.ClientSession.request()` ([see _RequestOptions args](https://github.com/aio-libs/aiohttp/blob/v3.12.13/aiohttp/client.py#L170)) can be passed
152
+ through the following way:
153
+
154
+ ```python
155
+
156
+ http_options = types.HttpOptions(
157
+ async_client_args={'cookies': ..., 'ssl': ...},
158
+ )
159
+
160
+ client=Client(..., http_options=http_options)
161
+ ```
162
+
163
+ ### Proxy
164
+
165
+ Both httpx and aiohttp libraries use `urllib.request.getproxies` from
166
+ environment variables. Before client initialization, you may set proxy (and
167
+ optional SSL_CERT_FILE) by setting the environment variables:
168
+
169
+
170
+ ```bash
171
+ export HTTPS_PROXY='http://username:password@proxy_uri:port'
172
+ export SSL_CERT_FILE='client.pem'
173
+ ```
174
+
175
+ If you need `socks5` proxy, httpx [supports](https://www.python-httpx.org/advanced/proxies/#socks) `socks5` proxy if you pass it via
176
+ args to `httpx.Client()`. You may install `httpx[socks]` to use it.
177
+ Then, you can pass it through the following way:
178
+
179
+ ```python
180
+
181
+ http_options = types.HttpOptions(
182
+ client_args={'proxy': 'socks5://user:pass@host:port'},
183
+ async_client_args={'proxy': 'socks5://user:pass@host:port'},,
184
+ )
185
+
186
+ client=Client(..., http_options=http_options)
187
+ ```
188
+
143
189
  ## Types
144
190
 
145
191
  Parameter types can be specified as either dictionaries(`TypedDict`) or
@@ -1,34 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: google-genai
3
- Version: 1.19.0
4
- Summary: GenAI Python SDK
5
- Author-email: Google LLC <googleapis-packages@google.com>
6
- License: Apache-2.0
7
- Project-URL: Homepage, https://github.com/googleapis/python-genai
8
- Classifier: Intended Audience :: Developers
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Operating System :: OS Independent
11
- Classifier: Programming Language :: Python
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: Programming Language :: Python :: 3.13
18
- Classifier: Topic :: Internet
19
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
- Requires-Python: >=3.9
21
- Description-Content-Type: text/markdown
22
- License-File: LICENSE
23
- Requires-Dist: anyio<5.0.0,>=4.8.0
24
- Requires-Dist: google-auth<3.0.0,>=2.14.1
25
- Requires-Dist: httpx<1.0.0,>=0.28.1
26
- Requires-Dist: pydantic<3.0.0,>=2.0.0
27
- Requires-Dist: requests<3.0.0,>=2.28.1
28
- Requires-Dist: websockets<15.1.0,>=13.0.0
29
- Requires-Dist: typing-extensions<5.0.0,>=4.11.0
30
- Dynamic: license-file
31
-
32
1
  # Google Gen AI SDK
33
2
 
34
3
  [![PyPI version](https://img.shields.io/pypi/v/google-genai.svg)](https://pypi.org/project/google-genai/)
@@ -140,6 +109,49 @@ client = genai.Client(
140
109
  )
141
110
  ```
142
111
 
112
+ ### Faster async client option: Aiohttp
113
+
114
+ By default we use httpx for both sync and async client implementations. In order
115
+ to have faster performance, you may install `google-genai[aiohttp]`. In Gen AI
116
+ SDK we configure `trust_env=True` to match with the default behavior of httpx.
117
+ Additional args of `aiohttp.ClientSession.request()` ([see _RequestOptions args](https://github.com/aio-libs/aiohttp/blob/v3.12.13/aiohttp/client.py#L170)) can be passed
118
+ through the following way:
119
+
120
+ ```python
121
+
122
+ http_options = types.HttpOptions(
123
+ async_client_args={'cookies': ..., 'ssl': ...},
124
+ )
125
+
126
+ client=Client(..., http_options=http_options)
127
+ ```
128
+
129
+ ### Proxy
130
+
131
+ Both httpx and aiohttp libraries use `urllib.request.getproxies` from
132
+ environment variables. Before client initialization, you may set proxy (and
133
+ optional SSL_CERT_FILE) by setting the environment variables:
134
+
135
+
136
+ ```bash
137
+ export HTTPS_PROXY='http://username:password@proxy_uri:port'
138
+ export SSL_CERT_FILE='client.pem'
139
+ ```
140
+
141
+ If you need `socks5` proxy, httpx [supports](https://www.python-httpx.org/advanced/proxies/#socks) `socks5` proxy if you pass it via
142
+ args to `httpx.Client()`. You may install `httpx[socks]` to use it.
143
+ Then, you can pass it through the following way:
144
+
145
+ ```python
146
+
147
+ http_options = types.HttpOptions(
148
+ client_args={'proxy': 'socks5://user:pass@host:port'},
149
+ async_client_args={'proxy': 'socks5://user:pass@host:port'},,
150
+ )
151
+
152
+ client=Client(..., http_options=http_options)
153
+ ```
154
+
143
155
  ## Types
144
156
 
145
157
  Parameter types can be specified as either dictionaries(`TypedDict`) or