在此快速入门中,您将使用 Vertex AI Studio 向 Gemini API 发送提示,而无需注册 Google Cloud 账号。Vertex AI Studio 提供多项功能,可让您设计、测试和管理 Google 的 Gemini 大语言模型 (LLM) 的提示。
在本快速入门中,您将执行以下操作:
- 向 Gemini API 发送自由格式的文本提示
- 查看用于生成回答的代码
所需的角色
Make sure that you have the following role or roles on the project: Vertex AI User
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
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.
- 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
-
In the Google Cloud console, go to the IAM page.
前往 IAM - 选择项目。
- 点击 授予访问权限。
-
在新的主账号字段中,输入您的用户标识符。 这通常是 Google 账号的电子邮件地址。
- 在选择角色列表中,选择一个角色。
- 如需授予其他角色,请点击 添加其他角色,然后添加其他各个角色。
- 点击 Save(保存)。
打开 Vertex AI Studio,然后点击创建提示:
在提示框中,输入
What are some possible names for a flower shop that sells bouquets of dried flowers?
。点击提交。
输出会显示在回答框中。
如需查看用于生成转写总结的 Vertex AI API 代码,请点击
获取代码。在获取代码面板中,您可以选择偏好的语言,以获取提示的代码示例。
- 请参阅提示设计简介。
- 了解如何设计文本提示和文字聊天提示。
- 了解如何流式传输来自模型的回复。
无需 Google Cloud 账号即可使用的功能
无需 Google Cloud 账号即可使用自由格式文本提示。 如果您是通过 Google Cloud 免费试用账号使用 Vertex AI Studio,或者根本就没有登录 Google Cloud,则某些功能将不可用,如下表所示。如要试用 Vertex AI Studio,您需要在 Google Cloud 控制台中接受 Vertex AI Studio 服务条款。
在没有 Google Cloud 账号的情况下使用 | 通过 Google Cloud 免费试用账号使用 | 通过现有 Google Cloud 账号使用 | |
---|---|---|---|
(需要登录) | 否 | 是 | 是 |
每分钟查询次数 (QPM) | 所有多模态模型一起 2 次查询/分钟 | 查看配额限制 | 查看配额限制 |
可获得的赠金 | $0 | 90 天最高 300 美元 | $0 |
提示库 | 否 | 是 | 是 |
提示设计工具 | 是 | 是 | 是 |
保存提示 | 否 | 是 | 是 |
提示历史记录 | 否 | 是 | 是 |
高级参数 | 否 | 否 | 是 |
调优 | 否 | 否 | 是 |
API 用量 | 否 | 是 | 是 |
需要启用结算功能 | 否 | 否 | 是 |
如何开始 | 前往 Vertex AI Studio | 注册以进行免费试用 | 在您的控制台中试用 Vertex AI Studio |
此快速入门指南提供了有关如何在没有账号的情况下访问 Vertex AI Studio 的说明。您还可以使用免费试用账号或现有账号完成本快速入门。
Vertex AI Studio 中的提示示例
提示是一条自然语言请求,提交到语言模型后,模型会生成回答。提示可以包含问题、说明、语境信息、少样本示例以及模型完成的部分输入。模型收到提示后,可以生成文本、嵌入、代码、图片、视频和音乐等,具体取决于所用的模型类型。
使用提示测试 Gemini
借助 Vertex AI Studio,您可以使用各种 Gemini 模型测试文本提示和多模态提示。在此部分中,您将创建一个文本提示,其中包含一项任务,即回答以下问题:“What are some possible names for a flower shop that sells bouquets of dried flowers?”