提示词优化

提示词优化器

在不改变要求的前提下缩短并重构提示词。每次改写都会与原文核对,丢失需求的改写会被拒绝。

  • 免费
  • 经过验证的改写
  • 不调用模型

功能介绍

大多数提示词优化器把你的提示词交给另一个模型,再把结果原样返回。结果读起来可能不错,却悄悄丢了一条约束。PromptFlowEngine 反其道而行:它只应用一小组有文档说明的转换,然后证明结果仍然包含原文的全部内容。

共有三种模式。Conservative 规范空白并删除完全重复的句子。Balanced 还会删除冗词和客套话。Structured 在此基础上把提示词组织为 Task、Context、Requirements、Output format 和 Input 几个部分,并用标签包裹模板变量。

每种模式产生一个候选。只有当每个原始句子、每条提取出的需求以及每个受保护片段(代码、引文、URL、变量)都仍然存在,并且没有引入新的警告时,候选才会被保留。你可以选择目标:最少 token、最高质量或两者平衡。如果没有候选优于原文,就保留原文。

实际示例

前后对比

这次运行由引擎在构建页面时生成,使用 structured 模式和 balanced 目标。 引擎的检查结果和生成的提示词以英文显示,与引擎和 API 返回的内容完全一致。

原始版本

68 token · 77/100
Hello! I would like you to please rewrite the pull request description below so that it is clearer for reviewers. Please make sure to keep all of the technical details. Please make sure to keep all of the technical details. In order to help reviewers, add a 2-sentence summary at the top. Return markdown.

{{pr_description}}

优化后

72 token · 100/100
## Task
Rewrite the pull request description below so that it is clearer for reviewers.

## Context
To help reviewers, add a 2-sentence summary at the top.

## Requirements
- Make sure to keep all of the technical details.

## Output format
- Return markdown.

## Input
<pr_description>
{{pr_description}}
</pr_description>
  • Removed repeated sentencesRepetition costs tokens on every call and can over-weight one instruction.
  • Removed filler and politeness phrasesPhrases like "please", "basically", and "I would like you to" do not change the instruction.
  • Delimited template variablesWrapping interpolated input in tags keeps untrusted text from reading as instructions.
  • Organized into sectionsSeparating task, context, requirements, and output format makes each constraint explicit and scannable.

由引擎在构建本页面时计算得出。 token 变化 5.9%;修复了 3 个问题;0 项以建议形式留给你处理。Structured 模式可能会添加标题,因此 balanced 目标允许以少量 token 增加换取更高的分数。

主要优势

功能

适用人群

使用场景

常见问题

这和让 ChatGPT 改进我的提示词有什么不同?

模型会自由改写,可能增加、删除或重新解读指令。这个优化器只应用固定的转换,然后验证每个原始句子和需求都仍然存在。它的创意更少,但可预测得多。

优化后的提示词能得到更好的回答吗?

它会消除导致回答质量差的已知原因,例如重复、冗词和缺乏结构。它不运行提示词,因此无法衡量回答质量。对于重要场景,请用你的模型测试结果。

它适用于 Claude 和 Gemini 的提示词吗?

适用。这些转换关乎措辞和结构,对任何模型都成立。token 数对 OpenAI 模型是精确的,对其他服务商为近似值。

提示词中的代码会怎样?

代码块、行内代码、引文、URL 和模板变量会在任何转换之前被屏蔽,并在之后原样还原。

所有产品都运行同一个引擎,组合使用时不会出现意外差异。

了解背后的技巧

来自提示词工程知识中心的指南,讲解本产品所运用的理念。

用你自己的提示词试一试。

免费、确定性、保护隐私。无需注册。