models.ts
956 bytes
| 1 | /** |
|---|---|
| 2 | * Model-identity helpers used for self-preference mitigation. |
| 3 | * |
| 4 | * OpenRouter slugs are "vendor/model[:variant]"; the vendor prefix is the |
| 5 | * provider family. Two models from the same family (e.g. two OpenAI models) |
| 6 | * share training lineage and stylistic priors, so a chairman that shares a |
| 7 | * family with a council member is a self-preference risk worth flagging. |
| 8 | */ |
| 9 | |
| 10 | /** Sensible cheap/fast default for the between-rounds convergence check. */ |
| 11 | export const DEFAULT_CONVERGENCE_MODEL = 'google/gemini-2.0-flash-001'; |
| 12 | |
| 13 | export function providerFamily(slug: string): string { |
| 14 | const idx = slug.indexOf('/'); |
| 15 | return (idx === -1 ? slug : slug.slice(0, idx)).toLowerCase(); |
| 16 | } |
| 17 | |
| 18 | /** True if the chairman shares a provider family with any council member. */ |
| 19 | export function chairmanSharesProvider(chairman: string, council: readonly string[]): boolean { |
| 20 | const fam = providerFamily(chairman); |
| 21 | return council.some((m) => providerFamily(m) === fam); |
| 22 | } |
| 23 | |