UNPKG

ravendb

Version:
63 lines 2.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GoogleSettings = void 0; const AbstractAiSettings_js_1 = require("./AbstractAiSettings.js"); const AiSettingsCompareDifferences_js_1 = require("../AiSettingsCompareDifferences.js"); const StringUtil_js_1 = require("../../../../../Utility/StringUtil.js"); /** * Settings for Google AI service. */ class GoogleSettings extends AbstractAiSettings_js_1.AbstractAiSettings { /** * The model that should be used. */ model; /** * The API key to use to authenticate with the service. */ apiKey; /** * The version of Google AI to use. */ aiVersion; /** * The number of dimensions that the model should use. */ dimensions; constructor(model, apiKey, aiVersion, dimensions) { super(); this.model = model; this.apiKey = apiKey; this.aiVersion = aiVersion; this.dimensions = dimensions; } validate(errors) { if (StringUtil_js_1.StringUtil.isNullOrWhitespace(this.model)) { errors.push("Value of 'model' field cannot be empty."); } if (StringUtil_js_1.StringUtil.isNullOrWhitespace(this.apiKey)) { errors.push("Value of 'apiKey' field cannot be empty."); } if (this.dimensions != null && this.dimensions <= 0) { errors.push("Value of 'dimensions' field must be positive."); } } compare(other) { if (!(other instanceof GoogleSettings)) { return AiSettingsCompareDifferences_js_1.AiSettingsCompareDifferences.All; } let differences = AiSettingsCompareDifferences_js_1.AiSettingsCompareDifferences.None; if (this.model !== other.model || this.aiVersion !== other.aiVersion) { differences |= AiSettingsCompareDifferences_js_1.AiSettingsCompareDifferences.ModelArchitecture; } if (this.apiKey !== other.apiKey) { differences |= AiSettingsCompareDifferences_js_1.AiSettingsCompareDifferences.AuthenticationSettings; } if (this.dimensions !== other.dimensions) { differences |= AiSettingsCompareDifferences_js_1.AiSettingsCompareDifferences.EmbeddingDimensions; } return differences; } } exports.GoogleSettings = GoogleSettings; //# sourceMappingURL=GoogleSettings.js.map