import { CancellationToken as ICancellationToken } from 'vscode-languageserver-protocol';
import { IInstantiationService, ServicesAccessor } from '../../../../../../util/vs/platform/instantiation/common/instantiation';
import { LlmNESTelemetryBuilder } from '../../../../../inlineEdits/node/nextEditProviderTelemetry';
import { ICompletionsUserErrorNotifierService } from '../error/userErrorNotifier';
import { ICompletionsFeaturesService } from '../experiments/featuresService';
import { ICompletionsLogTargetService, Logger } from '../logger';
import { FinishedCallback, ICompletionsOpenAIFetcherService } from '../openai/fetch';
import { APIChoice } from '../openai/openai';
import { TelemetryWithExp } from '../telemetry';
import { ICompletionsRuntimeModeService } from '../util/runtimeMode';
import { ICompletionsCacheService } from './completionsCache';
import { RequestContext } from './requestContext';
import { GhostTextResultWithTelemetry } from './telemetry';
export type GetNetworkCompletionsType = GhostTextResultWithTelemetry<[APIChoice, Promise<void>]>;
export type GetAllNetworkCompletionsType = GhostTextResultWithTelemetry<[APIChoice[], Promise<void>]>;
export declare const logger: Logger;
export declare class CompletionsFromNetwork {
    private readonly instantiationService;
    private readonly fetcherService;
    private readonly featuresService;
    private readonly runtimeMode;
    private readonly logTarget;
    private readonly completionsCacheService;
    private readonly userErrorNotifier;
    constructor(instantiationService: IInstantiationService, fetcherService: ICompletionsOpenAIFetcherService, featuresService: ICompletionsFeaturesService, runtimeMode: ICompletionsRuntimeModeService, logTarget: ICompletionsLogTargetService, completionsCacheService: ICompletionsCacheService, userErrorNotifier: ICompletionsUserErrorNotifierService);
    /** Requests new completion from OpenAI, should be called if and only if the completions for given prompt were not cached before.
     *  It returns only first completion, additional completions are added to the caches in the background.
     *  Copies from the base telemetry data are used as the basis for each choice's telemetry.
     */
    getCompletionsFromNetwork(requestContext: RequestContext, baseTelemetryData: TelemetryWithExp, cancellationToken: ICancellationToken | undefined, finishedCb: FinishedCallback, telemetryBuilder: LlmNESTelemetryBuilder): Promise<GetNetworkCompletionsType>;
    /** Requests new completion from OpenAI, should be called if and only if we are in the servers-side termination mode, and it's follow-up cycling request
     *  It returns all requested completions
     *  Copies from the base telemetry data are used as the basis for each choice's telemetry.
     */
    getAllCompletionsFromNetwork(requestContext: RequestContext, baseTelemetryData: TelemetryWithExp, cancellationToken: ICancellationToken | undefined, finishedCb: FinishedCallback, telemetryBuilder: LlmNESTelemetryBuilder): Promise<GetAllNetworkCompletionsType>;
    private genericGetCompletionsFromNetwork;
    private _genericGetCompletionsFromNetwork;
}
/**
 * Post-proceses a completion choice based on the current request context and existing choices.
 */
export declare function postProcessChoices(newChoice: APIChoice, currentChoices?: APIChoice[]): APIChoice | undefined;
export declare function makeGhostAPIChoice(choice: APIChoice, options: {
    forceSingleLine: boolean;
}): APIChoice;
export declare function telemetryPerformance(accessor: ServicesAccessor, performanceKind: string, choice: APIChoice, requestStart: number, processingTimeMs: number): void;
//# sourceMappingURL=completionsFromNetwork.d.ts.map