@cotofe/service-of-litellm
Version:
OpenAPI client for @cotofe/service-of-litellm
510 lines (509 loc) • 26.6 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.LitellmHealthApi = void 0;
const runtime = require("../runtime");
/**
*
*/
class LitellmHealthApi extends runtime.BaseAPI {
/**
* Returns a list of litellm level settings This is useful for debugging and ensuring the proxy server is configured correctly. Response schema: ``` { \"alerting\": _alerting, \"litellm.callbacks\": litellm_callbacks, \"litellm.input_callback\": litellm_input_callbacks, \"litellm.failure_callback\": litellm_failure_callbacks, \"litellm.success_callback\": litellm_success_callbacks, \"litellm._async_success_callback\": litellm_async_success_callbacks, \"litellm._async_failure_callback\": litellm_async_failure_callbacks, \"litellm._async_input_callback\": litellm_async_input_callbacks, \"all_litellm_callbacks\": all_litellm_callbacks, \"num_callbacks\": len(all_litellm_callbacks), \"num_alerting\": _num_alerting, \"litellm.request_timeout\": litellm.request_timeout, } ```
* Active Callbacks
*/
activeCallbacksActiveCallbacksGetRaw(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
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: `/active/callbacks`,
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);
}
});
}
/**
* Returns a list of litellm level settings This is useful for debugging and ensuring the proxy server is configured correctly. Response schema: ``` { \"alerting\": _alerting, \"litellm.callbacks\": litellm_callbacks, \"litellm.input_callback\": litellm_input_callbacks, \"litellm.failure_callback\": litellm_failure_callbacks, \"litellm.success_callback\": litellm_success_callbacks, \"litellm._async_success_callback\": litellm_async_success_callbacks, \"litellm._async_failure_callback\": litellm_async_failure_callbacks, \"litellm._async_input_callback\": litellm_async_input_callbacks, \"all_litellm_callbacks\": all_litellm_callbacks, \"num_callbacks\": len(all_litellm_callbacks), \"num_alerting\": _num_alerting, \"litellm.request_timeout\": litellm.request_timeout, } ```
* Active Callbacks
*/
activeCallbacksActiveCallbacksGet(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.activeCallbacksActiveCallbacksGetRaw(initOverrides);
return yield response.value();
});
}
/**
* Returns a list of litellm level settings This is useful for debugging and ensuring the proxy server is configured correctly. Response schema: ``` { \"alerting\": _alerting, \"litellm.callbacks\": litellm_callbacks, \"litellm.input_callback\": litellm_input_callbacks, \"litellm.failure_callback\": litellm_failure_callbacks, \"litellm.success_callback\": litellm_success_callbacks, \"litellm._async_success_callback\": litellm_async_success_callbacks, \"litellm._async_failure_callback\": litellm_async_failure_callbacks, \"litellm._async_input_callback\": litellm_async_input_callbacks, \"all_litellm_callbacks\": all_litellm_callbacks, \"num_callbacks\": len(all_litellm_callbacks), \"num_alerting\": _num_alerting, \"litellm.request_timeout\": litellm.request_timeout, } ```
* Active Callbacks
*/
activeCallbacksSettingsGetRaw(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
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: `/settings`,
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);
}
});
}
/**
* Returns a list of litellm level settings This is useful for debugging and ensuring the proxy server is configured correctly. Response schema: ``` { \"alerting\": _alerting, \"litellm.callbacks\": litellm_callbacks, \"litellm.input_callback\": litellm_input_callbacks, \"litellm.failure_callback\": litellm_failure_callbacks, \"litellm.success_callback\": litellm_success_callbacks, \"litellm._async_success_callback\": litellm_async_success_callbacks, \"litellm._async_failure_callback\": litellm_async_failure_callbacks, \"litellm._async_input_callback\": litellm_async_input_callbacks, \"all_litellm_callbacks\": all_litellm_callbacks, \"num_callbacks\": len(all_litellm_callbacks), \"num_alerting\": _num_alerting, \"litellm.request_timeout\": litellm.request_timeout, } ```
* Active Callbacks
*/
activeCallbacksSettingsGet(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.activeCallbacksSettingsGetRaw(initOverrides);
return yield response.value();
});
}
/**
* 🚨 USE `/health/liveliness` to health check the proxy 🚨 See more 👉 https://docs.litellm.ai/docs/proxy/health Check the health of all the endpoints in config.yaml To run health checks in the background, add this to config.yaml: ``` general_settings: # ... other settings background_health_checks: True ``` else, the health checks will be run on models when /health is called.
* Health Endpoint
*/
healthEndpointHealthGetRaw(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: `/health`,
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);
}
});
}
/**
* 🚨 USE `/health/liveliness` to health check the proxy 🚨 See more 👉 https://docs.litellm.ai/docs/proxy/health Check the health of all the endpoints in config.yaml To run health checks in the background, add this to config.yaml: ``` general_settings: # ... other settings background_health_checks: True ``` else, the health checks will be run on models when /health is called.
* Health Endpoint
*/
healthEndpointHealthGet() {
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
const response = yield this.healthEndpointHealthGetRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Unprotected endpoint for checking if worker is alive
* Health Liveliness
*/
healthLivelinessHealthLivelinessGetRaw(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
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: `/health/liveliness`,
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);
}
});
}
/**
* Unprotected endpoint for checking if worker is alive
* Health Liveliness
*/
healthLivelinessHealthLivelinessGet(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.healthLivelinessHealthLivelinessGetRaw(initOverrides);
return yield response.value();
});
}
/**
* Unprotected endpoint for checking if worker is alive
* Health Liveliness
*/
healthLivelinessHealthLivenessGetRaw(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
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: `/health/liveness`,
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);
}
});
}
/**
* Unprotected endpoint for checking if worker is alive
* Health Liveliness
*/
healthLivelinessHealthLivenessGet(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.healthLivelinessHealthLivenessGetRaw(initOverrides);
return yield response.value();
});
}
/**
* Options endpoint for health/liveliness check.
* Health Liveliness Options
*/
healthLivelinessOptionsHealthLivelinessOptionsRaw(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
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: `/health/liveliness`,
method: 'OPTIONS',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Options endpoint for health/liveliness check.
* Health Liveliness Options
*/
healthLivelinessOptionsHealthLivelinessOptions(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.healthLivelinessOptionsHealthLivelinessOptionsRaw(initOverrides);
return yield response.value();
});
}
/**
* Options endpoint for health/liveliness check.
* Health Liveliness Options
*/
healthLivelinessOptionsHealthLivenessOptionsRaw(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
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: `/health/liveness`,
method: 'OPTIONS',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Options endpoint for health/liveliness check.
* Health Liveliness Options
*/
healthLivelinessOptionsHealthLivenessOptions(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.healthLivelinessOptionsHealthLivenessOptionsRaw(initOverrides);
return yield response.value();
});
}
/**
* Unprotected endpoint for checking if worker can receive requests
* Health Readiness
*/
healthReadinessHealthReadinessGetRaw(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
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: `/health/readiness`,
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);
}
});
}
/**
* Unprotected endpoint for checking if worker can receive requests
* Health Readiness
*/
healthReadinessHealthReadinessGet(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.healthReadinessHealthReadinessGetRaw(initOverrides);
return yield response.value();
});
}
/**
* Options endpoint for health/readiness check.
* Health Readiness Options
*/
healthReadinessOptionsHealthReadinessOptionsRaw(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
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: `/health/readiness`,
method: 'OPTIONS',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Options endpoint for health/readiness check.
* Health Readiness Options
*/
healthReadinessOptionsHealthReadinessOptions(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.healthReadinessOptionsHealthReadinessOptionsRaw(initOverrides);
return yield response.value();
});
}
/**
* Use this admin-only endpoint to check if the service is healthy. Example: ``` curl -L -X GET \'http://0.0.0.0:4000/health/services?service=datadog\' -H \'Authorization: Bearer sk-1234\' ```
* Health Services Endpoint
*/
healthServicesEndpointHealthServicesGetRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.service == null) {
throw new runtime.RequiredError('service', 'Required parameter "service" was null or undefined when calling healthServicesEndpointHealthServicesGet().');
}
const queryParameters = {};
if (requestParameters.service != null) {
queryParameters.service = requestParameters.service;
}
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: `/health/services`,
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);
}
});
}
/**
* Use this admin-only endpoint to check if the service is healthy. Example: ``` curl -L -X GET \'http://0.0.0.0:4000/health/services?service=datadog\' -H \'Authorization: Bearer sk-1234\' ```
* Health Services Endpoint
*/
healthServicesEndpointHealthServicesGet(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.healthServicesEndpointHealthServicesGetRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* [DEPRECATED] use `/health/liveliness` instead. A test endpoint that pings the proxy server to check if it\'s healthy. Parameters: request (Request): The incoming request. Returns: dict: A dictionary containing the route of the request URL.
* Test Endpoint
*/
testEndpointTestGetRaw(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
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: `/test`,
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);
}
});
}
/**
* [DEPRECATED] use `/health/liveliness` instead. A test endpoint that pings the proxy server to check if it\'s healthy. Parameters: request (Request): The incoming request. Returns: dict: A dictionary containing the route of the request URL.
* Test Endpoint
*/
testEndpointTestGet(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.testEndpointTestGetRaw(initOverrides);
return yield response.value();
});
}
/**
* Test a direct connection to a specific model. This endpoint allows you to verify if your proxy can successfully connect to a specific model. It\'s useful for troubleshooting model connectivity issues without going through the full proxy routing. Example: ```bash curl -X POST \'http://localhost:4000/health/test_connection\' \\ -H \'Authorization: Bearer sk-1234\' \\ -H \'Content-Type: application/json\' \\ -d \'{ \"litellm_params\": { \"model\": \"gpt-4\", \"custom_llm_provider\": \"azure_ai\", \"litellm_credential_name\": null, \"api_key\": \"6xxxxxxx\", \"api_base\": \"https://litellm8397336933.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21\", }, \"mode\": \"chat\" }\' ``` Returns: dict: A dictionary containing the health check result with either success information or error details.
* Test Model Connection
*/
testModelConnectionHealthTestConnectionPostRaw(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: `/health/test_connection`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: requestParameters.bodyTestModelConnectionHealthTestConnectionPost,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse(response);
}
else {
return new runtime.TextApiResponse(response);
}
});
}
/**
* Test a direct connection to a specific model. This endpoint allows you to verify if your proxy can successfully connect to a specific model. It\'s useful for troubleshooting model connectivity issues without going through the full proxy routing. Example: ```bash curl -X POST \'http://localhost:4000/health/test_connection\' \\ -H \'Authorization: Bearer sk-1234\' \\ -H \'Content-Type: application/json\' \\ -d \'{ \"litellm_params\": { \"model\": \"gpt-4\", \"custom_llm_provider\": \"azure_ai\", \"litellm_credential_name\": null, \"api_key\": \"6xxxxxxx\", \"api_base\": \"https://litellm8397336933.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21\", }, \"mode\": \"chat\" }\' ``` Returns: dict: A dictionary containing the health check result with either success information or error details.
* Test Model Connection
*/
testModelConnectionHealthTestConnectionPost() {
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
const response = yield this.testModelConnectionHealthTestConnectionPostRaw(requestParameters, initOverrides);
return yield response.value();
});
}
}
exports.LitellmHealthApi = LitellmHealthApi;