UNPKG

@llumiverse/drivers

Version:

LLM driver implementations. Currently supported are: openai, huggingface, bedrock, replicate.

35 lines 1.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getModelDefinition = getModelDefinition; const index_js_1 = require("./index.js"); const gemini_js_1 = require("./models/gemini.js"); const claude_js_1 = require("./models/claude.js"); const llama_js_1 = require("./models/llama.js"); function getModelDefinition(model) { const splits = model.split("/"); // Handle both formats: "publishers/anthropic/models/..." and "locations/.../publishers/anthropic/models/..." let publisher; let modelName; const publisherIndex = splits.indexOf("publishers"); if (publisherIndex !== -1 && publisherIndex + 1 < splits.length) { publisher = splits[publisherIndex + 1]; modelName = (0, index_js_1.trimModelName)(splits[splits.length - 1]); } else { // Fallback to old logic for backward compatibility publisher = splits[1]; modelName = (0, index_js_1.trimModelName)(splits[splits.length - 1]); } if (publisher?.includes("anthropic")) { return new claude_js_1.ClaudeModelDefinition(modelName); } else if (publisher?.includes("google")) { return new gemini_js_1.GeminiModelDefinition(modelName); } else if (publisher?.includes("meta")) { return new llama_js_1.LLamaModelDefinition(modelName); } //Fallback, assume it is Gemini. return new gemini_js_1.GeminiModelDefinition(modelName); } //# sourceMappingURL=models.js.map