@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
33 lines • 1.16 kB
JavaScript
export class ModelRouter {
mappings;
passthrough;
fallback;
constructor(config) {
this.mappings = new Map(config.modelMappings.map((m) => [m.from, m]));
this.passthrough = new Set(config.passthroughModels ?? []);
this.fallback = config.fallbackChain;
}
resolve(requestedModel) {
const mapping = this.mappings.get(requestedModel);
if (mapping) {
return { provider: mapping.provider, model: mapping.to };
}
if (this.passthrough.has(requestedModel)) {
return { provider: "anthropic", model: requestedModel };
}
if (requestedModel.startsWith("gemini-")) {
return { provider: "vertex", model: requestedModel };
}
if (requestedModel.startsWith("claude-")) {
return { provider: "anthropic", model: requestedModel };
}
return { provider: null, model: requestedModel };
}
isClaudeTarget(requestedModel) {
return this.resolve(requestedModel).provider === "anthropic";
}
getFallbackChain() {
return this.fallback;
}
}
//# sourceMappingURL=modelRouter.js.map