"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "DeepInfra", {
    enumerable: true,
    get: function() {
        return DeepInfra;
    }
});
const _env = require("@llamaindex/env");
const _openai = require("./openai.js");
const ENV_VARIABLE_NAME = "DEEPINFRA_API_TOKEN";
const DEFAULT_MODEL = "mistralai/Mixtral-8x22B-Instruct-v0.1";
const BASE_URL = "https://api.deepinfra.com/v1/openai";
class DeepInfra extends _openai.OpenAI {
    constructor(init){
        const { apiKey = (0, _env.getEnv)(ENV_VARIABLE_NAME), additionalSessionOptions = {}, model = DEFAULT_MODEL, ...rest } = init ?? {};
        if (!apiKey) {
            throw new Error(`Set DeepInfra API key in ${ENV_VARIABLE_NAME} env variable`);
        }
        additionalSessionOptions.baseURL = additionalSessionOptions.baseURL ?? BASE_URL;
        super({
            apiKey,
            additionalSessionOptions,
            model,
            ...rest
        });
    }
}
