P
Prompt Master
Prompt Engineering 教程与提示词实战

从任务定义、示例和工作流到评测与安全边界

Prompt Engineering 教程与提示词实战Prompt Library

Invent new words

neologism prompt example

本章 Prompt 决定
01要解决的 Prompt 问题

neologism prompt example

02完成后带走

一份保留任务边界的可复用 Prompt、示例集、评测记录或安全规则。

03做到什么算完成

至少跑一个代表性样本,检查结果,并记录仍需人工复核的部分。

TL;DR(中文)

  • 这是一个 few-shot 风格的 creativity 测试:先给两个新词的定义与用例,再让模型照样生成新的句子(或继续造词)。
  • 适合用于:命名、品牌文案、产品术语、以及 “跟随示例格式” 的生成任务。
  • 关键是把 pattern 写清楚:definition → example sentence,并限制输出格式。

Background

This prompt tests an LLM's ability to create new words and use them in sentences.

How to Apply(中文)

你可以把它当成一个最小的 template learning:

  • 给 1-3 个 examples,展示你想要的 style 与格式
  • 明确输出:只要一个新词的定义 + 一个句子,或输出 N 组
  • 如果你用于品牌/产品命名,建议加 constraints(发音、长度、避免敏感词、避免商标冲突等)

How to Iterate(中文)

  1. 固定输出 schema:word / definition / example_sentence
  2. 加约束:词根/音节/语义领域(例如必须带 “-ify”)
  3. 加 negative examples:哪些词不要生成(太像已有词、难读、歧义)
  4. self-check:让模型解释这个新词为什么符合 pattern

Self-check rubric(中文)

  • 新词是否真的“新”(不是已有常见词)?
  • definition 是否清晰、无自相矛盾?
  • example sentence 是否自然且能体现含义?
  • 是否遵守格式与约束(长度、语气、领域)?

Practice(中文)

练习:把 “new words” 模式迁移到你业务里的输出格式:

  • word 换成 “feature name”
  • definition 换成 “one-line product description”
  • example sentence 换成 “in-app tooltip”

Prompt

A "whatpu" is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is:
We were traveling in Africa and we saw these very cute whatpus.

To do a "farduddle" means to jump up and down really fast. An example of a sentence that uses the word farduddle is:

Code / API

OpenAI (Python)

from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4",
    messages=[
        {
            "role": "user",
            "content": "A \"whatpu\" is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is:\nWe were traveling in Africa and we saw these very cute whatpus.\n\nTo do a \"farduddle\" means to jump up and down really fast. An example of a sentence that uses the word farduddle is:",
        }
    ],
    temperature=1,
    max_tokens=256,
    top_p=1,
    frequency_penalty=0,
    presence_penalty=0,
)

Fireworks (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": "A \"whatpu\" is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is:\nWe were traveling in Africa and we saw these very cute whatpus.\n\nTo do a \"farduddle\" means to jump up and down really fast. An example of a sentence that uses the word farduddle is:",
        }
    ],
    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,
)

Reference

📚 相关资源