import { Raw } from '@vscode/prompt-tsx';
import type { CancellationToken } from 'vscode';
import { IChatMLFetcher, IFetchMLOptions, Source } from '../../../platform/chat/common/chatMLFetcher';
import { ChatResponse, ChatResponses } from '../../../platform/chat/common/commonTypes';
import { IConversationOptions } from '../../../platform/chat/common/conversationOptions';
import { ILogService } from '../../../platform/log/common/logService';
import { OptionalChatRequestParams } from '../../../platform/networking/common/fetch';
import { IFetcherService } from '../../../platform/networking/common/fetcherService';
import { IRequestLogger } from '../../../platform/requestLogger/node/requestLogger';
import { ITelemetryService } from '../../../platform/telemetry/common/telemetry';
import { Emitter } from '../../../util/vs/base/common/event';
import { IInstantiationService } from '../../../util/vs/platform/instantiation/common/instantiation';
export interface IMadeChatRequestEvent {
    readonly messages: Raw.ChatMessage[];
    readonly model: string;
    readonly source?: Source;
    readonly tokenCount?: number;
}
export declare abstract class AbstractChatMLFetcher implements IChatMLFetcher {
    protected readonly options: IConversationOptions;
    _serviceBrand: undefined;
    constructor(options: IConversationOptions);
    protected preparePostOptions(requestOptions: OptionalChatRequestParams): OptionalChatRequestParams;
    protected readonly _onDidMakeChatMLRequest: Emitter<IMadeChatRequestEvent>;
    readonly onDidMakeChatMLRequest: import("../../../util/vs/base/common/event").Event<IMadeChatRequestEvent>;
    fetchOne(opts: IFetchMLOptions, token: CancellationToken): Promise<ChatResponse>;
    /**
     * Note: the returned array of strings may be less than `n` (e.g., in case there were errors during streaming)
     */
    abstract fetchMany(opts: IFetchMLOptions, token: CancellationToken): Promise<ChatResponses>;
}
export declare class ChatMLFetcherImpl extends AbstractChatMLFetcher {
    private readonly _fetcherService;
    private readonly _telemetryService;
    private readonly _requestLogger;
    private readonly _logService;
    private readonly _instantiationService;
    constructor(_fetcherService: IFetcherService, _telemetryService: ITelemetryService, _requestLogger: IRequestLogger, _logService: ILogService, _instantiationService: IInstantiationService, options: IConversationOptions);
    /**
     * Note: the returned array of strings may be less than `n` (e.g., in case there were errors during streaming)
     */
    fetchMany(opts: IFetchMLOptions, token: CancellationToken): Promise<ChatResponses>;
    private _sendCancellationTelemetry;
    private _sendResponseErrorTelemetry;
    private processSuccessfulResponse;
    private filterImageMessages;
    private isRepetitive;
    private processCanceledResponse;
    private processFailedResponse;
    private processError;
}
//# sourceMappingURL=chatMLFetcher.d.ts.map