@cotofe/service-of-litellm
Version:
OpenAPI client for @cotofe/service-of-litellm
431 lines (430 loc) • 26.5 kB
JavaScript
"use strict";
/**
* Platform
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RetrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum = exports.RetrieveFineTuningJobFineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum = exports.ListFineTuningJobsV1FineTuningJobsGetCustomLlmProviderEnum = exports.ListFineTuningJobsFineTuningJobsGetCustomLlmProviderEnum = exports.LitellmFineTuningApi = void 0;
const runtime = require("../runtime");
/**
*
*/
class LitellmFineTuningApi extends runtime.BaseAPI {
/**
* Cancel a fine-tuning job. This is the equivalent of POST https://api.openai.com/v1/fine_tuning/jobs/{fine_tuning_job_id}/cancel Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `fine_tuning_job_id`: The ID of the fine-tuning job to cancel.
* ✨ (Enterprise) Cancel Fine-Tuning Jobs
*/
cancelFineTuningJobFineTuningJobsFineTuningJobIdCancelPostRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.fineTuningJobId == null) {
throw new runtime.RequiredError('fineTuningJobId', 'Required parameter "fineTuningJobId" was null or undefined when calling cancelFineTuningJobFineTuningJobsFineTuningJobIdCancelPost().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = yield token('bearer', []);
if (tokenString) {
headerParameters.Authorization = `Bearer ${tokenString}`;
}
}
const response = yield this.request({
path: `/fine_tuning/jobs/{fine_tuning_job_id}/cancel`.replace(`{${'fine_tuning_job_id'}}`, encodeURIComponent(String(requestParameters.fineTuningJobId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Cancel a fine-tuning job. This is the equivalent of POST https://api.openai.com/v1/fine_tuning/jobs/{fine_tuning_job_id}/cancel Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `fine_tuning_job_id`: The ID of the fine-tuning job to cancel.
* ✨ (Enterprise) Cancel Fine-Tuning Jobs
*/
cancelFineTuningJobFineTuningJobsFineTuningJobIdCancelPost(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.cancelFineTuningJobFineTuningJobsFineTuningJobIdCancelPostRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Cancel a fine-tuning job. This is the equivalent of POST https://api.openai.com/v1/fine_tuning/jobs/{fine_tuning_job_id}/cancel Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `fine_tuning_job_id`: The ID of the fine-tuning job to cancel.
* ✨ (Enterprise) Cancel Fine-Tuning Jobs
*/
cancelFineTuningJobV1FineTuningJobsFineTuningJobIdCancelPostRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.fineTuningJobId == null) {
throw new runtime.RequiredError('fineTuningJobId', 'Required parameter "fineTuningJobId" was null or undefined when calling cancelFineTuningJobV1FineTuningJobsFineTuningJobIdCancelPost().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = yield token('bearer', []);
if (tokenString) {
headerParameters.Authorization = `Bearer ${tokenString}`;
}
}
const response = yield this.request({
path: `/v1/fine_tuning/jobs/{fine_tuning_job_id}/cancel`.replace(`{${'fine_tuning_job_id'}}`, encodeURIComponent(String(requestParameters.fineTuningJobId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Cancel a fine-tuning job. This is the equivalent of POST https://api.openai.com/v1/fine_tuning/jobs/{fine_tuning_job_id}/cancel Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `fine_tuning_job_id`: The ID of the fine-tuning job to cancel.
* ✨ (Enterprise) Cancel Fine-Tuning Jobs
*/
cancelFineTuningJobV1FineTuningJobsFineTuningJobIdCancelPost(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.cancelFineTuningJobV1FineTuningJobsFineTuningJobIdCancelPostRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Creates a fine-tuning job which begins the process of creating a new model from a given dataset. This is the equivalent of POST https://api.openai.com/v1/fine_tuning/jobs Supports Identical Params as: https://platform.openai.com/docs/api-reference/fine-tuning/create Example Curl: ``` curl http://localhost:4000/v1/fine_tuning/jobs -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo\", \"training_file\": \"file-abc123\", \"hyperparameters\": { \"n_epochs\": 4 } }\' ```
* ✨ (Enterprise) Create Fine-Tuning Job
*/
createFineTuningJobFineTuningJobsPostRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = yield token('bearer', []);
if (tokenString) {
headerParameters.Authorization = `Bearer ${tokenString}`;
}
}
const response = yield this.request({
path: `/fine_tuning/jobs`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: requestParameters.liteLlmFineTuningJobCreate,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Creates a fine-tuning job which begins the process of creating a new model from a given dataset. This is the equivalent of POST https://api.openai.com/v1/fine_tuning/jobs Supports Identical Params as: https://platform.openai.com/docs/api-reference/fine-tuning/create Example Curl: ``` curl http://localhost:4000/v1/fine_tuning/jobs -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo\", \"training_file\": \"file-abc123\", \"hyperparameters\": { \"n_epochs\": 4 } }\' ```
* ✨ (Enterprise) Create Fine-Tuning Job
*/
createFineTuningJobFineTuningJobsPost() {
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
const response = yield this.createFineTuningJobFineTuningJobsPostRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Creates a fine-tuning job which begins the process of creating a new model from a given dataset. This is the equivalent of POST https://api.openai.com/v1/fine_tuning/jobs Supports Identical Params as: https://platform.openai.com/docs/api-reference/fine-tuning/create Example Curl: ``` curl http://localhost:4000/v1/fine_tuning/jobs -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo\", \"training_file\": \"file-abc123\", \"hyperparameters\": { \"n_epochs\": 4 } }\' ```
* ✨ (Enterprise) Create Fine-Tuning Job
*/
createFineTuningJobV1FineTuningJobsPostRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = yield token('bearer', []);
if (tokenString) {
headerParameters.Authorization = `Bearer ${tokenString}`;
}
}
const response = yield this.request({
path: `/v1/fine_tuning/jobs`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: requestParameters.liteLlmFineTuningJobCreate,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Creates a fine-tuning job which begins the process of creating a new model from a given dataset. This is the equivalent of POST https://api.openai.com/v1/fine_tuning/jobs Supports Identical Params as: https://platform.openai.com/docs/api-reference/fine-tuning/create Example Curl: ``` curl http://localhost:4000/v1/fine_tuning/jobs -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo\", \"training_file\": \"file-abc123\", \"hyperparameters\": { \"n_epochs\": 4 } }\' ```
* ✨ (Enterprise) Create Fine-Tuning Job
*/
createFineTuningJobV1FineTuningJobsPost() {
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
const response = yield this.createFineTuningJobV1FineTuningJobsPostRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Lists fine-tuning jobs for the organization. This is the equivalent of GET https://api.openai.com/v1/fine_tuning/jobs Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `after`: Identifier for the last job from the previous pagination request. - `limit`: Number of fine-tuning jobs to retrieve (default is 20).
* ✨ (Enterprise) List Fine-Tuning Jobs
*/
listFineTuningJobsFineTuningJobsGetRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.customLlmProvider == null) {
throw new runtime.RequiredError('customLlmProvider', 'Required parameter "customLlmProvider" was null or undefined when calling listFineTuningJobsFineTuningJobsGet().');
}
const queryParameters = {};
if (requestParameters.customLlmProvider != null) {
queryParameters.custom_llm_provider = requestParameters.customLlmProvider;
}
if (requestParameters.after != null) {
queryParameters.after = requestParameters.after;
}
if (requestParameters.limit != null) {
queryParameters.limit = requestParameters.limit;
}
const headerParameters = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = yield token('bearer', []);
if (tokenString) {
headerParameters.Authorization = `Bearer ${tokenString}`;
}
}
const response = yield this.request({
path: `/fine_tuning/jobs`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Lists fine-tuning jobs for the organization. This is the equivalent of GET https://api.openai.com/v1/fine_tuning/jobs Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `after`: Identifier for the last job from the previous pagination request. - `limit`: Number of fine-tuning jobs to retrieve (default is 20).
* ✨ (Enterprise) List Fine-Tuning Jobs
*/
listFineTuningJobsFineTuningJobsGet(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.listFineTuningJobsFineTuningJobsGetRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Lists fine-tuning jobs for the organization. This is the equivalent of GET https://api.openai.com/v1/fine_tuning/jobs Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `after`: Identifier for the last job from the previous pagination request. - `limit`: Number of fine-tuning jobs to retrieve (default is 20).
* ✨ (Enterprise) List Fine-Tuning Jobs
*/
listFineTuningJobsV1FineTuningJobsGetRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.customLlmProvider == null) {
throw new runtime.RequiredError('customLlmProvider', 'Required parameter "customLlmProvider" was null or undefined when calling listFineTuningJobsV1FineTuningJobsGet().');
}
const queryParameters = {};
if (requestParameters.customLlmProvider != null) {
queryParameters.custom_llm_provider = requestParameters.customLlmProvider;
}
if (requestParameters.after != null) {
queryParameters.after = requestParameters.after;
}
if (requestParameters.limit != null) {
queryParameters.limit = requestParameters.limit;
}
const headerParameters = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = yield token('bearer', []);
if (tokenString) {
headerParameters.Authorization = `Bearer ${tokenString}`;
}
}
const response = yield this.request({
path: `/v1/fine_tuning/jobs`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Lists fine-tuning jobs for the organization. This is the equivalent of GET https://api.openai.com/v1/fine_tuning/jobs Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `after`: Identifier for the last job from the previous pagination request. - `limit`: Number of fine-tuning jobs to retrieve (default is 20).
* ✨ (Enterprise) List Fine-Tuning Jobs
*/
listFineTuningJobsV1FineTuningJobsGet(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.listFineTuningJobsV1FineTuningJobsGetRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Retrieves a fine-tuning job. This is the equivalent of GET https://api.openai.com/v1/fine_tuning/jobs/{fine_tuning_job_id} Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `fine_tuning_job_id`: The ID of the fine-tuning job to retrieve.
* ✨ (Enterprise) Retrieve Fine-Tuning Job
*/
retrieveFineTuningJobFineTuningJobsFineTuningJobIdGetRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.fineTuningJobId == null) {
throw new runtime.RequiredError('fineTuningJobId', 'Required parameter "fineTuningJobId" was null or undefined when calling retrieveFineTuningJobFineTuningJobsFineTuningJobIdGet().');
}
if (requestParameters.customLlmProvider == null) {
throw new runtime.RequiredError('customLlmProvider', 'Required parameter "customLlmProvider" was null or undefined when calling retrieveFineTuningJobFineTuningJobsFineTuningJobIdGet().');
}
const queryParameters = {};
if (requestParameters.customLlmProvider != null) {
queryParameters.custom_llm_provider = requestParameters.customLlmProvider;
}
const headerParameters = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = yield token('bearer', []);
if (tokenString) {
headerParameters.Authorization = `Bearer ${tokenString}`;
}
}
const response = yield this.request({
path: `/fine_tuning/jobs/{fine_tuning_job_id}`.replace(`{${'fine_tuning_job_id'}}`, encodeURIComponent(String(requestParameters.fineTuningJobId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Retrieves a fine-tuning job. This is the equivalent of GET https://api.openai.com/v1/fine_tuning/jobs/{fine_tuning_job_id} Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `fine_tuning_job_id`: The ID of the fine-tuning job to retrieve.
* ✨ (Enterprise) Retrieve Fine-Tuning Job
*/
retrieveFineTuningJobFineTuningJobsFineTuningJobIdGet(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.retrieveFineTuningJobFineTuningJobsFineTuningJobIdGetRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Retrieves a fine-tuning job. This is the equivalent of GET https://api.openai.com/v1/fine_tuning/jobs/{fine_tuning_job_id} Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `fine_tuning_job_id`: The ID of the fine-tuning job to retrieve.
* ✨ (Enterprise) Retrieve Fine-Tuning Job
*/
retrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGetRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.fineTuningJobId == null) {
throw new runtime.RequiredError('fineTuningJobId', 'Required parameter "fineTuningJobId" was null or undefined when calling retrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGet().');
}
if (requestParameters.customLlmProvider == null) {
throw new runtime.RequiredError('customLlmProvider', 'Required parameter "customLlmProvider" was null or undefined when calling retrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGet().');
}
const queryParameters = {};
if (requestParameters.customLlmProvider != null) {
queryParameters.custom_llm_provider = requestParameters.customLlmProvider;
}
const headerParameters = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = yield token('bearer', []);
if (tokenString) {
headerParameters.Authorization = `Bearer ${tokenString}`;
}
}
const response = yield this.request({
path: `/v1/fine_tuning/jobs/{fine_tuning_job_id}`.replace(`{${'fine_tuning_job_id'}}`, encodeURIComponent(String(requestParameters.fineTuningJobId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Retrieves a fine-tuning job. This is the equivalent of GET https://api.openai.com/v1/fine_tuning/jobs/{fine_tuning_job_id} Supported Query Params: - `custom_llm_provider`: Name of the LiteLLM provider - `fine_tuning_job_id`: The ID of the fine-tuning job to retrieve.
* ✨ (Enterprise) Retrieve Fine-Tuning Job
*/
retrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGet(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.retrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGetRaw(requestParameters, initOverrides);
return yield response.value();
});
}
}
exports.LitellmFineTuningApi = LitellmFineTuningApi;
/**
* @export
* @enum {string}
*/
var ListFineTuningJobsFineTuningJobsGetCustomLlmProviderEnum;
(function (ListFineTuningJobsFineTuningJobsGetCustomLlmProviderEnum) {
ListFineTuningJobsFineTuningJobsGetCustomLlmProviderEnum["Openai"] = "openai";
ListFineTuningJobsFineTuningJobsGetCustomLlmProviderEnum["Azure"] = "azure";
})(ListFineTuningJobsFineTuningJobsGetCustomLlmProviderEnum || (exports.ListFineTuningJobsFineTuningJobsGetCustomLlmProviderEnum = ListFineTuningJobsFineTuningJobsGetCustomLlmProviderEnum = {}));
/**
* @export
* @enum {string}
*/
var ListFineTuningJobsV1FineTuningJobsGetCustomLlmProviderEnum;
(function (ListFineTuningJobsV1FineTuningJobsGetCustomLlmProviderEnum) {
ListFineTuningJobsV1FineTuningJobsGetCustomLlmProviderEnum["Openai"] = "openai";
ListFineTuningJobsV1FineTuningJobsGetCustomLlmProviderEnum["Azure"] = "azure";
})(ListFineTuningJobsV1FineTuningJobsGetCustomLlmProviderEnum || (exports.ListFineTuningJobsV1FineTuningJobsGetCustomLlmProviderEnum = ListFineTuningJobsV1FineTuningJobsGetCustomLlmProviderEnum = {}));
/**
* @export
* @enum {string}
*/
var RetrieveFineTuningJobFineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum;
(function (RetrieveFineTuningJobFineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum) {
RetrieveFineTuningJobFineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum["Openai"] = "openai";
RetrieveFineTuningJobFineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum["Azure"] = "azure";
})(RetrieveFineTuningJobFineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum || (exports.RetrieveFineTuningJobFineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum = RetrieveFineTuningJobFineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum = {}));
/**
* @export
* @enum {string}
*/
var RetrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum;
(function (RetrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum) {
RetrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum["Openai"] = "openai";
RetrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum["Azure"] = "azure";
})(RetrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum || (exports.RetrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum = RetrieveFineTuningJobV1FineTuningJobsFineTuningJobIdGetCustomLlmProviderEnum = {}));