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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openrouter/bench-harness",
"version": "0.0.0",
"description": "Native TypeScript benchmark harness (inspect-ai-style primitives, Effect-based)",
"description": "Kepler, the OpenRouter TypeScript benchmark harness (inspect-ai-style primitives, Effect-based)",
"packageManager": "bun@1.3.14",
"type": "module",
"exports": {
Expand Down
10 changes: 5 additions & 5 deletions src/benchmarks/benchmark-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
isInjectedBenchmarkConfig,
isModelBenchmarkConfig,
isSearchBenchmarkConfig,
NativeBenchmarkRunConfigSchema,
KeplerBenchmarkRunConfigSchema,
} from "./benchmark-config";

describe("benchmark config", () => {
Expand All @@ -23,8 +23,8 @@ describe("benchmark config", () => {
expect(result.status).toBe(0);
});

it("keeps native configs precise while parsing them through the native schema", () => {
const result = parseSchema(NativeBenchmarkRunConfigSchema, {
it("keeps Kepler configs precise while parsing them through the Kepler schema", () => {
const result = parseSchema(KeplerBenchmarkRunConfigSchema, {
benchmarkId: "search_hle",
model: "openai/gpt-5.4",
reasoningEffort: "high",
Expand All @@ -40,7 +40,7 @@ describe("benchmark config", () => {
expect(isModelBenchmarkConfig(result.right)).toBe(true);
});

it("does not let malformed native configs fall through to the injected variant", () => {
it("does not let malformed Kepler configs fall through to the injected variant", () => {
const result = parseSchema(BenchmarkRunConfigSchema, {
benchmarkId: "gpqa_diamond",
model: 42,
Expand Down Expand Up @@ -140,7 +140,7 @@ describe("benchmark config", () => {
expect(result.right.options).toEqual({});
});

it("rejects an injected config that reuses a native benchmark id", () => {
it("rejects an injected config that reuses a Kepler benchmark id", () => {
const result = parseSchema(InjectedBenchmarkRunConfigSchema, {
benchmarkId: "gpqa_diamond",
model: "injected/model",
Expand Down
32 changes: 16 additions & 16 deletions src/benchmarks/benchmark-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export type SearchBenchmarkConfig =
| DsqaBenchmarkConfig
| WideSearchBenchmarkConfig;

export const NativeBenchmarkRunConfigSchema = z.discriminatedUnion(
export const KeplerBenchmarkRunConfigSchema = z.discriminatedUnion(
"benchmarkId",
[
GpqaBenchmarkConfigSchema,
Expand All @@ -353,18 +353,18 @@ export const NativeBenchmarkRunConfigSchema = z.discriminatedUnion(
]
);

export type NativeBenchmarkRunConfig = z.infer<
typeof NativeBenchmarkRunConfigSchema
export type KeplerBenchmarkRunConfig = z.infer<
typeof KeplerBenchmarkRunConfigSchema
>;

type NativeModelBenchmarkConfig = Extract<
NativeBenchmarkRunConfig,
type KeplerModelBenchmarkConfig = Extract<
KeplerBenchmarkRunConfig,
{
model: string;
}
>;

export type ModelBenchmarkId = NativeModelBenchmarkConfig["benchmarkId"];
export type ModelBenchmarkId = KeplerModelBenchmarkConfig["benchmarkId"];

export const BENCHMARK_OPTIONS_SCHEMAS = {
gpqa_diamond: GpqaOptionsSchema,
Expand All @@ -386,8 +386,8 @@ export const BENCHMARK_OPTIONS_SCHEMAS = {
vgi_bench: VgiBenchOptionsSchema,
} as const satisfies Record<ModelBenchmarkId, z.ZodObject<z.ZodRawShape>>;

const NATIVE_BENCHMARK_ID_SET: ReadonlySet<string> = new Set(
NativeBenchmarkRunConfigSchema.options.flatMap((schema) => {
const KEPLER_BENCHMARK_ID_SET: ReadonlySet<string> = new Set(
KeplerBenchmarkRunConfigSchema.options.flatMap((schema) => {
const benchmarkId = schema.shape.benchmarkId;
return benchmarkId instanceof z.ZodLiteral ? [benchmarkId.value] : [];
})
Expand All @@ -397,8 +397,8 @@ const InjectedBenchmarkIdSchema = z
.string()
.min(1)
.refine(
(benchmarkId) => !NATIVE_BENCHMARK_ID_SET.has(benchmarkId),
"Injected benchmark ids must not reuse native benchmark ids"
(benchmarkId) => !KEPLER_BENCHMARK_ID_SET.has(benchmarkId),
"Injected benchmark ids must not reuse Kepler benchmark ids"
);

export const InjectedBenchmarkRunConfigSchema = z.object({
Expand All @@ -412,7 +412,7 @@ export type InjectedBenchmarkRunConfig = z.infer<
>;

export const BenchmarkRunConfigSchema = z
.union([NativeBenchmarkRunConfigSchema, InjectedBenchmarkRunConfigSchema])
.union([KeplerBenchmarkRunConfigSchema, InjectedBenchmarkRunConfigSchema])
.refine(
(config) =>
!("model" in config) ||
Expand All @@ -427,7 +427,7 @@ export const BenchmarkRunConfigSchema = z
export type BenchmarkRunConfig = z.infer<typeof BenchmarkRunConfigSchema>;

export type ModelBenchmarkConfig =
| NativeModelBenchmarkConfig
| KeplerModelBenchmarkConfig
| InjectedBenchmarkRunConfig;

export function isModelBenchmarkConfig(
Expand All @@ -436,16 +436,16 @@ export function isModelBenchmarkConfig(
return "model" in config;
}

export function isNativeBenchmarkConfig(
export function isKeplerBenchmarkConfig(
config: BenchmarkRunConfig
): config is NativeBenchmarkRunConfig {
return NATIVE_BENCHMARK_ID_SET.has(config.benchmarkId);
): config is KeplerBenchmarkRunConfig {
return KEPLER_BENCHMARK_ID_SET.has(config.benchmarkId);
}

export function isInjectedBenchmarkConfig(
config: BenchmarkRunConfig
): config is InjectedBenchmarkRunConfig {
return !isNativeBenchmarkConfig(config);
return !isKeplerBenchmarkConfig(config);
}

const SEARCH_BENCHMARK_ID_SET: ReadonlySet<string> = new Set([
Expand Down
6 changes: 3 additions & 3 deletions src/benchmarks/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import type { ResponsesModel } from "../providers/responses-model";
import type { RetryConfig } from "../runtime/retry";
import type {
BenchmarkRunConfig,
NativeBenchmarkRunConfig,
KeplerBenchmarkRunConfig,
} from "./benchmark-config";

export interface BenchmarkRunInput<
Config extends BenchmarkRunConfig = NativeBenchmarkRunConfig,
Config extends BenchmarkRunConfig = KeplerBenchmarkRunConfig,
> {
readonly apiKey: string;
readonly baseUrl?: string;
Expand All @@ -38,7 +38,7 @@ export interface BenchmarkPrimaryScore {
}

export interface Benchmark<
Config extends BenchmarkRunConfig = NativeBenchmarkRunConfig,
Config extends BenchmarkRunConfig = KeplerBenchmarkRunConfig,
> {
readonly id: string;
readonly makeDatasetLayer: (retryConfig?: RetryConfig) => Layer<Dataset>;
Expand Down
6 changes: 3 additions & 3 deletions src/runner/run-by-id.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const INJECTED_CONFIG = {
} as const;

describe("benchmark runner by id", () => {
it("runs an injected benchmark instead of the native registry", async () => {
it("runs an injected benchmark instead of the Kepler registry", async () => {
const result = await runBenchmarkById({
benchmarkId: INJECTED_BENCHMARK.id,
injectedBenchmark: INJECTED_BENCHMARK,
Expand Down Expand Up @@ -66,7 +66,7 @@ describe("benchmark runner by id", () => {
expect(result.left).toContain("injected benchmark is required");
});

it("rejects an injected benchmark for a native config", async () => {
it("rejects an injected benchmark for a Kepler config", async () => {
const result = await runBenchmarkById({
benchmarkId: "search_hle",
injectedBenchmark: INJECTED_BENCHMARK,
Expand All @@ -81,7 +81,7 @@ describe("benchmark runner by id", () => {
});

assertLeft(result);
expect(result.left).toContain("cannot be supplied for native benchmark");
expect(result.left).toContain("cannot be supplied for Kepler benchmark");
});

it("resolves dataset size from an injected benchmark", async () => {
Expand Down
14 changes: 7 additions & 7 deletions src/runner/run-by-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
InjectedBenchmarkRunConfig,
} from "../benchmarks/benchmark-config";
import {
isNativeBenchmarkConfig,
isKeplerBenchmarkConfig,
modelFromConfig,
} from "../benchmarks/benchmark-config";
import { getBenchmark } from "../benchmarks/registry";
Expand Down Expand Up @@ -241,20 +241,20 @@ function resolveRunBenchmark(input: RunBenchmarkInput): Either.Either<
},
string
> {
if (isNativeBenchmarkConfig(input.benchmarkConfig)) {
if (isKeplerBenchmarkConfig(input.benchmarkConfig)) {
if (input.injectedBenchmark !== undefined) {
return Either.left(
`An injected benchmark cannot be supplied for native benchmark "${input.benchmarkId}"`
`An injected benchmark cannot be supplied for Kepler benchmark "${input.benchmarkId}"`
);
}
const nativeBenchmark = getBenchmark(input.benchmarkId);
if (nativeBenchmark === undefined) {
const keplerBenchmark = getBenchmark(input.benchmarkId);
if (keplerBenchmark === undefined) {
return Either.left(`Unknown benchmark "${input.benchmarkId}"`);
}
return Either.right({
benchmark: nativeBenchmark,
benchmark: keplerBenchmark,
benchmarkLayer: makeBenchmarkLayer(
nativeBenchmark,
keplerBenchmark,
input,
input.benchmarkConfig
),
Expand Down
Loading