mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-22 04:40:44 +02:00
fix(eval-model): kinds are a literal union, not string
Record<string,string> widened EvalModelKind to string, so a typo'd kind only failed at runtime; as const satisfies keeps the closed set the doc comment promises.
This commit is contained in:
+6
-3
@@ -17,13 +17,16 @@
|
|||||||
* distill — free-text distillation (cheap, structured): haiku (pinned)
|
* distill — free-text distillation (cheap, structured): haiku (pinned)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const DEFAULTS: Record<string, string> = {
|
// `as const satisfies` keeps EvalModelKind the literal union
|
||||||
|
// 'capture' | 'warmup' | 'distill' — a `Record<string, string>` annotation
|
||||||
|
// would widen it to string and let any typo through the type gate.
|
||||||
|
const DEFAULTS = {
|
||||||
capture: "claude-opus-4-7",
|
capture: "claude-opus-4-7",
|
||||||
warmup: "claude-haiku-4-5",
|
warmup: "claude-haiku-4-5",
|
||||||
distill: "claude-haiku-4-5-20251001",
|
distill: "claude-haiku-4-5-20251001",
|
||||||
};
|
} as const satisfies Record<string, string>;
|
||||||
|
|
||||||
export type EvalModelKind = keyof typeof DEFAULTS & string;
|
export type EvalModelKind = keyof typeof DEFAULTS;
|
||||||
|
|
||||||
export function resolveEvalModel(
|
export function resolveEvalModel(
|
||||||
kind: EvalModelKind,
|
kind: EvalModelKind,
|
||||||
|
|||||||
Reference in New Issue
Block a user