UNPKG

ravendb

Version:
51 lines 2.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OpenAiSettings = void 0; const OpenAiBaseSettings_js_1 = require("./OpenAiBaseSettings.js"); const AiSettingsCompareDifferences_js_1 = require("../AiSettingsCompareDifferences.js"); /** * The configuration for the OpenAI API client. */ class OpenAiSettings extends OpenAiBaseSettings_js_1.OpenAiBaseSettings { /** * The value to use for the OpenAI-Organization request header. Users who belong to multiple organizations * can set this value to specify which organization is used for an API request. Usage from these API requests will * count against the specified organization's quota. If not set, the header will be omitted, and the default * organization will be billed. You can change your default organization in your user settings. * Learn more: https://platform.openai.com/docs/guides/production-best-practices/setting-up-your-organization */ organizationId; /** * The value to use for the OpenAI-Project request header. Users who are accessing their projects through * their legacy user API key can set this value to specify which project is used for an API request. Usage from * these API requests will count as usage for the specified project. If not set, the header will be omitted, and * the default project will be accessed. */ projectId; static OPENAI_BASE_URI = "https://api.openai.com/"; constructor(apiKey, endpoint, model, organizationId, projectId, dimensions, temperature) { super(apiKey, endpoint, model, dimensions, temperature); this.organizationId = organizationId; this.projectId = projectId; } getBaseEndpointUri() { const uri = super.getBaseEndpointUri(); if (uri === OpenAiSettings.OPENAI_BASE_URI) { return uri + "v1/"; } return uri; } compare(other) { if (!(other instanceof OpenAiSettings)) { return AiSettingsCompareDifferences_js_1.AiSettingsCompareDifferences.All; } let differences = super.compare(other); if (this.organizationId !== other.organizationId || this.projectId !== other.projectId) { differences |= AiSettingsCompareDifferences_js_1.AiSettingsCompareDifferences.AuthenticationSettings; } return differences; } } exports.OpenAiSettings = OpenAiSettings; //# sourceMappingURL=OpenAiSettings.js.map