本页面介绍了如何使用 Vertex AI SDK 运行 Vertex AI RAG 引擎任务。
您也可以使用此笔记本 Vertex AI RAG Engine 简介进行操作。
所需的角色
Grant roles to your user account. Run the following command once for each of the following
IAM roles:
roles/aiplatform.user
gcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_IDENTIFIER" --role=ROLE
Replace the following:
PROJECT_ID
: your project ID.USER_IDENTIFIER
: the identifier for your user account—for example,myemail@example.com
.ROLE
: the IAM role that you grant to your user account.
准备 Google Cloud 控制台
如需使用 Vertex AI RAG 引擎,请执行以下操作:
在 Google Cloud 控制台中运行以下命令以设置项目。
gcloud config set {project}
运行此命令以授权您的登录。
gcloud auth application-default login
运行 Vertex AI RAG 引擎
将以下示例代码复制并粘贴到 Google Cloud 控制台中,以运行 Vertex AI RAG 引擎。
Python
如需了解如何安装或更新 Vertex AI SDK for Python,请参阅安装 Vertex AI SDK for Python。 如需了解详情,请参阅 Python API 参考文档。
后续步骤
- 如需详细了解该 RAG API,请参阅 Vertex AI RAG Engine API。
- 如需详细了解 RAG 的回答,请参阅 Vertex AI RAG Engine 的检索和生成输出。
- 如需了解 Vertex AI RAG Engine,请参阅 Vertex AI RAG Engine 概览。