Open mongodben opened 4 months ago
Thanks for filing. Do you have any ideas on how to make it clearer? Currently, in Typescript, we lean on the typesystem for this.
Do you have any ideas on how to make it clearer? i think passing the
context
prop to the evaluators is pretty straightforward. but it could be clearer how to get this from your dataset into the evaluator.
a few ideas:
context?: string[]
as a first-class property for the Data passed to the data
constructor function. in typescript something like:interface Data {
input: string;
expected?: string;
tags?: string[];
metadata: Record<string, string>;
// NEW!
contexts?: string[];
}
the evaluators like Faithfulness
and AnswerRelevancy
could then read directly from the Data.contexts
property.
Ah thanks, yes I think the first is more likely the path -- different evaluators have different conventions/names for additional arguments.
It could be clearer how to use the evaluators that use "context" in addition to input and output in the
Eval
run, such asFaithfulness
andContextRelevancy
.Right now, I'm including contexts in the metadata. I only figured this out after few hours of poking around since the behavior is undocumented.
Here's an annotated version of my code which worked: