ravendb
Version:
RavenDB client for Node.js
54 lines • 1.84 kB
JavaScript
import { AbstractAiSettings } from "./AbstractAiSettings.js";
import { AiSettingsCompareDifferences } from "../AiSettingsCompareDifferences.js";
import { StringUtil } from "../../../../../Utility/StringUtil.js";
/**
* Settings for Mistral AI service.
*/
export class MistralAiSettings extends AbstractAiSettings {
/**
* The model ID for the Mistral AI service.
*/
model;
/**
* The endpoint for the Mistral AI service.
*/
endpoint;
/**
* The API key required for accessing the Mistral AI service.
*/
apiKey;
constructor(model, apiKey, endpoint) {
super();
this.model = model;
this.endpoint = endpoint;
this.apiKey = apiKey;
}
validate(errors) {
if (StringUtil.isNullOrWhitespace(this.model)) {
errors.push("Value of 'model' field cannot be empty.");
}
if (StringUtil.isNullOrWhitespace(this.endpoint)) {
errors.push("Value of 'endpoint' field cannot be empty.");
}
if (StringUtil.isNullOrWhitespace(this.apiKey)) {
errors.push("Value of 'apiKey' field cannot be empty.");
}
}
compare(other) {
if (!(other instanceof MistralAiSettings)) {
return AiSettingsCompareDifferences.All;
}
let differences = AiSettingsCompareDifferences.None;
if (this.model !== other.model) {
differences |= AiSettingsCompareDifferences.ModelArchitecture;
}
if (this.endpoint !== other.endpoint) {
differences |= AiSettingsCompareDifferences.EndpointConfiguration;
}
if (this.apiKey !== other.apiKey) {
differences |= AiSettingsCompareDifferences.AuthenticationSettings;
}
return differences;
}
}
//# sourceMappingURL=MistralAiSettings.js.map