Judge Model Utilities (v2/judgeModel.ts)

langfuse · web/src/features/evals/v2/judgeModel.ts · typescript · MIT
ai, tag:judge, tag:utils, tag:provider

Provides helpers to check judge model availability and map provider adapters for LLM-as-a-judge.

// Source: https://github.com/langfuse/langfuse | License: MIT | Copyright 2023-2026 ClickHouse, Inc
// Provided via justclaw.it.com; keep this notice with the code.
import type { LLMAdapter } from "@langfuse/shared";

/** Provider and model pair identifying an LLM-as-a-judge model. */
export type JudgeModel = { provider: string; model: string };

export function isJudgeModelAvailable(
  model: JudgeModel | null,
  providerGroups: Array<[string, string[]]>,
) {
  return Boolean(
    model &&
    providerGroups.some(
      ([provider, models]) =>
        provider === model.provider && models.includes(model.model),
    ),
  );
}

type JudgeModelConnection = {
  provider: string;
  adapter: LLMAdapter;
  customModels: string[];
  withDefaultModels: boolean;
};

export function getJudgeModelPr

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key