Skip to content

Commit e995aaf

Browse files
authored
Merge pull request #589 from AssemblyAI/devin/1769972669-prompt-engineering-update
Update prompt engineering docs with restructured content and new sections
2 parents ef43639 + 84f5db6 commit e995aaf

File tree

2 files changed

+324
-386
lines changed

2 files changed

+324
-386
lines changed

fern/assets/components/PromptGenerator.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ const HELP_ARTICLE_URL = "https://www.assemblyai.com/docs/speech-to-text/pre-rec
66
const LLM_CONTEXT = `You are an expert at crafting prompts for AssemblyAI's Universal-3-Pro speech transcription model. Based on the user's transcript sample and their description of desired output, generate an optimized transcription prompt.
77
88
Key principles for effective prompts:
9-
1. Use authoritative language: "Non-negotiable:", "Mandatory:", "Strict requirement:"
10-
2. Include explicit examples in format: (correct over incorrect) - NEVER use "not" in examples
11-
3. Keep prompts concise: 3-5 instructions, 50-100 words
12-
4. Show error patterns the model should fix (vowel substitution, sound-alike confusion, etc.)
13-
5. AVOID negative instructions - never use "not", "never", "avoid", "optional" as these confuse the model and cause hallucinations
14-
6. The model is multilingual and supports code switching when language_detection is True
159
16-
Generate a prompt that follows this structure:
17-
[Base instruction based on desired output style]
18-
[Authoritative language] + [Specific instruction] + [2-3 explicit examples using "over" format]
10+
What helps:
11+
- Authoritative language (Massive impact): Use "Mandatory:", "Non-negotiable:", "Required:"
12+
- 3-6 instructions maximum (Massive impact): Prevents conflicting instructions
13+
- Desired output examples (High impact): e.g., "Use proper medical medication names (omeprazole)"
14+
- Explicit disfluency examples (High impact): e.g., "(um, uh, like, you know)"
1915
20-
Analyze the transcript sample to identify domain-specific terminology that might be misheard and create appropriate examples. Use the user's description to understand what output format and accuracy they need.`;
16+
What hurts:
17+
- Negative language (Severe impact): "Don't", "never", "avoid" confuse the model
18+
- Conflicting instructions (Severe impact): e.g., "Include disfluencies" + "clean grammar"
19+
- Short, vague instructions (High impact): Lack specificity for model to learn from
20+
- Missing disfluency instructions (High impact): Model defaults to readable transcription
21+
22+
Analyze the transcript sample and user's desired output to generate a prompt optimized for Universal-3-Pro and this audio sample. Detailed best practices can be found at https://www.assemblyai.com/docs/speech-to-text/pre-recorded-audio/prompt-engineering and this URL should be looked up live for all up to date best practices.`;
2123

2224
// Limit transcript to approximately 1000 words (roughly 6000 characters)
2325
const MAX_TRANSCRIPT_CHARS = 6000;
@@ -103,9 +105,7 @@ User's transcript sample:
103105
${transcriptText}
104106
105107
User's description of desired output:
106-
${instructionsText}
107-
108-
IMPORTANT: Please generate an optimized transcription prompt based on the transcript sample and user's instructions. Use "over" instead of "not" in all examples (e.g., "omeprazole over omeprizole"). For detailed best practices, check the help article: ${HELP_ARTICLE_URL}`;
108+
${instructionsText}`;
109109
};
110110

111111
const getMaxContentLength = (baseUrl: string) => {

0 commit comments

Comments
 (0)