Google语义检索器示例错误:’Credentials’对象没有属性’universe_domain’

以下是创建服务账户和启用API的代码示例和步骤:

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

错误:

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_UNIVERSEAttributeError: 'Credentials' object has no attribute 'universe_domain'

回答:

您可以尝试升级Google Auth,看起来某些版本存在一些问题:

pip install --upgrade google-auth

参考问题:https://github.com/googleapis/google-cloud-python/issues/12254

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注