logo
P
Prompt Master

Prompt 大师

掌握和 AI 对话的艺术

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(中文)

  1. 明确 audience:
    code
    for a 10-year-old
    /
    code
    for a junior engineer
    /
    code
    for an exec
  2. 增加 constraints:必须包含 2-3 个关键点;必须避免某些术语;必须给一个例子
  3. 结构化输出:
    code
    Definition
    /
    code
    Mechanism
    /
    code
    Limitations
    /
    code
    Example
  4. code
    self-check
    :回答后再用一行列出 “omitted key points” 以便迭代

#Self-check rubric(中文)

  • 是否准确区分概念边界(例如 antibiotics 不适用于 viral infections)?
  • 是否压缩到指定长度(one sentence)?
  • 是否出现不必要的细节或编造(numbers/timelines)?

#Practice(中文)

练习:选 3 个你工作中常见的概念(例如

code
RAG
,
code
Tool Calling
,
code
Prompt Injection
),分别写 3 种版本:

  • one sentence
  • 5 bullets
  • 2x2 table(pros/cons vs when/not when)

#Prompt

markdown
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. Explain the above in one sentence:

#Code / API

#OpenAI (Python)

python
from 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)

python
import 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, )
1v1免费职业咨询