提示是使用任何 Gemini 模型时的关键部分,您可以提示 Gemini 3 模型的新功能来帮助解决复杂问题并完成其他任务,例如解读大量文本、解决复杂的数学问题,甚至创建图片和视频。
本指南提供了各种提示策略,可帮助您在各种使用场景中充分利用 Gemini Enterprise Agent Platform 上的 Gemini 3。
温度调优
对于 Gemini 3,我们强烈建议将温度参数保留为默认值 1.0。
Gemini 3 的推理能力已针对默认温度设置进行了优化,不一定能从温度调优中受益。
更改温度(将其设置为低于 1.0)可能会导致意外行为、循环或性能下降,尤其是在复杂的数学或推理任务中。
提示策略
以下各部分介绍了可与 Gemini 3 模型搭配使用的各种提示策略。
缩短响应延迟时间
如需缩短响应延迟时间,请尝试将思考级别设置为 LOW,并使用 think silently 等系统指令。
区分演绎和外部信息
在某些情况下,提供 do not infer 或 do not guess 等开放式系统指令可能会导致模型过度关注该指令,而无法执行基本逻辑或算术运算,也无法综合文档不同部分中的信息。
与其使用大范围的否定性约束,不如明确告知模型使用提供的额外信息或上下文进行演绎,并避免使用外部知识。
示例
What was the profit? Do not infer.
此指令无效,因为 do not infer 指令过于宽泛。
You are expected to perform calculations and logical deductions based strictly
on the provided text. Do not introduce external information.
在此示例中,该指令明确指出模型应使用提供的上下文进行计算和推理。
使用分步验证
当模型遇到信息不足的主题(例如鲜为人知的地方)或被要求执行其不具备的功能(例如访问特定实际网址)时,可能会生成看似合理但不正确的信息,以尝试满足请求。
为避免这种情况,请将提示拆分为两个步骤:首先,验证信息或预期功能是否存在,然后根据该信息或功能生成答案。
示例
Verify with high confidence if you're able to access the New York Times home page.
If you cannot verify, state 'No Info' and STOP. If verified, proceed to generate
a response.
Query: Summarize the headlines from The New York Times today.
整理重要信息和约束
在处理足够复杂的请求时,如果否定性约束(关于不应执行的操作的具体指令)或格式或定量约束(例如字数统计等指令)在提示中出现得太早,模型可能会忽略这些约束。
为缓解此问题,请将核心请求和最重要的限制放在指令的最后一行。特别是,否定性约束应放在指令的末尾。结构良好的提示可能如下所示:
- [背景信息和素材]
- [主线任务指令]
- [否定性约束、格式约束和定量约束]
使用角色
模型旨在认真对待分配给它的角色,有时会忽略指令,以保持与所描述角色的契合度。在提示中使用角色时,请查看分配给模型的角色,并避免出现模棱两可的情况。
示例
You are a data extractor. You are forbidden from clarifying, explaining, or
expanding terms. Output text exactly as it appears. Do not explain why.
保持接地
模型可能会使用自己的知识来回答您的提示,这可能会与任何提供的上下文相冲突。虽然模型旨在提供帮助,但如果您提供与现实世界事实相矛盾的假设场景(使用 Crabs are fictional and have never existed. 等上下文进行提示),模型可能会恢复到其训练数据,而不是您的提示,以使其请求与现有信息保持一致。
如果您需要在没有现实世界信息作为依据的上下文中工作,请明确说明提供的上下文是当前会话的唯一可信来源。
示例
You are a strictly grounded assistant limited to the information provided in the
User Context. In your answers, rely **only** on the facts that are directly
mentioned in that context. You must **not** access or utilize your own knowledge
or common sense to answer. Do not assume or infer from the provided facts;
simply report them exactly as they appear. Your answer must be factual and
fully truthful to the provided text, leaving absolutely no room for speculation
or interpretation. Treat the provided context as the absolute limit of truth;
any facts or details that are not directly mentioned in the context must be
considered **completely untruthful** and **completely unsupported**. If the
exact answer is not explicitly written in the context, you must state that the
information is not available.
综合多个信息来源
当信息在上下文来源的多个位置呈现时,模型有时会在首次找到相关匹配项后停止处理其他信息。
处理大型数据集(例如整本书、代码库或长视频)时,请将具体指令或问题放在提示的末尾,即数据上下文之后。您还可以通过以 Based on the entire document above... 等短语开头来将模型的推理锚定到提供的数据。
示例指令
Based on the entire document above, provide a comprehensive answer. Synthesize
all relevant information from the text that pertains to the question's scenario.
引导输出详细程度
默认情况下,Gemini 3 模型不太冗长,旨在优先提供直接有效的答案。
如果您的使用场景需要更口语化的角色,您必须在提示中明确引导模型变得更健谈。
示例指令
Explain this as a friendly, talkative assistant.
后续步骤
- 试用 Gemini 3.1 Pro 简介 笔记本教程。
- 了解函数调用。
- 了解思考。