import { Result } from '../../../util/common/result';
import { CancellationToken } from '../../../util/vs/base/common/cancellation';
import { IHeaders } from '../../networking/common/fetcherService';
import { ResponseStream } from './responseStream';
export declare namespace Completions {
    interface BaseCompletionsParams {
        prompt: string;
        stop?: string[];
        top_p?: number;
        best_of?: number;
        max_tokens?: number;
        temperature?: number;
        presence_penalty?: number;
        frequency_penalty?: number;
        model?: string;
        logprobs?: number;
        n?: number;
        stream: true;
    }
    interface CodexV2Params {
        suffix?: string;
        extra?: {
            [key: string]: any;
        };
        code_annotations?: boolean;
    }
    export interface ModelParams extends BaseCompletionsParams, CodexV2Params {
    }
    export class RequestCancelled {
        readonly kind: "cancelled";
    }
    export class UnsuccessfulResponse {
        readonly status: number;
        readonly statusText: string;
        readonly headers: IHeaders;
        readonly text: () => Promise<string>;
        readonly kind: "not-200-status";
        constructor(status: number, statusText: string, headers: IHeaders, text: () => Promise<string>);
    }
    export class Unexpected {
        readonly error: Error;
        readonly kind: "unexpected";
        constructor(error: Error);
    }
    export type CompletionsFetchFailure = Completions.RequestCancelled | Completions.UnsuccessfulResponse | Completions.Unexpected;
    export namespace Internal {
        type FetchOptions = {
            requestId: string;
            headers: {
                [name: string]: string;
            };
            body: string;
        };
    }
    export {};
}
export type CompletionsFetchErrorType = 'stop_content_filter' | 'stop_length' | 'unknown';
export declare class CompletionsFetchError extends Error {
    readonly type: CompletionsFetchErrorType;
    readonly requestId: string;
    constructor(type: CompletionsFetchErrorType, requestId: string, message: string);
}
export declare const ICompletionsFetchService: import("../../../util/common/services").ServiceIdentifier<ICompletionsFetchService>;
/**
 * OpenAI has completions and _chat_ completions endpoints. This's (non-chat) completions endpoint fetcher.
 */
export interface ICompletionsFetchService {
    readonly _serviceBrand: undefined;
    fetch(url: string, secretKey: string, params: Completions.ModelParams, requestId: string, ct: CancellationToken, headerOverrides?: Record<string, string>): Promise<Result<ResponseStream, Completions.CompletionsFetchFailure>>;
    disconnectAll(): Promise<unknown>;
}
//# sourceMappingURL=completionsFetchService.d.ts.map