export class Env {
    OPENAI_API_KEY;
    GPT_MODEL;
    CONTEXT_WINDOW_TOKENS;
    MAX_RESPONSE_TOKENS;
    SERP_API_KEY;
    OPENAI_API_BASE_URL;
    constructor(envVars) {
        const { OPENAI_API_KEY, GPT_MODEL, CONTEXT_WINDOW_TOKENS, MAX_RESPONSE_TOKENS, SERP_API_KEY, OPENAI_API_BASE_URL } = envVars;
        if (!OPENAI_API_KEY) {
            throw missingEnvError('OPENAI_API_KEY');
        }
        if (!GPT_MODEL) {
            throw missingEnvError('GPT_MODEL');
        }
        if (!CONTEXT_WINDOW_TOKENS) {
            throw missingEnvError('CONTEXT_WINDOW_TOKENS');
        }
        if (!MAX_RESPONSE_TOKENS) {
            throw missingEnvError('MAX_RESPONSE_TOKENS');
        }
        return {
            OPENAI_API_KEY,
            GPT_MODEL,
            CONTEXT_WINDOW_TOKENS: Number(CONTEXT_WINDOW_TOKENS),
            MAX_RESPONSE_TOKENS: Number(MAX_RESPONSE_TOKENS),
            SERP_API_KEY,
            OPENAI_API_BASE_URL: OPENAI_API_BASE_URL || undefined,
        };
    }
}
function missingEnvError(prop) {
    return new Error(`Missing "${prop}" Environment Variable - please create a .env file, see .env.template for help.`);
}
