import OpenAI from 'openai';
import type { ApiModerationProvider, ApiProvider, CallApiContextParams, CallApiOptionsParams, EnvOverrides, ProviderEmbeddingResponse, ProviderModerationResponse, ProviderResponse } from '../types.js';
import { OpenAiFunction, OpenAiTool } from './openaiUtil';
interface OpenAiSharedOptions {
    apiKey?: string;
    apiKeyEnvar?: string;
    apiHost?: string;
    apiBaseUrl?: string;
    organization?: string;
    cost?: number;
    headers?: {
        [key: string]: string;
    };
}
type OpenAiCompletionOptions = OpenAiSharedOptions & {
    temperature?: number;
    max_tokens?: number;
    top_p?: number;
    frequency_penalty?: number;
    presence_penalty?: number;
    best_of?: number;
    functions?: OpenAiFunction[];
    function_call?: 'none' | 'auto' | {
        name: string;
    };
    tools?: OpenAiTool[];
    tool_choice?: 'none' | 'auto' | 'required' | {
        type: 'function';
        function?: {
            name: string;
        };
    };
    response_format?: {
        type: 'json_object';
    };
    stop?: string[];
    seed?: number;
    passthrough?: object;
    /**
     * If set, automatically call these functions when the assistant activates
     * these function tools.
     */
    functionToolCallbacks?: Record<OpenAI.FunctionDefinition['name'], (arg: string) => Promise<string>>;
};
export declare class OpenAiGenericProvider implements ApiProvider {
    modelName: string;
    config: OpenAiSharedOptions;
    env?: EnvOverrides;
    constructor(modelName: string, options?: {
        config?: OpenAiSharedOptions;
        id?: string;
        env?: EnvOverrides;
    });
    id(): string;
    toString(): string;
    getOrganization(): string | undefined;
    getApiUrlDefault(): string;
    getApiUrl(): string;
    getApiKey(): string | undefined;
    callApi(prompt: string, context?: CallApiContextParams, callApiOptions?: CallApiOptionsParams): Promise<ProviderResponse>;
}
export declare class OpenAiEmbeddingProvider extends OpenAiGenericProvider {
    callEmbeddingApi(text: string): Promise<ProviderEmbeddingResponse>;
}
export declare class OpenAiCompletionProvider extends OpenAiGenericProvider {
    static OPENAI_COMPLETION_MODELS: ({
        id: string;
        cost: {
            input: number;
            output: number;
        };
    } | {
        id: string;
        cost?: undefined;
    })[];
    static OPENAI_COMPLETION_MODEL_NAMES: string[];
    config: OpenAiCompletionOptions;
    constructor(modelName: string, options?: {
        config?: OpenAiCompletionOptions;
        id?: string;
        env?: EnvOverrides;
    });
    callApi(prompt: string, context?: CallApiContextParams, callApiOptions?: CallApiOptionsParams): Promise<ProviderResponse>;
}
export declare class OpenAiChatCompletionProvider extends OpenAiGenericProvider {
    static OPENAI_CHAT_MODELS: {
        id: string;
        cost: {
            input: number;
            output: number;
        };
    }[];
    static OPENAI_CHAT_MODEL_NAMES: string[];
    config: OpenAiCompletionOptions;
    constructor(modelName: string, options?: {
        config?: OpenAiCompletionOptions;
        id?: string;
        env?: EnvOverrides;
    });
    callApi(prompt: string, context?: CallApiContextParams, callApiOptions?: CallApiOptionsParams): Promise<ProviderResponse>;
}
type OpenAiAssistantOptions = OpenAiSharedOptions & {
    modelName?: string;
    instructions?: string;
    tools?: OpenAI.Beta.Threads.ThreadCreateAndRunParams['tools'];
    /**
     * If set, automatically call these functions when the assistant activates
     * these function tools.
     */
    functionToolCallbacks?: Record<OpenAI.FunctionDefinition['name'], (arg: string) => Promise<string>>;
    metadata?: object[];
    temperature?: number;
    toolChoice?: 'none' | 'auto' | {
        type: 'function';
        function?: {
            name: string;
        };
    } | {
        type: 'file_search';
    };
    attachments?: OpenAI.Beta.Threads.Message.Attachment[];
};
export declare class OpenAiAssistantProvider extends OpenAiGenericProvider {
    assistantId: string;
    assistantConfig: OpenAiAssistantOptions;
    constructor(assistantId: string, options?: {
        config?: OpenAiAssistantOptions;
        id?: string;
        env?: EnvOverrides;
    });
    callApi(prompt: string, context?: CallApiContextParams, callApiOptions?: CallApiOptionsParams): Promise<ProviderResponse>;
}
type OpenAiImageOptions = OpenAiSharedOptions & {
    size?: string;
};
export declare class OpenAiImageProvider extends OpenAiGenericProvider {
    config: OpenAiImageOptions;
    constructor(modelName: string, options?: {
        config?: OpenAiImageOptions;
        id?: string;
        env?: EnvOverrides;
    });
    callApi(prompt: string, context?: CallApiContextParams, callApiOptions?: CallApiOptionsParams): Promise<ProviderResponse>;
}
export declare class OpenAiModerationProvider extends OpenAiGenericProvider implements ApiModerationProvider {
    callModerationApi(userPrompt: string, // userPrompt is not supported by OpenAI moderation API
    assistantResponse: string): Promise<ProviderModerationResponse>;
}
export declare const DefaultEmbeddingProvider: OpenAiEmbeddingProvider;
export declare const DefaultGradingProvider: OpenAiChatCompletionProvider;
export declare const DefaultGradingJsonProvider: OpenAiChatCompletionProvider;
export declare const DefaultSuggestionsProvider: OpenAiChatCompletionProvider;
export declare const DefaultModerationProvider: OpenAiModerationProvider;
export {};
//# sourceMappingURL=openai.d.ts.map