UNPKG

@nomyx/assistant

Version:

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

41 lines (40 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AzureConfig = void 0; class AzureConfig { constructor(config, logger) { this.config = config; this.logger = logger; this.logger.debug(`AzureConfig initialized with endpoint: ${this.config.endpoint}`); } get apiKey() { return this.config.apiKey; } get endpoint() { let endpoint = this.config.endpoint; if (!endpoint.startsWith('https://') && !endpoint.startsWith('http://')) { endpoint = `https://${endpoint}`; } this.logger.debug(`AzureConfig endpoint: ${endpoint}`); return endpoint; } get deployment() { return this.config.deployment; } get subscriptionId() { return this.config.subscriptionId; } getApiUrl(path) { let baseUrl = this.endpoint; if (!baseUrl.endsWith('.openai.azure.com')) { baseUrl += '.openai.azure.com'; } if (!baseUrl.endsWith('/')) { baseUrl += '/'; } const apiUrl = `${baseUrl}openai/deployments/${this.deployment}/${path}?api-version=2023-05-15`; this.logger.debug(`AzureConfig getApiUrl: ${apiUrl}`); return apiUrl; } } exports.AzureConfig = AzureConfig;