google-cloud-platformnlpartificial-intelligencelarge-language-modelgoogle-ai-platform

Google semantic retriever example error 'Credentials' object has no attribute 'universe_domain'


Here is the code example and steps to create service account and enable API:

https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/docs/semantic_retriever.ipynb

Error:

AttributeError                            Traceback (most recent call last)
<ipython-input-20-ee7d7add68db> in <cell line: 8>()
      6 
      7 # Make the request
----> 8 create_corpus_response = retriever_service_client.create_corpus(create_corpus_request)
      9 
     10 # Set the `corpus_resource_name` for subsequent sections.

2 frames
/usr/local/lib/python3.10/dist-packages/google/ai/generativelanguage_v1beta/services/retriever_service/client.py in _compare_universes(client_universe, credentials)
    514         """
    515         if credentials:
--> 516             credentials_universe = credentials.universe_domain
    517             if client_universe != credentials_universe:
    518                 default_universe = RetrieverServiceClient._DEFAULT_UNIVERSE

AttributeError: 'Credentials' object has no attribute 'universe_domain'

Solution

  • Can you try upgrading your Google Auth it appears that it has some issues with the some of the versions:

    pip install --upgrade google-auth
    

    Reference Issue: https://github.com/googleapis/google-cloud-python/issues/12254