google-genai 0.5.0__py3-none-any.whl → 0.7.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/_api_client.py +234 -131
- google/genai/_api_module.py +24 -0
- google/genai/_automatic_function_calling_util.py +43 -22
- google/genai/_common.py +37 -12
- google/genai/_extra_utils.py +25 -19
- google/genai/_replay_api_client.py +47 -35
- google/genai/_test_api_client.py +1 -1
- google/genai/_transformers.py +301 -51
- google/genai/batches.py +204 -165
- google/genai/caches.py +127 -144
- google/genai/chats.py +22 -18
- google/genai/client.py +32 -37
- google/genai/errors.py +1 -1
- google/genai/files.py +333 -165
- google/genai/live.py +16 -6
- google/genai/models.py +601 -283
- google/genai/tunings.py +91 -428
- google/genai/types.py +1190 -955
- google/genai/version.py +1 -1
- google_genai-0.7.0.dist-info/METADATA +1021 -0
- google_genai-0.7.0.dist-info/RECORD +26 -0
- google_genai-0.5.0.dist-info/METADATA +0 -888
- google_genai-0.5.0.dist-info/RECORD +0 -25
- {google_genai-0.5.0.dist-info → google_genai-0.7.0.dist-info}/LICENSE +0 -0
- {google_genai-0.5.0.dist-info → google_genai-0.7.0.dist-info}/WHEEL +0 -0
- {google_genai-0.5.0.dist-info → google_genai-0.7.0.dist-info}/top_level.txt +0 -0
google/genai/client.py
CHANGED
@@ -149,48 +149,43 @@ class Client:
|
|
149
149
|
):
|
150
150
|
"""Initializes the client.
|
151
151
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
only.
|
179
|
-
debug_config (DebugConfig):
|
180
|
-
Config settings that control network
|
181
|
-
behavior of the client. This is typically used when running test code.
|
182
|
-
http_options (Union[HttpOptions, HttpOptionsDict]):
|
183
|
-
Http options to use for the client. Response_payload can't be
|
184
|
-
set when passing to the client constructor.
|
152
|
+
Args:
|
153
|
+
vertexai (bool): Indicates whether the client should use the Vertex AI
|
154
|
+
API endpoints. Defaults to False (uses Gemini Developer API endpoints).
|
155
|
+
Applies to the Vertex AI API only.
|
156
|
+
api_key (str): The `API key
|
157
|
+
<https://ai.google.dev/gemini-api/docs/api-key>`_ to use for
|
158
|
+
authentication. Applies to the Gemini Developer API only.
|
159
|
+
credentials (google.auth.credentials.Credentials): The credentials to use
|
160
|
+
for authentication when calling the Vertex AI APIs. Credentials can be
|
161
|
+
obtained from environment variables and default credentials. For more
|
162
|
+
information, see `Set up Application Default Credentials
|
163
|
+
<https://cloud.google.com/docs/authentication/provide-credentials-adc>`_.
|
164
|
+
Applies to the Vertex AI API only.
|
165
|
+
project (str): The `Google Cloud project ID
|
166
|
+
<https://cloud.google.com/vertex-ai/docs/start/cloud-environment>`_ to
|
167
|
+
use for quota. Can be obtained from environment variables (for example,
|
168
|
+
``GOOGLE_CLOUD_PROJECT``). Applies to the Vertex AI API only.
|
169
|
+
location (str): The `location
|
170
|
+
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations>`_
|
171
|
+
to send API requests to (for example, ``us-central1``). Can be obtained
|
172
|
+
from environment variables. Applies to the Vertex AI API only.
|
173
|
+
debug_config (DebugConfig): Config settings that control network behavior
|
174
|
+
of the client. This is typically used when running test code.
|
175
|
+
http_options (Union[HttpOptions, HttpOptionsDict]): Http options to use
|
176
|
+
for the client. The field deprecated_response_payload should not be set
|
177
|
+
in http_options.
|
185
178
|
"""
|
186
179
|
|
187
180
|
self._debug_config = debug_config or DebugConfig()
|
188
181
|
|
189
|
-
# Throw ValueError if
|
190
|
-
#
|
191
|
-
|
182
|
+
# Throw ValueError if deprecated_response_payload is set in http_options
|
183
|
+
# due to unpredictable behavior when running multiple coroutines through
|
184
|
+
# client.aio.
|
185
|
+
if http_options and 'deprecated_response_payload' in http_options:
|
192
186
|
raise ValueError(
|
193
|
-
'Setting
|
187
|
+
'Setting deprecated_response_payload in http_options is not'
|
188
|
+
' supported.'
|
194
189
|
)
|
195
190
|
|
196
191
|
self._api_client = self._get_api_client(
|
google/genai/errors.py
CHANGED
@@ -114,7 +114,7 @@ class ServerError(APIError):
|
|
114
114
|
pass
|
115
115
|
|
116
116
|
|
117
|
-
class
|
117
|
+
class UnknownFunctionCallArgumentError(ValueError):
|
118
118
|
"""Raised when the function call argument cannot be converted to the parameter annotation."""
|
119
119
|
|
120
120
|
pass
|