Getting Started with Google Generative AI Using the Gen AI SDK Reviews

141720 reviews

good

Kuncha S. · Reviewed 27 دقيقة ago

Mateus B. · Reviewed حوالي ساعة واحدة ago

Manikandan N. · Reviewed حوالي ساعة واحدة ago

JAIGANESH S. · Reviewed حوالي ساعة واحدة ago

Farwa Z. · Reviewed حوالي ساعة واحدة ago

Dinod R. · Reviewed حوالي ساعتان ago

venkata ram sathvik a. · Reviewed حوالي ساعتان ago

SEAN C. · Reviewed حوالي ساعتان ago

Madhuri P. · Reviewed حوالي ساعتان ago

Ken P. · Reviewed حوالي ساعتان ago

Muhammad Z. · Reviewed حوالي 3 ساعات ago

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. · Reviewed حوالي 3 ساعات ago

Mihir R. · Reviewed حوالي 3 ساعات ago

somnath g. · Reviewed حوالي 3 ساعات ago

Travis J. · Reviewed حوالي 3 ساعات ago

Done

Rakesh K. · Reviewed حوالي 4 ساعات ago

Madhuri P. · Reviewed حوالي 4 ساعات ago

The course says beginner so I took up the course with a begginer mindset. However I do not feel this is a begiiner labs.

Krishn A. · Reviewed حوالي 4 ساعات ago

Harni K. · Reviewed حوالي 4 ساعات ago

Good Job

Faizan S. · Reviewed حوالي 4 ساعات ago

Awesome!

Mudasir Asim S. · Reviewed حوالي 4 ساعات ago

Kusala Krishna K. · Reviewed حوالي 4 ساعات ago

Srinivas S. · Reviewed حوالي 4 ساعات ago

I do understand you have said this course need to have python background, but it will be better to have notes that explains jargons on the side for people who is beginners. Thank you for the course again :)

Bessie M. · Reviewed حوالي 4 ساعات ago

Bhumika K. · Reviewed حوالي 4 ساعات ago

We do not ensure the published reviews originate from consumers who have purchased or used the products. Reviews are not verified by Google.