(model: string)
| 17 | |
| 18 | /** Split a `provider:model` string. First `:` is the delimiter. */ |
| 19 | export function parseModelId(model: string): { |
| 20 | provider: EvalProvider |
| 21 | modelId: string |
| 22 | } { |
| 23 | const idx = model.indexOf(':') |
| 24 | if (idx === -1) { |
| 25 | throw new Error( |
| 26 | `Invalid model format "${model}". Expected "provider:model" (e.g. "openai:gpt-4o").`, |
| 27 | ) |
| 28 | } |
| 29 | return { |
| 30 | provider: model.slice(0, idx) as EvalProvider, |
| 31 | modelId: model.slice(idx + 1), |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | export function isCloudModel(model: string): boolean { |
| 36 | const { provider, modelId } = parseModelId(model) |
no outgoing calls
no test coverage detected