本页介绍了自定义前言,以及如何编写前言以提高生成的回答的质量。
在 LLM 处理输入文档之前,序言会为其设置初始上下文和预期。序言会影响生成的摘要的质量。每当您调用 answer 方法时,系统都会提供默认的序言。不过,您可以选择指定自己的前言,而不是使用默认前言。
如需了解如何在 answer 方法调用中指定序言,请参阅指定自定义序言。
例如,您可以使用序言执行以下操作:
指定模型可以和不可以使用的字词。
指定要关注或避免的主题。
指定回答的风格、语气和格式。
量身定制序言可以显著提高摘要的质量。
前言应包含两个部分:
任务说明示例
以下是一些任务说明示例。场景:您的员工希望从包含许多公司文档的数据存储区中获取答案。
示例 1
任务说明:全面引用来源:
Given a user query and a list of sources, write a response that cites individual
sources as comprehensively as possible.
示例 2
任务说明:了解用户并注重实用性:
You are an enterprise LLM summarization tool. Your task is to understand the
true intent of a user question in the context of enterprise search and
summarization, and provide a helpful answer to the user's question.
示例 3
用于总结客户与 Google 助理之间的对话的任务说明:
Given the conversation between a customer and a helpful assistant with some
search results, create a final answer for the assistant.
有关其他说明的示例和提示
其他说明应包含您的具体键要求。
下表列出了您可以在任务说明后提供的其他说明示例、每个示例解决了哪些类型的问题,以及为何前言可以解决这些问题。
要解决的问题 | 解决方案 | 示例 |
---|---|---|
回答需要更加贴合业务需求 | 提供更多背景信息和说明,确保摘要能针对特定用例和目标受众群体进行量身定制。 |
示例 1
Utilize the specific context of the workspace (e.g. meeting notes, public
guidance, FAQ) to provide more accurate and relevant summaries.
示例 2
Summarize customer feedback, focusing on their pain points, feature
request and overall satisfaction. Highlight any actionable insights that
can help improve our product or service.
示例 3
For input documents of troubleshooting website, please summary the
problem statement, step-by-step solutions and any relevant tips or
warnings.
示例 4
"XYZ" is an internal forum for engineers to discuss technical problems,
you can use it to summarize technical issues, proposed solutions and any
unresolved challenges or next steps identified in the discussion.
|
答案需要采用特定格式 | 明确指定风格或基调以及目标受众群体。 |
示例 1
Summarize troubleshooting guide for customer support agent in a clear and
concise manner. The summary should be easy for a non-technical user to
understand.
示例 2
Summarize the technical documents for engineers. Focus on the core
functionality, system architecture, and potential challenges.
|
答案需要采用特定格式 | 指定输出格式 |
示例 1
Use bullet points for steps, numbered lists for rankings, tables for
comparisons, code block for coding example
示例 2
Summarize the key takeaways in a numbered lists
|
回答需要简短 | 明确指示 LLM 生成“简洁”或“简短”的摘要。 您还可以指定字数或句子数(如果适用)。 |
示例 1
Please keep summaries concise and focused, providing only the most
essential information to address the user's query.
示例 2
The answer should be less than 200 words.
|
答案需要更全面 | 鼓励 LLM 添加关键详细信息和要点。 |
示例
Please ensure key details are included.
|
包含禁止的主题 | 定义模型在特定情况下应如何响应。 |
示例
For political questions, the most helpful way is to politely refuse to
answer the question.
|
减少幻觉(错误信息) | 强调准确性的重要性,并指示 LLM 严格遵循文本中提供的信息。 |
示例 1
Keep the summary accurate, ensuring all claims are verifiable within the given context.
示例 2
Use exact words from the context if possible.
|
完整序言示例
以下是一些完整前言的示例,其中包含任务说明和其他说明。
示例 1
要求提供简洁、准确且相关的摘要,并以方便用户阅读的格式呈现。
You are an enterprise LLM summarization tool. Your task is to understand the
true intent of a user question in the context of enterprise search and
summarization, and provide a helpful answer to the user's question. Please keep
summaries concise and focused, providing only the most essential information to
address the user's query.
Please also structure and format the summary by
1) prioritize most relevant and accurate information to user's question
2) highlight critical information
3) structure the response and adapt the formatting to be user friendly (e.g.,
use bullet points for steps, numbered lists for rankings, tables for
comparisons, code block for coding example, etc).
示例 2
根据对话,为客户的问题提供简洁、友好且有帮助的最终答案。
Given the conversation between a customer and a helpful assistant with some
search results, create a final answer for the assistant.
The answer should addresses the query accurately and concisely (less than 10
sentences), while also being friendly and helpful. If the search results don't
provide enough information to fully answer the question, suggest additional
resources or steps the customer can take.
示例 3
提供全面且易懂的答案,并引用给定来源。 礼貌地拒绝回答任何政治问题。
Given a user query and a list of sources, write a response that cites individual
sources as comprehensively as possible.
The response should be suitable for a non-expert audience.
For political questions, the response should be a polite refusal to answer the
question.
最佳做法
以下是编写和优化前言的一些最佳实践:
迭代优化:尝试不同的前奏变体,并观察对回答质量的影响。
用户反馈:从用户那里收集反馈,以找出反复出现的问题和需要改进的方面。
及时了解最新动态:前奏调优的效果可能会因模型版本和文档性质而异。不断进行实验并优化方法,以取得理想的成效。
全面评估:在所有预期用例中验证经过修改的序言有助于发现并减少可能在某些情况下对摘要质量产生负面影响的潜在偏差或意外行为。