错误如下:DefaultCredentialsError: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings…
解决方法:点击链接,根据要求安装 gcloud CLI
运行gcloud auth application-default login
中间报错,”因为在此系统上禁止运行脚本“,使用命令set-ExecutionPolicy RemoteSigned
哈哈结果还是报错
继续看文档,使用
gcloud auth application-default login --impersonate-service-account SERVICE_ACCT_EMAIL
创建json文件
哈哈新错误
Deadline of 60.0s exceeded while calling target function, last exception: 503 failed to connect to all addresses;
解决方法
genai.configure(api_key= f"{GOOGLE_API_KEY}", transport=“rest”)github给出得方法
??就这样吧
使用魔法后的新错误
(‘Unable to acquire impersonated credentials’, ‘{\n “error”: {\n “code”: 400,\n “message”: “Invalid form of account ID SERVICE_ACCT_EMAIL. Should be [Gaia ID |Email |Unique ID |] of the account”,\n “status”: “INVALID_ARGUMENT”\n }\n}\n’)