You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This factory creates an evaluation function that calculates the how many tokens in the generated answer are also present in the retrieved context.
It is based on the paper [Evaluating Correctness and Faithfulness of Instruction-Following Models for Question Answering](https://arxiv.org/abs/2307.16877)
which finds that this method only slightly lags behind GPT-4 and outperforms GPT-3.5-turbo (see Table 4 from the above paper).
Args:
context_field: The key name/field used for the retrieved context. Defaults to "context".
Returns:
Callable[[Log], float]: A function that takes a log as input and returns a score between 0 and 1 indicating
how many tokens in the generated answer are also present in the retrieved context.