MCPcopy Create free account
hub / github.com/CopilotKit/aimock / stripProviderPrefix

Function stripProviderPrefix

src/model-utils.ts:82–96  ·  view source on GitHub ↗

* Strip a leading provider segment that Bedrock (and similar) prepend before * the actual family token — e.g. `anthropic.`, `us.anthropic.`, `eu.`. Keeps * everything from the recognised family token onward so prefix matching works.

(id: string)

Source from the content-addressed store, hash-verified

80 * everything from the recognised family token onward so prefix matching works.
81 */
82function stripProviderPrefix(id: string): string {
83 // Remove leading region/provider segments (dot-separated) until we hit the
84 // model token. Provider/region segments never contain a hyphen, whereas
85 // model families do (e.g. `claude-3-5-sonnet`, `gpt-4.1`). So drop any
86 // leading dot-separated segment that has no hyphen.
87 let rest = id;
88 while (true) {
89 const dot = rest.indexOf(".");
90 if (dot === -1) break;
91 const head = rest.slice(0, dot);
92 if (head.length === 0 || head.includes("-")) break;
93 rest = rest.slice(dot + 1);
94 }
95 return rest;
96}
97
98// Normalize each comma-separated env entry IDENTICALLY to the incoming model id
99// (date-suffix + provider/region prefix stripped, lowercased) so a prefixed

Callers 2

parseEnvListFunction · 0.85
isReasoningModelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…