MCPcopy Index your code
hub / github.com/coder/mux / normalizeModelKey

Function normalizeModelKey

src/node/utils/main/tokenizer.ts:57–72  ·  view source on GitHub ↗
(modelName: string)

Source from the content-addressed store, hash-verified

55const warnedModels = new Set<string>();
56
57function normalizeModelKey(modelName: string): ModelName | null {
58 assert(
59 typeof modelName === "string" && modelName.length > 0,
60 "Model name must be a non-empty string"
61 );
62
63 const override = TOKENIZER_MODEL_OVERRIDES[modelName];
64 const normalized =
65 override ?? (modelName.includes(":") ? modelName.replace(":", "/") : modelName);
66
67 if (!(normalized in models)) {
68 // Return null for unknown models - caller can decide to fallback or error
69 return null;
70 }
71 return normalized as ModelName;
72}
73
74/**
75 * Resolves a model string to a ModelName, falling back to a similar model if unknown.

Callers 2

resolveModelNameFunction · 0.85
loadTokenizerModulesFunction · 0.85

Calls 1

assertFunction · 0.50

Tested by

no test coverage detected