教程:使用控制台执行评估

了解如何使用 Google Google Cloud 控制台开始使用 Gen AI Evaluation Service。

准备工作

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Make sure that you have the following role or roles on the project: Storage Admin

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      前往 IAM
    2. 选择项目。
    3. 点击 授予访问权限
    4. 新的主账号字段中,输入您的用户标识符。 这通常是 Google 账号的电子邮件地址。

    5. 选择角色列表中,选择一个角色。
    6. 如需授予其他角色,请点击 添加其他角色,然后添加其他各个角色。
    7. 点击 Save(保存)。
  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Make sure that you have the following role or roles on the project: Storage Admin

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      前往 IAM
    2. 选择项目。
    3. 点击 授予访问权限
    4. 新的主账号字段中,输入您的用户标识符。 这通常是 Google 账号的电子邮件地址。

    5. 选择角色列表中,选择一个角色。
    6. 如需授予其他角色,请点击 添加其他角色,然后添加其他各个角色。
    7. 点击 Save(保存)。
  8. 评估模型

    如需评估模型,请执行以下操作:

    1. 在 Google Cloud 控制台中,前往“生成式 AI 评估”页面。

      前往“评估”页面

    2. 点击新评估,打开评估页面。

    3. 定义评估数据集部分,选择一个选项:

      • 上传文件:点击上传以上传 CSV 或 JSONL 文件。数据集应包含提示或要在提示模板中使用的记录,以及可选的模型回答,最多 200 行。

      • 生成数据:输入提示模板,以指导 Gen AI Evaluation Service 生成数据集。您在提示模板中定义的变量会在数据集中生成并填充。如需了解详情,请参阅使用提示模板

        1. 定义要生成的变量:指定要生成的变量以及变量的说明,以指导生成。如果需要,请点击添加其他变量说明

        2. 输入要生成的样本数

        3. 点击生成并预览数据集,以显示根据提示模板和变量生成的数据集。如需调整数据集,您可以向变量说明中添加更多详细信息,然后点击重新生成

      • 使用模型日志:使用所选模型已记录流量中的提示和回答的快照。只有在 Vertex AI 中为已部署的模型启用请求-响应日志后,您才能使用此选项。如果您刚刚启用日志记录,请等待足够多的样本累积。

        1. 选择您要记录流量的模型区域。您必须已在所选模型和区域中启用日志记录。

        2. 输入抽样次数

        3. (可选)启用按提示模板过滤,以仅使用与提示模板匹配的日志。如果您将所选模型用于各种使用场景,并想评估某个特定使用场景,此功能会非常有用。

    4. 对于定义要评估的模型回答,请选择一个选项:

      • 来自数据集(仅当您为定义评估数据集选择上传文件时可用):如果您想使用上传的数据集中的某个字段作为回答,请选择一个回答列

      • 来自模型(仅当您为定义评估数据集选择使用模型日志时可用):如果您使用模型日志作为评估数据集,Gen AI Evaluation Service 会使用模型日志中的模型回答。

      • 调用模型:选择一个模型。Gen AI Evaluation Service 会在所选模型上运行提示,并使用回答进行评估。

    5. (可选)对于自动生成的评估指标,您可以指定自定义说明,以指导根据每个提示生成的评分准则。例如 Evaluate the dataset on cultural sensitivity to the countries {name}。如需了解详情,请参阅定义评估指标

    6. 名称和输出目录部分,输入以下内容:

      1. 评估名称:输入评估的名称。

      2. 输出私有数据路径:输入您要存储评估结果的 Cloud Storage 存储桶的名称,或点击“浏览”选择存储桶。

    7. 点击评估

    查看评估结果

    如需查看评估结果,请执行以下操作:

    1. 在 Google Cloud 控制台中,前往“生成式 AI 评估”页面。

      前往“评估”页面

    2. 点击评估名称。

    3. 对于评估数据集中的每个提示,模型的回答会与评估结果一起显示。

    后续步骤