11. Groundedness (Halucination) Assessment
Evaluator that evaluates whether an answer is correct based on a given context.
This Evaluator can be used to evaluate Hallucination for RAG's answer.
In this tutorial, we will look at how to evaluate Groundedness by utilizing the Upstage Groundness Checker and the Groundness Checker created by the job custom.
Copy
# installation
# !pip install -qU langsmith langchain-teddynoteCopy
# Configuration file for managing API KEY as environment variable
from dotenv import load_dotenv
# Load API KEY information
load_dotenv()Copy
True Copy
# Set up LangSmith tracking. https://smith.langchain.com
# !pip install -qU langchain-teddynote
from langchain_teddynote import logging
# Enter a project name.
logging.langsmith("CH16-Evaluations")Copy
Define functions for RAG performance testing
We will create a RAG system to use for testing.
Copy
Copy
UpstageGroundednessCheck
In order to take advantage of Upstage's Groundedness Check feature, you must be issued an API key from the link below.
Copy
Copy
Copy
Copy
Copy
Defines UpstageGroundednessCheck Evaluator. Later, it is utilized by the Evaluate function.
Copy
langchain_teddynote Groundness Checker
Utilize OpenAI's model to create a custom Groundness Checker.
Use the OpenAI model to check Groundedness.
Copy
Run Groundedness assessment.
Copy

Comprehensive evaluation of datasets using Summary Evaluators
This is useful when running Groundedness ratings for the entire dataset. (The previous step was to evaluate the individual data.)
Copy
Copy

Last updated