Try to extract parameter count in billions from a model id.
(id: string)
| 166 | |
| 167 | /** Try to extract parameter count in billions from a model id. */ |
| 168 | function parseParamsFromId(id: string): number | undefined { |
| 169 | // Patterns: ":32b", "-32b", "70B", "8x22b", ":3b", "qwen3-coder:30b" |
| 170 | const colonOrDash = id.match(/[:\-](\d+(?:\.\d+)?)b\b/i); |
| 171 | if (colonOrDash) return parseFloat(colonOrDash[1]!); |
| 172 | const xMatch = id.match(/(\d+)x(\d+)b/i); |
| 173 | if (xMatch) { |
| 174 | // MoE: experts × size, with rough "active params" heuristic of 30% for routing |
| 175 | return parseInt(xMatch[1]!, 10) * parseInt(xMatch[2]!, 10); |
| 176 | } |
| 177 | // Some HF-style ids embed the size in name: "Qwen3-Coder-30B-Instruct" |
| 178 | const bareMatch = id.match(/(\d+(?:\.\d+)?)[bB]\b/); |
| 179 | if (bareMatch) return parseFloat(bareMatch[1]!); |
| 180 | return undefined; |
| 181 | } |
| 182 | |
| 183 | /** Heuristic: does this model id look like it has native tool-call training? */ |
| 184 | function looksLikeToolCallCapable(id: string): boolean { |
no outgoing calls
no test coverage detected