MCPcopy
hub / github.com/alibaba/page-agent / normalizeModelName

Function normalizeModelName

packages/llms/src/utils.ts:142–157  ·  view source on GitHub ↗

* check if a given model ID fits a specific model name * * @note * Different model providers may use different model IDs for the same model. * For example, openai's `gpt-5.2` may called: * * - `gpt-5.2-version` * - `gpt-5_2-date` * - `GPT-52-version-date` * - `openai/gpt-5.2-chat` * * The

(modelName: string)

Source from the content-addressed store, hash-verified

140 * Normalize them to `gpt-52`
141 */
142function normalizeModelName(modelName: string): string {
143 let normalizedName = modelName.toLowerCase()
144
145 // remove prefix before '/'
146 if (normalizedName.includes('/')) {
147 normalizedName = normalizedName.split('/')[1]
148 }
149
150 // remove '_'
151 normalizedName = normalizedName.replace(/_/g, '')
152
153 // remove '.'
154 normalizedName = normalizedName.replace(/\./g, '')
155
156 return normalizedName
157}

Callers 1

modelPatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected