LMBasedRetrievalEvaluator
Example Usage
import asyncio
import os
from gllm_evals.evaluator.lm_based_retrieval_evaluator import LMBasedRetrievalEvaluator
from gllm_evals.types import RAGData
async def main():
evaluator = LMBasedRetrievalEvaluator(model_credentials=os.getenv("GOOGLE_API_KEY"))
data = RAGData(
query="What is the capital of France?",
expected_response="Paris is the capital of France.",
retrieved_context=[
"Berlin is the capital of Germany.",
"Paris is the capital city of France with a population of over 2 million people.",
"London is the capital of the United Kingdom.",
],
)
result = await evaluator.evaluate(data)
print(result)
if __name__ == "__main__":
asyncio.run(main())Example Output
Last updated
Was this helpful?