@cotofe/service-of-litellm
Version:
OpenAPI client for @cotofe/service-of-litellm
199 lines (198 loc) • 11.3 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.CompletionsApi = void 0;
const runtime = require("../runtime");
/**
*
*/
class CompletionsApi extends runtime.BaseAPI {
/**
* Follows the exact same API spec as `OpenAI\'s Completions API https://platform.openai.com/docs/api-reference/completions` ```bash curl -X POST http://localhost:4000/v1/completions -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo-instruct\", \"prompt\": \"Once upon a time\", \"max_tokens\": 50, \"temperature\": 0.7 }\' ```
* Completion
*/
completionCompletionsPostRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
if (requestParameters.model != null) {
queryParameters.model = requestParameters.model;
}
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: `/completions`,
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);
}
});
}
/**
* Follows the exact same API spec as `OpenAI\'s Completions API https://platform.openai.com/docs/api-reference/completions` ```bash curl -X POST http://localhost:4000/v1/completions -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo-instruct\", \"prompt\": \"Once upon a time\", \"max_tokens\": 50, \"temperature\": 0.7 }\' ```
* Completion
*/
completionCompletionsPost() {
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
const response = yield this.completionCompletionsPostRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Follows the exact same API spec as `OpenAI\'s Completions API https://platform.openai.com/docs/api-reference/completions` ```bash curl -X POST http://localhost:4000/v1/completions -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo-instruct\", \"prompt\": \"Once upon a time\", \"max_tokens\": 50, \"temperature\": 0.7 }\' ```
* Completion
*/
completionEnginesModelCompletionsPostRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.model == null) {
throw new runtime.RequiredError('model', 'Required parameter "model" was null or undefined when calling completionEnginesModelCompletionsPost().');
}
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: `/engines/{model}/completions`.replace(`{${'model'}}`, encodeURIComponent(String(requestParameters.model))),
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);
}
});
}
/**
* Follows the exact same API spec as `OpenAI\'s Completions API https://platform.openai.com/docs/api-reference/completions` ```bash curl -X POST http://localhost:4000/v1/completions -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo-instruct\", \"prompt\": \"Once upon a time\", \"max_tokens\": 50, \"temperature\": 0.7 }\' ```
* Completion
*/
completionEnginesModelCompletionsPost(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.completionEnginesModelCompletionsPostRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Follows the exact same API spec as `OpenAI\'s Completions API https://platform.openai.com/docs/api-reference/completions` ```bash curl -X POST http://localhost:4000/v1/completions -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo-instruct\", \"prompt\": \"Once upon a time\", \"max_tokens\": 50, \"temperature\": 0.7 }\' ```
* Completion
*/
completionOpenaiDeploymentsModelCompletionsPostRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.model == null) {
throw new runtime.RequiredError('model', 'Required parameter "model" was null or undefined when calling completionOpenaiDeploymentsModelCompletionsPost().');
}
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: `/openai/deployments/{model}/completions`.replace(`{${'model'}}`, encodeURIComponent(String(requestParameters.model))),
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);
}
});
}
/**
* Follows the exact same API spec as `OpenAI\'s Completions API https://platform.openai.com/docs/api-reference/completions` ```bash curl -X POST http://localhost:4000/v1/completions -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo-instruct\", \"prompt\": \"Once upon a time\", \"max_tokens\": 50, \"temperature\": 0.7 }\' ```
* Completion
*/
completionOpenaiDeploymentsModelCompletionsPost(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.completionOpenaiDeploymentsModelCompletionsPostRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Follows the exact same API spec as `OpenAI\'s Completions API https://platform.openai.com/docs/api-reference/completions` ```bash curl -X POST http://localhost:4000/v1/completions -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo-instruct\", \"prompt\": \"Once upon a time\", \"max_tokens\": 50, \"temperature\": 0.7 }\' ```
* Completion
*/
completionV1CompletionsPostRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
if (requestParameters.model != null) {
queryParameters.model = requestParameters.model;
}
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/completions`,
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);
}
});
}
/**
* Follows the exact same API spec as `OpenAI\'s Completions API https://platform.openai.com/docs/api-reference/completions` ```bash curl -X POST http://localhost:4000/v1/completions -H \"Content-Type: application/json\" -H \"Authorization: Bearer sk-1234\" -d \'{ \"model\": \"gpt-3.5-turbo-instruct\", \"prompt\": \"Once upon a time\", \"max_tokens\": 50, \"temperature\": 0.7 }\' ```
* Completion
*/
completionV1CompletionsPost() {
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
const response = yield this.completionV1CompletionsPostRaw(requestParameters, initOverrides);
return yield response.value();
});
}
}
exports.CompletionsApi = CompletionsApi;