"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createAiCompletion = createAiCompletion;
exports.createEmbedding = createEmbedding;
exports.listModelsForProvider = listModelsForProvider;
exports.listAllModels = listAllModels;
exports.listAllProviders = listAllProviders;
exports.listAllCompletionModels = listAllCompletionModels;
exports.listAllEmbeddingModels = listAllEmbeddingModels;
exports.listAllImageModels = listAllImageModels;
exports.listAllAudioModels = listAllAudioModels;
exports.listAllVideoModels = listAllVideoModels;
const Tools_1 = require("../../services/Tools");
const services_1 = require("../../services");
function createAiCompletion(provider, options) {
    const toolService = (this instanceof Tools_1.ToolsService ? this : (0, services_1.services)().Tools);
    const toolContext = toolService.getContext();
    const { Clients: contextClients } = toolContext;
    if (!contextClients) {
        throw new Error("Clients not available in tool context");
    }
    return contextClients.createCompletion(provider, options);
}
function createEmbedding(provider, options) {
    const toolService = (this instanceof Tools_1.ToolsService ? this : (0, services_1.services)().Tools);
    const toolContext = toolService.getContext();
    const { Clients: contextClients } = toolContext;
    if (!contextClients) {
        throw new Error("Clients not available in tool context");
    }
    return contextClients.createEmbedding(provider, options);
}
async function listModelsForProvider(provider) {
    const toolService = (this instanceof Tools_1.ToolsService ? this : (0, services_1.services)().Tools);
    const toolContext = toolService.getContext();
    const { Clients: contextClients } = toolContext;
    if (!contextClients) {
        throw new Error("Clients not available in tool context");
    }
    return contextClients.getRegisteredModels(provider);
}
async function listAllModels() {
    const toolService = (this instanceof Tools_1.ToolsService ? this : (0, services_1.services)().Tools);
    const toolContext = toolService.getContext();
    const { Clients: contextClients } = toolContext;
    if (!contextClients) {
        throw new Error("Clients not available in tool context");
    }
    return contextClients.listAllModels();
}
async function listAllProviders() {
    const toolService = (this instanceof Tools_1.ToolsService ? this : (0, services_1.services)().Tools);
    const toolContext = toolService.getContext();
    const { Clients: contextClients } = toolContext;
    if (!contextClients) {
        throw new Error("Clients not available in tool context");
    }
    return contextClients.listAllProviders();
}
async function listAllCompletionModels() {
    const toolService = (this instanceof Tools_1.ToolsService ? this : (0, services_1.services)().Tools);
    const toolContext = toolService.getContext();
    const { Clients: contextClients } = toolContext;
    if (!contextClients) {
        throw new Error("Clients not available in tool context");
    }
    return contextClients.listAllCompletionModels();
}
async function listAllEmbeddingModels() {
    const toolService = (this instanceof Tools_1.ToolsService ? this : (0, services_1.services)().Tools);
    const toolContext = toolService.getContext();
    const { Clients: contextClients } = toolContext;
    if (!contextClients) {
        throw new Error("Clients not available in tool context");
    }
    return contextClients.listAllEmbeddingModels();
}
async function listAllImageModels() {
    const toolService = (this instanceof Tools_1.ToolsService ? this : (0, services_1.services)().Tools);
    const toolContext = toolService.getContext();
    const { Clients: contextClients } = toolContext;
    if (!contextClients) {
        throw new Error("Clients not available in tool context");
    }
    return contextClients.listAllImageModels();
}
async function listAllAudioModels() {
    const toolService = (this instanceof Tools_1.ToolsService ? this : (0, services_1.services)().Tools);
    const toolContext = toolService.getContext();
    const { Clients: contextClients } = toolContext;
    if (!contextClients) {
        throw new Error("Clients not available in tool context");
    }
    return contextClients.listAllAudioModels();
}
async function listAllVideoModels() {
    const toolService = (this instanceof Tools_1.ToolsService ? this : (0, services_1.services)().Tools);
    const toolContext = toolService.getContext();
    const { Clients: contextClients } = toolContext;
    if (!contextClients) {
        throw new Error("Clients not available in tool context");
    }
    return contextClients.listAllVideoModels();
}
//# sourceMappingURL=aiClient.js.map