Premiers pas avec l'IA générative de Google à l'aide du SDK Gen AI avis
140725 avis
SHIVARAM PRASAD M. · Examiné il y a 6 jours
Caleb H. · Examiné il y a 6 jours
Navatej V. · Examiné il y a 6 jours
Marcelo d. · Examiné il y a 6 jours
احمد ي. · Examiné il y a 6 jours
guillermo o. · Examiné il y a 6 jours
SHIVARAM PRASAD M. · Examiné il y a 6 jours
Rendla S. · Examiné il y a 6 jours
Rithviksai B. · Examiné il y a 6 jours
Jonathan P. · Examiné il y a 6 jours
YES
Samanvi Reddy G. · Examiné il y a 6 jours
Susmitha S. · Examiné il y a 6 jours
BANOTH A. · Examiné il y a 6 jours
Rishikesh G. · Examiné il y a 6 jours
Shraddha Shashikant P. · Examiné il y a 7 jours
Tirthankar B. · Examiné il y a 7 jours
Meena R. · Examiné il y a 7 jours
Aung Nyi T. · Examiné il y a 7 jours
Tejaswini G. · Examiné il y a 7 jours
bugs that I cannot debug myself. almost each tyme I try to execute code, I see an error message: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[41], line 1 ----> 1 response = client.models.embed_content( 2 model=TEXT_EMBEDDING_MODEL_ID, 3 contents=[ 4 "How do I get a driver's license/learner's permit?", 5 "How do I renew my driver's license?", 6 "How do I change my address on my driver's license?", 7 ], 8 config=EmbedContentConfig(output_dimensionality=128), 9 ) 11 print(response.embeddings) File /opt/conda/lib/python3.10/site-packages/google/genai/models.py:5742, in Models.embed_content(self, model, contents, config) 5734 return self._embed_content( 5735 model=model, 5736 contents=None, (...) 5739 config=config, 5740 ) 5741 else: -> 5742 return self._embed_content( 5743 model=model, 5744 content=None, 5745 contents=contents, 5746 embedding_api_type=types.EmbeddingApiType.PREDICT, 5747 config=config, 5748 ) File /opt/conda/lib/python3.10/site-packages/google/genai/models.py:4725, in Models._embed_content(self, model, contents, content, embedding_api_type, config) 4722 request_dict = _common.convert_to_dict(request_dict) 4723 request_dict = _common.encode_unserializable_types(request_dict) -> 4725 response = self._api_client.request( 4726 'post', path, request_dict, http_options 4727 ) 4729 response_dict = {} if not response.body else json.loads(response.body) 4731 if self._api_client.vertexai: File /opt/conda/lib/python3.10/site-packages/google/genai/_api_client.py:1402, in BaseApiClient.request(self, http_method, path, request_dict, http_options) 1392 def request( 1393 self, 1394 http_method: str, (...) 1397 http_options: Optional[HttpOptionsOrDict] = None, 1398 ) -> SdkHttpResponse: 1399 http_request = self._build_request( 1400 http_method, path, request_dict, http_options 1401 ) -> 1402 response = self._request(http_request, http_options, stream=False) 1403 response_body = ( 1404 response.response_stream[0] if response.response_stream else '' 1405 ) 1406 return SdkHttpResponse(headers=response.headers, body=response_body) File /opt/conda/lib/python3.10/site-packages/google/genai/_api_client.py:1238, in BaseApiClient._request(self, http_request, http_options, stream) 1235 retry = tenacity.Retrying(**retry_kwargs) 1236 return retry(self._request_once, http_request, stream) # type: ignore[no-any-return] -> 1238 return self._retry(self._request_once, http_request, stream) File /opt/conda/lib/python3.10/site-packages/tenacity/__init__.py:470, in Retrying.__call__(self, fn, *args, **kwargs) 468 retry_state = RetryCallState(retry_object=self, fn=fn, args=args, kwargs=kwargs) 469 while True: --> 470 do = self.iter(retry_state=retry_state) 471 if isinstance(do, DoAttempt): 472 try: File /opt/conda/lib/python3.10/site-packages/tenacity/__init__.py:371, in BaseRetrying.iter(self, retry_state) 369 result = None 370 for action in self.iter_state.actions: --> 371 result = action(retry_state) 372 return result File /opt/conda/lib/python3.10/site-packages/tenacity/__init__.py:413, in BaseRetrying._post_stop_check_actions.<locals>.exc_check(rs) 411 retry_exc = self.retry_error_cls(fut) 412 if self.reraise: --> 413 raise retry_exc.reraise() 414 raise retry_exc from fut.exception() File /opt/conda/lib/python3.10/site-packages/tenacity/__init__.py:184, in RetryError.reraise(self) 182 def reraise(self) -> t.NoReturn: 183 if self.last_attempt.failed: --> 184 raise self.last_attempt.result() 185 raise self File /opt/conda/lib/python3.10/concurrent/futures/_base.py:451, in Future.result(self, timeout) 449 raise CancelledError() 450 elif self._state == FINISHED: --> 451 return self.__get_result() 453 self._condition.wait(timeout) 455 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: File /opt/conda/lib/python3.10/concurrent/futures/_base.py:403, in Future.__get_result(self) 401 if self._exception: 402 try: --> 403 raise self._exception 404 finally: 405 # Break a reference cycle with the exception in self._exception 406 self = None File /opt/conda/lib/python3.10/site-packages/tenacity/__init__.py:473, in Retrying.__call__(self, fn, *args, **kwargs) 471 if isinstance(do, DoAttempt): 472 try: --> 473 result = fn(*args, **kwargs) 474 except BaseException: # noqa: B902 475 retry_state.set_exception(sys.exc_info()) # type: ignore[arg-type] File /opt/conda/lib/python3.10/site-packages/google/genai/_api_client.py:1181, in BaseApiClient._request_once(self, http_request, stream) 1179 # If using proj/location, fetch ADC 1180 if self.vertexai and (self.project or self.location): -> 1181 http_request.headers['Authorization'] = f'Bearer {self._access_token()}' 1182 if self._credentials and self._credentials.quota_project_id: 1183 http_request.headers['x-goog-user-project'] = ( 1184 self._credentials.quota_project_id 1185 ) File /opt/conda/lib/python3.10/site-packages/google/genai/_api_client.py:1009, in BaseApiClient._access_token(self) 1007 with self._sync_auth_lock: 1008 if not self._credentials: -> 1009 self._credentials, project = load_auth(project=self.project) 1010 if not self.project: 1011 self.project = project File /opt/conda/lib/python3.10/site-packages/google/genai/_api_client.py:191, in load_auth(project) 185 ## Set GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES to false 186 ## to disable bound token sharing. Tracking on 187 ## https://github.com/googleapis/python-genai/issues/1956 188 os.environ['GOOGLE_API_PREVENT_AGENT_TOKEN_SHARING_FOR_GCP_SERVICES'] = ( 189 'false' 190 ) --> 191 credentials, loaded_project_id = google.auth.default( # type: ignore[no-untyped-call] 192 scopes=['https://www.googleapis.com/auth/cloud-platform'], 193 ) 195 if not project: 196 project = loaded_project_id File /opt/conda/lib/python3.10/site-packages/google/auth/_default.py:705, in default(scopes, request, quota_project_id, default_scopes) 0 <Error retrieving source code with stack_data see ipython/ipython#13598> File /opt/conda/lib/python3.10/site-packages/google/auth/_default.py:701, in <lambda>() 0 <Error retrieving source code with stack_data see ipython/ipython#13598> File /opt/conda/lib/python3.10/site-packages/google/auth/_default.py:395, in _get_gce_credentials(request, quota_project_id) 391 def _get_gce_credentials(request=None, quota_project_id=None): 392 """Gets credentials and project ID from the GCE Metadata Service.""" 393 # Ping requires a transport, but we want application default credentials 394 # to require no arguments. So, we'll use the _http_client transport which --> 395 # uses http.client. This is only acceptable because the metadata server 396 # doesn't do SSL and never requires proxies. 397 398 # While this library is normally bundled with compute_engine, there are 399 # some cases where it's not available, so we tolerate ImportError. 400 try: 401 from google.auth import compute_engine File /opt/conda/lib/python3.10/site-packages/google/auth/compute_engine/__init__.py:17 1 # Copyright 2016 Google LLC 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); (...) 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 15 """Google Compute Engine authentication.""" ---> 17 from google.auth.compute_engine._metadata import detect_gce_residency_linux 18 from google.auth.compute_engine.credentials import Credentials 19 from google.auth.compute_engine.credentials import IDTokenCredentials File /opt/conda/lib/python3.10/site-packages/google/auth/compute_engine/_metadata.py:100 97 # Timeout in seconds to wait for the GCE metadata server when detecting the 98 # GCE environment. 99 try: --> 100 _METADATA_DEFAULT_TIMEOUT = int(os.getenv(environment_vars.GCE_METADATA_TIMEOUT, 3)) 101 except ValueError: # pragma: NO COVER 102 _METADATA_DEFAULT_TIMEOUT = 3 AttributeError: module 'google.auth.environment_vars' has no attribute 'GCE_METADATA_TIMEOUT'
Aliaksei K. · Examiné il y a 7 jours
gleiton v. · Examiné il y a 7 jours
Phakphoom C. · Examiné il y a 7 jours
Anil R. · Examiné il y a 7 jours
Oakar O. · Examiné il y a 7 jours
Phichaya T. · Examiné il y a 7 jours
Nous ne pouvons pas certifier que les avis publiés proviennent de consommateurs qui ont acheté ou utilisé les produits. Les avis ne sont pas vérifiés par Google.