Explain a concept
summarize/explain a concept for an audience
#TL;DR(中文)
- 解释/总结类任务最容易出问题的点是:不知道 “for whom / for what purpose”,导致输出泛泛而谈。
- 关键是把 audience、目标长度、格式(one sentence / bullets / table)写清楚。
- 在生产中建议加:输出 schema、禁用编造、以及简单 (是否覆盖关键点、是否超长)。code
evaluation
#Background
The following prompt tests an LLM's capabilities to explain or summarize concepts.
#How to Apply(中文)
这个 prompt 适合当“压缩表达能力”的 smoke test:
- 输入给模型一段概念说明
- 要求输出 “one sentence”
- 观察模型能否抓住主语、核心机制、边界条件(例如 antibiotics vs viruses)
#How to Iterate(中文)
- 明确 audience:/code
for a 10-year-old/codefor a junior engineercodefor an exec - 增加 constraints:必须包含 2-3 个关键点;必须避免某些术语;必须给一个例子
- 结构化输出:/code
Definition/codeMechanism/codeLimitationscodeExample - 加 :回答后再用一行列出 “omitted key points” 以便迭代code
self-check
#Self-check rubric(中文)
- 是否准确区分概念边界(例如 antibiotics 不适用于 viral infections)?
- 是否压缩到指定长度(one sentence)?
- 是否出现不必要的细节或编造(numbers/timelines)?
#Practice(中文)
练习:选 3 个你工作中常见的概念(例如
RAGTool CallingPrompt Injection- one sentence
- 5 bullets
- 2x2 table(pros/cons vs when/not when)
#Prompt
markdownAntibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance. Explain the above in one sentence:
#Code / API
#OpenAI (Python)
pythonfrom openai import OpenAI client = OpenAI() response = client.chat.completions.create( model="gpt-4", messages=[ { "role": "user", "content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:", } ], temperature=1, max_tokens=250, top_p=1, frequency_penalty=0, presence_penalty=0, )
#Fireworks (Python)
pythonimport fireworks.client fireworks.client.api_key = "<FIREWORKS_API_KEY>" completion = fireworks.client.ChatCompletion.create( model="accounts/fireworks/models/mixtral-8x7b-instruct", messages=[ { "role": "user", "content": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\n\nExplain the above in one sentence:", } ], stop=["<|im_start|>", "<|im_end|>", "<|endoftext|>"], stream=True, n=1, top_p=1, top_k=40, presence_penalty=0, frequency_penalty=0, prompt_truncate_len=1024, context_length_exceeded_behavior="truncate", temperature=0.9, max_tokens=4000, )