ravendb
Version:
RavenDB client for Node.js
47 lines • 2.23 kB
JavaScript
import { OpenAiBaseSettings } from "./OpenAiBaseSettings.js";
import { AiSettingsCompareDifferences } from "../AiSettingsCompareDifferences.js";
/**
* The configuration for the OpenAI API client.
*/
export class OpenAiSettings extends 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.All;
}
let differences = super.compare(other);
if (this.organizationId !== other.organizationId ||
this.projectId !== other.projectId) {
differences |= AiSettingsCompareDifferences.AuthenticationSettings;
}
return differences;
}
}
//# sourceMappingURL=OpenAiSettings.js.map