MCPcopy
hub / github.com/TanStack/ai / parseModelId

Function parseModelId

packages/ai-code-mode/models-eval/eval-config.ts:19–33  ·  view source on GitHub ↗
(model: string)

Source from the content-addressed store, hash-verified

17
18/** Split a `provider:model` string. First `:` is the delimiter. */
19export 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
35export function isCloudModel(model: string): boolean {
36 const { provider, modelId } = parseModelId(model)

Callers 3

toEvalRowFunction · 0.90
mainFunction · 0.90
isCloudModelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected