Overview
The LLMJudge block uses AI (OpenAI GPT models) to evaluate responses semantically instead of using exact string matching.Requires
OPENAI_API_KEY environment variable. All other blocks work without it!Why LLM Judge?
AI responses are non-deterministic. These responses all mean the same thing:- “The meeting is at 2:00 PM”
- “Your meeting is scheduled for 2 PM”
- “I’ve set your meeting for 14:00”
- “Meeting confirmed for two in the afternoon”
Basic Usage
Input Parameters
The AI response text to evaluate
Tool calls made by the AI (if any)
What the AI should do
Conversation history for multi-turn conversations
Configuration
OpenAI model to use for judging. Options:
gpt-4o-mini(recommended, fast and cheap)gpt-4ogpt-4-turbo
Custom scoring criteria with weights (must sum to 1.0)Default criteria:
- accuracy: 0.4
- completeness”: 0.3
- relevance: 0.3
Whether the judge should suggest a next prompt for multi-turn testing
Max conversation turns when using
continueConversationOutput
Overall score from 0 to 1
Explanation of the score
Whether to continue the conversation (when using
continueConversation)Suggested next user message (when using
continueConversation)Detailed breakdown by criteria
Examples
Basic Semantic Validation
Validating Tool Calls
Multi-turn Conversation
judgement.shouldContinue is true, you can use judgement.nextPrompt to continue testing:
Custom Scoring Criteria
Cost Considerations
LLM Judge uses OpenAI API calls:| Model | Cost per 1K tokens | Typical cost per evaluation |
|---|---|---|
| gpt-4o-mini | $0.00015 | ~$0.001 |
| gpt-4o | $0.005 | ~$0.02 |
| gpt-4-turbo | $0.01 | ~$0.04 |
Best Practices
Be Specific in Expected Behavior
Be Specific in Expected Behavior
Use Constraints for Important Rules
Use Constraints for Important Rules
Set Reasonable Score Thresholds
Set Reasonable Score Thresholds
Combine with Other Validators
Combine with Other Validators
Use LLM Judge for semantic meaning, other validators for structure:
Understanding the Reasoning
The judge provides detailed reasoning:- Debug why tests fail
- Understand AI behavior
- Improve your prompts
Next Steps
AI Testing Guide
Complete guide to testing AI systems
ValidateTools Block
Validate AI tool calls

