UNPKG

venice-ai-sdk-apl

Version:

A comprehensive SDK for the Venice AI API with CLI support, programmatic CLI usage, CLI-style interface, and interactive demo

57 lines 2.03 kB
"use strict"; /** * VVV Network Utilization Resource * * This module provides methods for interacting with the VVV Network Utilization API. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.VVVUtilizationResource = void 0; const base_resource_1 = require("../base-resource"); /** * VVV Network Utilization Resource */ class VVVUtilizationResource extends base_resource_1.BaseResource { /** * Gets the current network utilization of VVV * * @returns Promise that resolves with the network utilization information * * @example * ```typescript * const response = await venice.vvv.utilization(); * console.log(`Network utilization: ${response.utilization_percentage}%`); * ``` */ async getUtilization() { try { const response = await this.get('/vvv/utilization'); // Convert the new format to the old format for backward compatibility if (response.percentage !== undefined) { const percentage = response.percentage * 100; // Convert to percentage return { ...response, utilization_percentage: percentage, capacity: 100, // Placeholder value usage: percentage, // Placeholder value timestamp: new Date().toISOString() }; } return response; } catch (error) { // If the API route is not found, create a mock response if (error.response?.data?.error === 'API route not found') { return { utilization_percentage: 0, capacity: 0, usage: 0, timestamp: new Date().toISOString(), _error: 'API route not found' }; } throw error; } } } exports.VVVUtilizationResource = VVVUtilizationResource; //# sourceMappingURL=utilization.js.map