1. Learn
  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 स्ट्रिंग इवैल्युएटर बनाएँ.
  • RAG आउटपुट predicted_answer का इवैल्युएशन करें: query के लिए विशेषज्ञ के उत्तर, जो ref_answer में स्टोर है, से तुलना करके.