prompt-engineer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Prompt Engineer

提示词工程师

Expert in crafting effective prompts for LLMs.
专注于为LLM编写高效提示词的专家。

Core Techniques

核心技巧

Chain-of-Thought

Chain-of-Thought

Guide the model through reasoning steps.
Let's solve this step by step:
1. First, identify...
2. Then, analyze...
3. Finally, conclude...
引导模型逐步推理。
Let's solve this step by step:
1. First, identify...
2. Then, analyze...
3. Finally, conclude...

Few-Shot Learning

Few-Shot Learning

Provide examples to establish patterns.
Example 1:
Input: [example input]
Output: [example output]

Example 2:
Input: [example input]
Output: [example output]

Now process:
Input: [actual input]
提供示例以建立模式。
Example 1:
Input: [example input]
Output: [example output]

Example 2:
Input: [example input]
Output: [example output]

Now process:
Input: [actual input]

Role Prompting

Role Prompting

Establish expertise and perspective.
You are an expert [role] with deep experience in [domain].
Your task is to [specific objective].
设定专业身份与视角。
You are an expert [role] with deep experience in [domain].
Your task is to [specific objective].

Structured Output

Structured Output

Request specific formats.
Respond in the following JSON format:
{
  "field1": "description",
  "field2": ["array", "items"]
}
要求特定格式的输出。
Respond in the following JSON format:
{
  "field1": "description",
  "field2": ["array", "items"]
}

Prompt Structure

提示词结构

System Prompt Components

系统提示词组件

  1. Role: Who the AI is
  2. Context: Background information
  3. Task: What to do
  4. Constraints: Limitations and rules
  5. Output format: Expected structure
  1. 角色:AI的身份定位
  2. 上下文:背景信息
  3. 任务:需要完成的具体工作
  4. 约束条件:限制规则与边界
  5. 输出格式:预期的结果结构

Effective Patterns

有效模式

[Role and expertise]

[Context and background]

[Specific task instructions]

[Output format requirements]

[Examples if needed]

[Edge case handling]
[Role and expertise]

[Context and background]

[Specific task instructions]

[Output format requirements]

[Examples if needed]

[Edge case handling]

Optimization Strategies

优化策略

Clarity

清晰度

  • Use precise language
  • Avoid ambiguity
  • Define terms
  • 使用精准语言
  • 避免歧义表述
  • 明确定义术语

Specificity

明确性

  • Explicit instructions
  • Concrete examples
  • Clear boundaries
  • 给出显性指令
  • 提供具体示例
  • 划定清晰边界

Structure

结构性

  • Logical flow
  • Consistent formatting
  • Clear sections
  • 遵循逻辑流程
  • 保持格式一致
  • 划分清晰章节

Common Issues

常见问题

IssueSolution
HallucinationsAdd "If unsure, say so"
Wrong formatProvide explicit schema
Off-topicAdd "Stay focused on X"
Too verboseRequest concise responses
Missing contextAdd relevant background
问题解决方案
幻觉现象添加“若不确定,请直接说明”
格式错误提供明确的schema
偏离主题添加“请专注于X内容”
过于冗长要求简洁回复
缺少上下文补充相关背景信息

Testing Prompts

提示词测试

  1. Test with edge cases
  2. Measure consistency
  3. Check output format
  4. Validate accuracy
  5. Monitor in production
  1. 用边缘案例测试
  2. 衡量输出一致性
  3. 检查输出格式合规性
  4. 验证结果准确性
  5. 生产环境持续监控

Production Considerations

生产环境注意事项

  • Version control prompts
  • A/B test changes
  • Log inputs/outputs
  • Monitor quality metrics
  • Handle failures gracefully
  • 对提示词进行版本控制
  • 对变更进行A/B测试
  • 记录输入与输出数据
  • 监控质量指标
  • 优雅处理故障场景