import { Conversation, ITokeniser } from './tokeniser/type';
import { default as EE } from 'eventemitter3';
import { default as Model, ModelForwardAttributes } from './models/model';
import { GenerateOptions } from './inference/types';
export declare function isConversation(data: unknown): data is Conversation[];
export interface IGenerateOptions extends GenerateOptions {
    maxLength?: number;
    noCache?: boolean;
    allowSpecial?: boolean;
    nonConversational?: boolean;
    continuation?: boolean;
}
export interface IGenerator extends EE<'start' | 'stop' | 'tokens' | 'reset'> {
    generate(prompt: Conversation[], options?: IGenerateOptions): Promise<Conversation[]>;
    generate(options?: IGenerateOptions): Promise<Conversation[]>;
    step(prompt: Conversation[], options?: IGenerateOptions): Promise<Conversation[]>;
    step(options?: IGenerateOptions): Promise<Conversation[]>;
    stop(): void;
    getConversation(): Conversation[];
    getAttentionData(): number[][][][][];
    getProbabilitiesData(): number[][][];
    getEmbeddingsData(): {
        name: string;
        tensor: number[][];
    }[][];
    getTokens(): number[];
    getLastLoss(): number | null;
    getLastMultinomialRand(): number | null;
    dispose(): void;
    reset(): void;
}
/**
 * Text generator using a NanoGPT model and a tokeniser.
 * This uses the forward method of the model to generate text token by token, including options for temperature, top-k, and top-p sampling.
 */
export default class Generator extends EE<'start' | 'stop' | 'tokens' | 'reset'> implements IGenerator {
    private readonly model;
    private readonly tokeniser;
    private active;
    private cache;
    private initialPrompt;
    private outputConversation;
    private actualTokeniser;
    private lastToken;
    private attentionData;
    private probabilitiesData;
    private embeddingsData;
    private tokens;
    private lastLoss;
    private lastMultinomialRand;
    private jobQueue;
    private processingJob;
    private startTime;
    constructor(model: Model<ModelForwardAttributes>, tokeniser: ITokeniser);
    private tokenisePrompt;
    private processResponse;
    /** Generate logits and select a token. */
    private _generateToken;
    /** Generate multiple tokens in a loop and produce text */
    private _generate;
    private resetCache;
    reset(): void;
    dispose(): void;
    private initialise;
    step(prompt: Conversation[], options?: IGenerateOptions): Promise<Conversation[]>;
    step(options?: IGenerateOptions): Promise<Conversation[]>;
    generate(prompt: Conversation[], options?: IGenerateOptions): Promise<Conversation[]>;
    generate(options?: IGenerateOptions): Promise<Conversation[]>;
    private startJob;
    getQueueLength(): number;
    stop(): void;
    getConversation(): Conversation[];
    getAttentionData(): number[][][][][];
    getProbabilitiesData(): number[][][];
    getEmbeddingsData(): {
        name: string;
        tensor: number[][];
    }[][];
    getTokens(): number[];
    getLastLoss(): number | null;
    getLastMultinomialRand(): number | null;
}
