OpenAI-compatible client and system prompt
Whisper gives you accurate but messy text. Filler words, false starts, missing punctuation. The cleanup step sends that raw transcript to an LLM with a tight system prompt that says: remove filler, fix grammar, preserve meaning. The result is text a human actually wants to read.
Post-processing pipeline
From raw Whisper output to polished text.
You are a transcript editor. Transform raw transcripts into clear, concise text.
INSTRUCTIONS:
- Remove filler words (um, uh, like, you know, basically, actually, etc.)
- Remove redundant statements and rambling
- Fix grammar and speech-to-text errors
- Preserve key points, technical details, names, numbers, and action items
- Use proper punctuation and maintain the speaker's tone
Return ONLY the cleaned text with NO preamble.This is the default system prompt. Notice the explicit rule to preserve technical details and return only cleaned text. Without those guardrails, LLMs add commentary or drop important content.
from openai import OpenAI
self.llm_client = OpenAI(base_url=llm_base_url, api_key=llm_api_key)
self.llm_model = llm_model
# ... later, during cleanup:
response = self.llm_client.chat.completions.create(
model=self.llm_model,
messages=[
{'role': 'system', 'content': prompt_to_use},
{'role': 'user', 'content': text},
],
temperature=0.3,
max_tokens=200,
)temperature=0.3 keeps the model predictable and close to the source. max_tokens=200 caps runaway generations. Low temperature matters for cleanup because we want deterministic edits, not creative rewrites.
Temperature 0 is fully deterministic, which sounds perfect for cleanup. In practice, a tiny amount of randomness helps the model handle edge cases with a little tolerance for edge cases, especially with shorter prompts. 0.3 is the sweet spot for predictable edits without crumbling on awkward inputs.
Quiz: Quiz
Loading practice…