declare function headers(apiKey: string, customHeaders?: Record<string, string>): Record<string, string>;
declare namespace AzureOpenAIChatTypes {
    type RequestOptions = {
        apiKey: string;
        apiUrl: string | {
            resourceName: string;
            deploymentId: string;
        };
        fetch?: typeof fetch;
        headers?: Record<string, string>;
        signal?: AbortSignal;
    };
    type Message = {
        role: 'assistant' | 'user' | 'system' | 'function';
        content?: string;
        name?: string;
        function_call?: {
            name: string;
            arguments: string;
        };
    };
    type FunctionSpec = {
        name: string;
        description?: string;
        parameters?: Record<string, unknown>;
    };
    type Request = {
        messages: Message[];
        functions?: FunctionSpec[];
        function_call?: 'none' | 'auto' | {
            name: string;
        };
        n?: number | null;
        temperature?: number | null;
        top_p?: number | null;
        stop?: string | string[] | null;
        max_tokens?: number;
        presence_penalty?: number;
        frequence_penalty?: number;
        logit_bias?: Record<string, number> | number;
        user?: string;
    };
    type ErrorBase = {
        code: string;
        message: string;
    };
    type ContentFilterResult = {
        severity: 'safe' | 'low' | 'medium' | 'high';
        filtered: boolean;
    };
    type ContentFilterResults = {
        sexual: ContentFilterResult;
        violence: ContentFilterResult;
        hate: ContentFilterResult;
        self_harm: ContentFilterResult;
        error: ErrorBase;
    };
    type PromptFilterResult = {
        prompt_index: number;
        content_filter_results: ContentFilterResults;
    };
    type Response = {
        id: string;
        object: string;
        created: number;
        model: string;
        prompt_filter_results?: PromptFilterResult[];
        choices: Array<{
            index: number;
            finish_reason: string;
            message: Message;
            content_filter_results: ContentFilterResults;
        }>;
        usage?: {
            completion_tokens: number;
            prompt_tokens: number;
            total_tokens: number;
        };
    };
    type Chunk = {
        id: string;
        object: string;
        created: number;
        model: string;
        choices: Array<{
            index: number;
            delta: Delta;
            finish_reason: 'stop' | 'length' | 'function_call' | null;
        }>;
    };
    type Delta = {
        role?: 'system' | 'user' | 'assistant' | 'function';
        content?: string | null;
        function_call?: {
            name?: string;
            arguments?: string;
        };
    };
}
/**
 * Run a chat completion against the Azure-openAI API.
 *
 * @see https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions
 *
 * @param request The request body sent to Azure. See Azure's documentation for all available parameters.
 * @param options
 * @param options.apiKey Azure API key.
 * @param options.resourceName Azure resource name.
 * @param options.deploymentId Azure deployment id.
 * @param options.apiUrl The url of the OpenAI (or compatible) API. If this is passed, resourceName and deploymentId are ignored.
 * @param options.fetch A custom implementation of fetch. Defaults to globalThis.fetch.
 * @param options.headers Optionally add additional HTTP headers to the request.
 * @param options.signal An AbortSignal that can be used to abort the fetch request.
 *
 * @returns an Azure OpenAI chat completion. See Azure's documentation for /chat/completions
 */
declare function run(request: AzureOpenAIChatTypes.Request, options: AzureOpenAIChatTypes.RequestOptions): Promise<AzureOpenAIChatTypes.Response>;
/**
 * Run a streaming chat completion against the Azure-openAI API. The resulting stream is the raw unmodified bytes from the API.
 *
 * @see https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions
 *
 * @param request The request body sent to Azure. See Azure's documentation for all available parameters.
 * @param options
 * @param options.apiKey Azure API key.
 * @param options.resourceName Azure resource name.
 * @param options.deploymentId Azure deployment id.
 * @param options.apiUrl The url of the OpenAI (or compatible) API. If this is passed, resourceName and deploymentId are ignored.
 * @param options.fetch A custom implementation of fetch. Defaults to globalThis.fetch.
 * @param options.headers Optionally add additional HTTP headers to the request.
 * @param options.signal An AbortSignal that can be used to abort the fetch request.
 *
 * @returns A stream of bytes directly from the API.
 */
declare function streamBytes(request: AzureOpenAIChatTypes.Request, options: AzureOpenAIChatTypes.RequestOptions): Promise<ReadableStream<Uint8Array>>;
/**
 * Run a streaming chat completion against the Azure-openAI API. The resulting stream is the parsed stream data as JavaScript objects.
 *
 * @see https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions
 *
 * Example object:
 * {"id":"chatcmpl-864d71dHehdlb2Vjq7WP5nHz10LRO","object":"chat.completion.chunk","created":1696458457,"model":"gpt-4","choices":[{"index":0,"finish_reason":null,"delta":{"content":" me"}}],"usage":null}
 *
 * @param request The request body sent to Azure. See Azure's documentation for all available parameters.
 * @param options
 * @param options.apiKey Azure API key.
 * @param options.resourceName Azure resource name.
 * @param options.deploymentId Azure deployment id.
 * @param options.apiUrl The url of the OpenAI (or compatible) API. If this is passed, resourceName and deploymentId are ignored.
 * @param options.fetch A custom implementation of fetch. Defaults to globalThis.fetch.
 * @param options.headers Optionally add additional HTTP headers to the request.
 * @param options.signal An AbortSignal that can be used to abort the fetch request.
 *
 * @returns A stream of objects representing each chunk from the API.
 */
declare function stream(request: AzureOpenAIChatTypes.Request, options: AzureOpenAIChatTypes.RequestOptions): Promise<ReadableStream<AzureOpenAIChatTypes.Chunk>>;
/**
 * Run a streaming chat completion against the Azure-openAI API. The resulting stream emits only the string tokens.
 *
 * @see https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions
 *
 * @param request The request body sent to Azure. See Azure's documentation for all available parameters.
 * @param options
 * @param options.apiKey Azure API key.
 * @param options.resourceName Azure resource name.
 * @param options.deploymentId Azure deployment id.
 * @param options.apiUrl The url of the OpenAI (or compatible) API. If this is passed, resourceName and deploymentId are ignored.
 * @param options.fetch A custom implementation of fetch. Defaults to globalThis.fetch.
 * @param options.headers Optionally add additional HTTP headers to the request.
 * @param options.signal An AbortSignal that can be used to abort the fetch request.
 *
 * @returns A stream of tokens from the API.
 */
declare function streamTokens(request: AzureOpenAIChatTypes.Request, options: AzureOpenAIChatTypes.RequestOptions): Promise<ReadableStream<string>>;
declare class AzureOpenAIChat {
    static run: typeof run;
    static streamBytes: typeof streamBytes;
    static stream: typeof stream;
    static streamTokens: typeof streamTokens;
}

export { AzureOpenAIChat, AzureOpenAIChatTypes, headers };
