Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/eval_utils/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ export async function runEval(
// Upsert the local Evaluators; other Evaluators are just referenced by `path` or `id`
let localEvaluators: [EvaluatorResponse, Function][] = [];
if (evaluators) {
const evaluatorsWithCallable = evaluators.filter((e) => e.callable !== null);
const evaluatorsWithCallable = evaluators.filter(
(e) => e.callable !== undefined,
);
Comment on lines +288 to +290
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could potentially break existing callers, right? What if someone is explicitly passing callable: null?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image Screenshot 2025-02-14 at 09 16 41

I think it's well handled, the problem was that we could not specify an online evaluator


if (evaluatorsWithCallable.length > 0 && function_ == null) {
throw new Error(
Expand Down
6 changes: 4 additions & 2 deletions src/eval_utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ export interface Evaluator extends Identifiers {
returnType?: EvaluatorReturnTypeEnum;
/**The threshold to check the Evaluator against. If the aggregate value of the Evaluator is below this threshold, the check will fail.*/
threshold?: number;
callable: Function;
argsType: EvaluatorArgumentsType;
/**The function to run on the logs to produce the judgment - only required for local Evaluators.*/
callable?: Function;
/**The type of arguments the Evaluator expects - only required for local Evaluators.*/
argsType?: EvaluatorArgumentsType;
Comment on lines +94 to +96
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect we should/could do some stronger typing here where we can statically check if a passed evaluator is either a remote evaluator (path/id) or local one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, evaluator could be a union where you either provide a path or {callable, argsType, returnType}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

}

export interface TargetFreeEvaluator extends Evaluator {
Expand Down