System prompt best practices for consistent output formatting
Emma RodriguezFeb 10, 2025
I've spent months refining system prompts for consistent outputs across GPT-4o. Here's what I've learned:
Do's
... Don'ts
Template I use
You are a [role]. Your task is [task].
Rule 1
Rule 2
Always respond in this exact format:
[example]
What patterns have worked well for you?
4.1k views24 replies56 likes
3 Replies
This is incredibly helpful. How did you handle failures? Did you re-batch just the failed requests?
Yes, exactly. After each batch completes, I parse the output file and collect any failed request IDs, then create a new batch with just those. Usually only 1-2% fail so the retry batch is small.
failed_ids = [r['custom_id'] for r in results if r['response']['status_code'] != 200]
At our scale (500K+ docs/day), we've also found that splitting by document type gives better results since you can optimize the prompt per type.
Log in to reply to this topic.