mirror of https://github.com/garrytan/gstack.git
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:
parent
c9215c438c
commit
6f63bbd66c
|
|
@ -17,13 +17,16 @@
|
|||
* 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",
|
||||
warmup: "claude-haiku-4-5",
|
||||
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(
|
||||
kind: EvalModelKind,
|
||||
|
|
|
|||
Loading…
Reference in New Issue