Skip to content

(EAI-895): Remove AnswerRelevancy tracing metric #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ jest.mock("autoevals", () => ({
ContextRelevancy: jest.fn().mockResolvedValue({
score: 0.8,
}),
AnswerRelevancy: jest.fn().mockResolvedValue({
score: 0.8,
}),
}));

afterEach(() => {
Expand Down Expand Up @@ -100,7 +97,6 @@ describe("getLlmAsAJudgeScores", () => {
const scores = await getLlmAsAJudgeScores(fakeBaseConfig, willJudge);
expect(scores).toEqual({
ContextRelevancy: 0.8,
AnswerRelevancy: 0.8,
Faithfulness: 0.8,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ const makeEvaluateWithLlmAsAJudge = (
openAiConfig: LlmAsAJudge["openAiConfig"]
) =>
wrapTraced(
async function ({
input,
output,
context,
judgeEmbeddingModel,
judgeModel,
}: ScorerArgs) {
async function ({ input, output, context, judgeModel }: ScorerArgs) {
return Promise.all([
traced(
async () =>
Expand All @@ -52,20 +46,6 @@ const makeEvaluateWithLlmAsAJudge = (
name: "Faithfulness",
}
),
traced(
async () =>
AnswerRelevancy({
input,
output,
context,
model: judgeModel,
embeddingModel: judgeEmbeddingModel,
...openAiConfig,
}),
{
name: "AnswerRelevancy",
}
),
traced(
async () =>
ContextRelevancy({
Expand Down Expand Up @@ -113,19 +93,18 @@ export async function getLlmAsAJudgeScores(

const evaluateWithLlmAsAJudge = makeEvaluateWithLlmAsAJudge(openAiConfig);

const [faithfulness, answerRelevancy, contextRelevancy] = context
const [faithfulness, contextRelevancy] = context
? await evaluateWithLlmAsAJudge({
input,
output,
context,
judgeModel,
judgeEmbeddingModel,
})
: [nullScore, nullScore, nullScore];
: [nullScore, nullScore];

return {
Faithfulness: faithfulness.score,
AnswerRelevancy: answerRelevancy.score,
ContextRelevancy: contextRelevancy.score,
};
}