Відгуки: Getting Started with Google Generative AI Using the Gen AI SDK

1 відгук

JAIGANESH S. · Відгук надано 14 хвилин тому

sreenidhi b. · Відгук надано 23 хвилини тому

Super

Yuvateja Sainadh K. · Відгук надано 25 хвилин тому

Joytri M. · Відгук надано 26 хвилин тому

Rohini kumari G. · Відгук надано 29 хвилин тому

Ritik G. · Відгук надано 35 хвилин тому

KEVIN LEONEL H. · Відгук надано 37 хвилин тому

German P. · Відгук надано близько 1 години тому

P S. · Відгук надано близько 1 години тому

Krishna M. · Відгук надано близько 1 години тому

Anil K. · Відгук надано близько 1 години тому

good

Kuncha S. · Відгук надано близько 2 годин тому

Mateus B. · Відгук надано близько 2 годин тому

Manikandan N. · Відгук надано близько 3 годин тому

JAIGANESH S. · Відгук надано близько 3 годин тому

Farwa Z. · Відгук надано близько 3 годин тому

Dinod R. · Відгук надано близько 3 годин тому

venkata ram sathvik a. · Відгук надано близько 3 годин тому

SEAN C. · Відгук надано близько 3 годин тому

Madhuri P. · Відгук надано близько 4 годин тому

Ken P. · Відгук надано близько 4 годин тому

Muhammad Z. · Відгук надано близько 4 годин тому

this error is always seen when running -------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[54], line 1 ----> 1 response = client.models.generate_content( 2 model=MODEL_ID, contents="What's the largest planet in our solar system?" 3 ) 5 print(response.text) File /opt/conda/lib/python3.10/site-packages/google/genai/models.py:6276, in Models.generate_content(self, model, contents, config) 6274 while remaining_remote_calls_afc > 0: 6275 i += 1 -> 6276 response = self._generate_content( 6277 model=model, contents=contents, config=parsed_config 6278 ) 6280 function_map = _extra_utils.get_function_map(parsed_config) 6281 if not function_map: File /opt/conda/lib/python3.10/site-packages/google/genai/models.py:4730, in Models._generate_content(self, model, contents, config) 4727 request_dict = _common.convert_to_dict(request_dict) 4728 request_dict = _common.encode_unserializable_types(request_dict) -> 4730 response = self._api_client.request( 4731 'post', path, request_dict, http_options 4732 ) 4734 if config is not None and getattr( 4735 config, 'should_return_http_response', None 4736 ): 4737 return_value = types.GenerateContentResponse(sdk_http_response=response) File /opt/conda/lib/python3.10/site-packages/google/genai/_api_client.py:1537, in BaseApiClient.request(self, http_method, path, request_dict, http_options) 1527 def request( 1528 self, 1529 http_method: str, (...) 1532 http_options: Optional[HttpOptionsOrDict] = None, 1533 ) -> SdkHttpResponse: 1534 http_request = self._build_request( 1535 http_method, path, request_dict, http_options 1536 ) -> 1537 response = self._request(http_request, http_options, stream=False) 1538 response_body = ( 1539 response.response_stream[0] if response.response_stream else '' 1540 ) 1541 return SdkHttpResponse(headers=response.headers, body=response_body) File /opt/conda/lib/python3.10/site-packages/google/genai/_api_client.py:1332, in BaseApiClient._request(self, http_request, http_options, stream) 1329 retry = tenacity.Retrying(**retry_kwargs) 1330 return retry(self._request_once, http_request, stream) # type: ignore[no-any-return] -> 1332 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:1261, in BaseApiClient._request_once(self, http_request, stream) 1259 # If using proj/location, fetch ADC 1260 if self.vertexai and (self.project or self.location): -> 1261 http_request.headers['Authorization'] = f'Bearer {self._access_token()}' 1262 if self._credentials and self._credentials.quota_project_id: 1263 http_request.headers['x-goog-user-project'] = ( 1264 self._credentials.quota_project_id 1265 ) File /opt/conda/lib/python3.10/site-packages/google/genai/_api_client.py:1089, in BaseApiClient._access_token(self) 1087 with self._sync_auth_lock: 1088 if not self._credentials: -> 1089 self._credentials, project = load_auth(project=self.project) 1090 if not self.project: 1091 self.project = project File /opt/conda/lib/python3.10/site-packages/google/genai/_api_client.py:192, in load_auth(project) 190 def load_auth(*, project: Union[str, None]) -> Tuple[Credentials, str]: 191 """Loads google auth credentials and project id.""" --> 192 credentials, loaded_project_id = google.auth.default( # type: ignore[no-untyped-call] 193 scopes=['https://www.googleapis.com/auth/cloud-platform'], 194 ) 196 if not project: 197 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) 696 from google.auth.credentials import CredentialsWithQuotaProject 698 explicit_project_id = os.environ.get( 699 environment_vars.PROJECT, os.environ.get(environment_vars.LEGACY_PROJECT) 700 ) 702 checkers = ( 703 # Avoid passing scopes here to prevent passing scopes to user credentials. 704 # with_scopes_if_required() below will ensure scopes/default scopes are --> 705 # safely set on the returned credentials since requires_scopes will 706 # guard against setting scopes on user credentials. 707 lambda: _get_explicit_environ_credentials(quota_project_id=quota_project_id), 708 lambda: _get_gcloud_sdk_credentials(quota_project_id=quota_project_id), 709 _get_gae_credentials, 710 lambda: _get_gce_credentials(request, quota_project_id=quota_project_id), 711 ) 713 for checker in checkers: 714 credentials, project_id = checker() 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 """Gets credentials and project ID from the GCE Metadata Service.""" 392 # While this library is normally bundled with compute_engine, there are 393 # some cases where it's not available, so we tolerate ImportError. 394 # Compute Engine requires optional `requests` dependency. --> 395 try: 396 from google.auth import compute_engine 397 from google.auth.compute_engine import _metadata 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'

JAIGANESH S. · Відгук надано близько 4 годин тому

Mihir R. · Відгук надано близько 4 годин тому

somnath g. · Відгук надано близько 4 годин тому

Ми не гарантуємо, що опубліковані відгуки написали клієнти, які придбали продукти чи скористалися ними. Відгуки не перевіряються Google.