from praisonaiagents.eval import Judge# Simple accuracy checkresult = Judge().run(output="4", expected="4", input="What is 2+2?")print(f"Score: {result.score}/10, Passed: {result.passed}")
Copy
import { Judge } from 'praisonai';// Simple accuracy checkconst result = await new Judge().run({ output: "4", expected: "4", input: "What is 2+2?"});console.log(`Score: ${result.score}/10, Passed: ${result.passed}`);
Copy
# Judge with expected outputpraisonai eval judge --input "The answer is 4" --expected "4"# Judge with criteriapraisonai eval judge --input "Hello, how can I help?" --criteria "Response is helpful"
from praisonaiagents.eval import Judgejudge = Judge()result = judge.run( output="Python is a high-level programming language", expected="Python is a programming language", input="What is Python?")print(f"Score: {result.score}/10")print(f"Reasoning: {result.reasoning}")
Copy
import { Judge } from 'praisonai';const judge = new Judge();const result = await judge.run({ output: "Python is a high-level programming language", expected: "Python is a programming language", input: "What is Python?"});console.log(`Score: ${result.score}/10`);console.log(`Reasoning: ${result.reasoning}`);
from praisonaiagents.eval import Judgejudge = Judge(criteria="Response is helpful, accurate, and concise")result = judge.run(output="Hello! I'm here to help you with any questions.")if result.passed: print("✅ Output meets criteria")else: print("❌ Output needs improvement") for suggestion in result.suggestions: print(f" • {suggestion}")
Copy
import { Judge } from 'praisonai';const judge = new Judge({ criteria: "Response is helpful, accurate, and concise"});const result = await judge.run({ output: "Hello! I'm here to help you with any questions."});if (result.passed) { console.log("✅ Output meets criteria");} else { console.log("❌ Output needs improvement"); result.suggestions.forEach(s => console.log(` • ${s}`));}
import asynciofrom praisonaiagents.eval import Judgeasync def evaluate_outputs(): judge = Judge(criteria="Response is helpful") outputs = [ "Hello! How can I help?", "I don't know.", "Let me help you with that!" ] results = await asyncio.gather(*[ judge.run_async(output=output) for output in outputs ]) for output, result in zip(outputs, results): print(f"{output[:30]}... → {result.score}/10")asyncio.run(evaluate_outputs())
Copy
import { Judge } from 'praisonai';async function evaluateOutputs() { const judge = new Judge({ criteria: "Response is helpful" }); const outputs = [ "Hello! How can I help?", "I don't know.", "Let me help you with that!" ]; const results = await Promise.all( outputs.map(output => judge.runAsync({ output })) ); outputs.forEach((output, i) => { console.log(`${output.slice(0, 30)}... → ${results[i].score}/10`); });}evaluateOutputs();