UNPKG

@nomyx/assistant

Version:

A powerful assistant library and cli for your AI projects. works with Vertex AI (Claude and Gemini)

47 lines (46 loc) 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VertexConfig = void 0; const types_1 = require("./types"); class VertexConfig { constructor(config, logger) { this.config = config; this.logger = logger; } get projectId() { return this.config.projectId; } get location() { return this.config.location; } get model() { return this.config.model; } get credentials() { return this.config.credentials; } getApiUrl() { return `https://${this.location}-aiplatform.googleapis.com/v1/projects/${this.projectId}/locations/${this.location}/publishers/google/models/${this.model}:predict`; } isGeminiModel() { return this.model.startsWith('gemini-'); } isClaudeModel() { return this.model.startsWith('claude-'); } getModelType() { switch (this.model) { case 'gemini-pro': return types_1.VertexModel.GEMINI_PRO; case 'gemini-pro-vision': return types_1.VertexModel.GEMINI_PRO_VISION; case 'claude-3-sonnet-20240229': return types_1.VertexModel.CLAUDE_3_SONNET; case 'claude-3-opus-20240229': return types_1.VertexModel.CLAUDE_3_OPUS; default: throw new Error(`Unsupported model: ${this.model}`); } } } exports.VertexConfig = VertexConfig;