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
11 changes: 11 additions & 0 deletions src/benchmarks/benchmark-config.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { describe, expect, it } from "bun:test";
import { spawnSync } from "node:child_process";

import { assertLeft, assertRight } from "../internal/testing";
import { parseSchema } from "../internal/zod";
Expand All @@ -12,6 +13,16 @@ import {
} from "./benchmark-config";

describe("benchmark config", () => {
it("loads with frozen globals in a workflow sandbox", () => {
const result = spawnSync(
process.execPath,
["-e", 'Object.freeze(Error); await import("./benchmark-config.ts");'],
{ cwd: import.meta.dirname, encoding: "utf8" }
);
expect(result.stderr).toBe("");
expect(result.status).toBe(0);
});

it("keeps native configs precise while parsing them through the native schema", () => {
const result = parseSchema(NativeBenchmarkRunConfigSchema, {
benchmarkId: "search_hle",
Expand Down
2 changes: 1 addition & 1 deletion src/benchmarks/benchmark-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {
COST_TIERS,
IMAGE_DETAIL_VALUES,
REASONING_EFFORTS,
stripVariantSuffix,
SWITCHYARD_ALGORITHMS,
VIDEO_PROCESSING_MODES,
} from "../harness/constants";
import { stripVariantSuffix } from "../harness/model";
import { ProviderSort } from "../internal/enums";
import type { ValueOf } from "../internal/guards";
import { z, zDefaultedText, zInt } from "../internal/zod";
Expand Down
5 changes: 5 additions & 0 deletions src/harness/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,8 @@ export const VIDEO_PROCESSING_MODES = [
] as const;

export type VideoProcessingMode = ValueOf<typeof VIDEO_PROCESSING_MODES>;

export function stripVariantSuffix(model: string): string {
const idx = model.indexOf(":");
return idx <= 0 ? model : model.slice(0, idx);
}
5 changes: 1 addition & 4 deletions src/harness/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import type {
ToolDefinition,
} from "./core";

export function stripVariantSuffix(model: string): string {
const idx = model.indexOf(":");
return idx <= 0 ? model : model.slice(0, idx);
}
export { stripVariantSuffix } from "./constants";

export interface GenerateConfig {
readonly temperature?: number;
Expand Down
Loading