1. सीखें
  2. /
  3. पाठ्यक्रम
  4. /
  5. LangChain으로 배우는 Retrieval Augmented Generation (RAG)

Connected

अभ्यास

문자열 평가

이제 주제 전문가가 작성한 정답과 비교해 최종 출력을 제대로 평가해 볼 차례예요. LangSmith의 LangChainStringEvaluator 클래스를 사용해 문자열 비교 평가를 수행해요.

문자열 평가를 위한 prompt_template은 이미 다음과 같이 준비되어 있어요:

You are an expert professor specialized in grading students' answers to questions.
You are grading the following question:{query}
Here is the real answer:{answer}
You are grading the following predicted answer:{result}
Respond with CORRECT or INCORRECT:
Grade:

RAG 체인의 출력은 predicted_answer에, 전문가의 답변은 ref_answer에 저장되어 있어요.

필요한 클래스는 모두 임포트되어 있어요.

निर्देश

100 XP
  • 제공된 eval_llm과 prompt_template을 사용해 LangSmith QA 문자열 평가기를 생성하세요.
  • query에 대한 전문가의 응답(ref_answer)과 비교하여 RAG 출력인 predicted_answer를 평가하세요.