prompt-engineer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePrompt 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
系统提示词组件
- Role: Who the AI is
- Context: Background information
- Task: What to do
- Constraints: Limitations and rules
- Output format: Expected structure
- 角色:AI的身份定位
- 上下文:背景信息
- 任务:需要完成的具体工作
- 约束条件:限制规则与边界
- 输出格式:预期的结果结构
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
常见问题
| Issue | Solution |
|---|---|
| Hallucinations | Add "If unsure, say so" |
| Wrong format | Provide explicit schema |
| Off-topic | Add "Stay focused on X" |
| Too verbose | Request concise responses |
| Missing context | Add relevant background |
| 问题 | 解决方案 |
|---|---|
| 幻觉现象 | 添加“若不确定,请直接说明” |
| 格式错误 | 提供明确的schema |
| 偏离主题 | 添加“请专注于X内容” |
| 过于冗长 | 要求简洁回复 |
| 缺少上下文 | 补充相关背景信息 |
Testing Prompts
提示词测试
- Test with edge cases
- Measure consistency
- Check output format
- Validate accuracy
- Monitor in production
- 用边缘案例测试
- 衡量输出一致性
- 检查输出格式合规性
- 验证结果准确性
- 生产环境持续监控
Production Considerations
生产环境注意事项
- Version control prompts
- A/B test changes
- Log inputs/outputs
- Monitor quality metrics
- Handle failures gracefully
- 对提示词进行版本控制
- 对变更进行A/B测试
- 记录输入与输出数据
- 监控质量指标
- 优雅处理故障场景