@@ -453,7 +453,7 @@ One way to think about different types of RAG evaluators is as a tuple of what i
453
453
STUDENT ANSWER: \$ {outputs.answer}\`
454
454
455
455
// Run evaluator
456
- const grade = graderLLM.invoke([{role: "system", content: correctnessInstructions}, {role: "user", content: answer}])\
456
+ const grade = graderLLM.invoke([{role: "system", content: correctnessInstructions}, {role: "user", content: answer}])
457
457
return grade.score
458
458
};
459
459
` ,
@@ -552,7 +552,7 @@ Without a reference answer we can't grade accuracy, but can still grade relevanc
552
552
STUDENT ANSWER: \$ {outputs.answer}\`
553
553
554
554
// Run evaluator
555
- const grade = relevanceLLM.invoke([{role: "system", content: relevanceInstructions}, {role: "user", content: answer}])\
555
+ const grade = relevanceLLM.invoke([{role: "system", content: relevanceInstructions}, {role: "user", content: answer}])
556
556
return grade.relevant
557
557
};
558
558
` ,
@@ -649,7 +649,7 @@ Another useful way to evaluate responses without needing reference answers is to
649
649
STUDENT ANSWER: \$ {outputs.answer}\`
650
650
651
651
// Run evaluator
652
- const grade = groundedLLM.invoke([{role: "system", content: groundedInstructions}, {role: "user", content: answer}])\
652
+ const grade = groundedLLM.invoke([{role: "system", content: groundedInstructions}, {role: "user", content: answer}])
653
653
return grade.grounded
654
654
};
655
655
` ,
@@ -750,7 +750,7 @@ Another useful way to evaluate responses without needing reference answers is to
750
750
QUESTION: \$ {inputs.question}\`
751
751
752
752
// Run evaluator
753
- const grade = retrievalRelevanceLLM.invoke([{role: "system", content: retrievalRelevanceInstructions}, {role: "user", content: answer}])\
753
+ const grade = retrievalRelevanceLLM.invoke([{role: "system", content: retrievalRelevanceInstructions}, {role: "user", content: answer}])
754
754
return grade.relevant
755
755
};
756
756
` ,
@@ -781,7 +781,7 @@ We can now kick off our evaluation job with all of our different evaluators.
781
781
typescript `
782
782
import { evaluate } from "langsmith/evaluation";
783
783
784
- const targetFunc = (input : Record<string, any>) => {
784
+ const targetFunc = (inputs : Record<string, any>) => {
785
785
return ragBot(inputs.question)
786
786
};
787
787
@@ -1251,7 +1251,7 @@ Here's a consolidated script with all the above code:
1251
1251
STUDENT ANSWER: \$ {outputs.answer}\`
1252
1252
1253
1253
// Run evaluator
1254
- const grade = graderLLM.invoke([{role: "system", content: correctnessInstructions}, {role: "user", content: answer}])\
1254
+ const grade = graderLLM.invoke([{role: "system", content: correctnessInstructions}, {role: "user", content: answer}])
1255
1255
return grade.score
1256
1256
};
1257
1257
@@ -1299,7 +1299,7 @@ Here's a consolidated script with all the above code:
1299
1299
STUDENT ANSWER: \$ {outputs.answer}\`
1300
1300
1301
1301
// Run evaluator
1302
- const grade = relevanceLLM.invoke([{role: "system", content: relevanceInstructions}, {role: "user", content: answer}])\
1302
+ const grade = relevanceLLM.invoke([{role: "system", content: relevanceInstructions}, {role: "user", content: answer}])
1303
1303
return grade.relevant
1304
1304
};
1305
1305
@@ -1348,7 +1348,7 @@ Here's a consolidated script with all the above code:
1348
1348
STUDENT ANSWER: \$ {outputs.answer}\`
1349
1349
1350
1350
// Run evaluator
1351
- const grade = groundedLLM.invoke([{role: "system", content: groundedInstructions}, {role: "user", content: answer}])\
1351
+ const grade = groundedLLM.invoke([{role: "system", content: groundedInstructions}, {role: "user", content: answer}])
1352
1352
return grade.grounded
1353
1353
};
1354
1354
@@ -1398,7 +1398,7 @@ Here's a consolidated script with all the above code:
1398
1398
QUESTION: \$ {inputs.question}\`
1399
1399
1400
1400
// Run evaluator
1401
- const grade = retrievalRelevanceLLM.invoke([{role: "system", content: retrievalRelevanceInstructions}, {role: "user", content: answer}])\
1401
+ const grade = retrievalRelevanceLLM.invoke([{role: "system", content: retrievalRelevanceInstructions}, {role: "user", content: answer}])
1402
1402
return grade.relevant
1403
1403
};
1404
1404
0 commit comments