large-models-interface
Version:
A comprehensive, unified interface for all types of AI models - natural language, vision, audio, and video. Supports 51 providers with dynamic model discovery and multi-modal capabilities.
33 lines (27 loc) • 791 B
JavaScript
/**
* @file /src/utils/llmInterface.js
* @description Build the base LLMInterface used providers.js
*/
const { listOfActiveProviders } = require('../config/providers.js');
const interfaces = {};
for (const interfaceName of listOfActiveProviders) {
interfaces[interfaceName] = `../interfaces/${interfaceName}`;
}
/**
* Dynamically imports and initializes LLM interfaces based on the list of active providers.
* @namespace
*/
const LLMInterface = {};
Object.keys(interfaces).forEach((key) => {
Object.defineProperty(LLMInterface, key, {
get: function () {
if (!this[`_${key}`]) {
this[`_${key}`] = require(interfaces[key]);
}
return this[`_${key}`];
},
enumerable: true,
configurable: true,
});
});
module.exports = { LLMInterface };