Verify If a Query Has Enough Context Using Context Sufficiency Eval
Ensuring that a query is supported by sufficient context is critical for accurate and reliable responses. Inadequate context can lead to incomplete, ambiguous, or incorrect answers, impacting decision-making and information retrieval.This eval determines whether the provided content contains enough information to accurately address a given query.Click here to read the eval definition of Context Sufficiency
from fi.evals import Evaluatorfrom fi.evals.templates import ContextSufficiencyfrom fi.testcases import TestCaseevaluator = Evaluator( fi_api_key="your_api_key", fi_secret_key="your_secret_key", fi_base_url="https://api.futureagi.com")test_case = TestCase( query="What is the capital of France?", context="Paris has been France's capital since 987 CE.")template = ContextSufficiency()response = evaluator.evaluate(eval_templates=[template], inputs=[test_case], model_name="turing_flash")print(f"Score: {response.eval_results[0].metrics[0].value}")print(f"Reason: {response.eval_results[0].reason}")