import { PicoLLMModel, PicoLLMCompletion, PicoLLMInitOptions, PicoLLMGenerateOptions, PicoLLMImage, PicoLLMGenerateWithImageOptions, PicoLLMEmbeddingsCompletion, PicoLLMGenerateOCROptions } from './types';
import { Dialog } from './dialog';
/**
 * JavaScript/WebAssembly Binding for picoLLM.
 */
export declare class PicoLLM {
    private readonly _module;
    private readonly _pv_picollm_generate;
    private readonly _pv_picollm_generate_with_image;
    private readonly _pv_picollm_generate_embeddings;
    private readonly _pv_picollm_generate_ocr;
    private readonly _pv_picollm_forward;
    private readonly _functionMutex;
    private readonly _objectAddress;
    private readonly _messageStackAddressAddressAddress;
    private readonly _messageStackDepthAddress;
    private readonly _contextLength;
    private readonly _maxTopChoices;
    private readonly _model;
    private readonly _version;
    private readonly _streamCallback;
    private readonly _streamCallbackFnPointer;
    private readonly _promptProgressCallback;
    private readonly _promptProgressCallbackFnPointer;
    private static _wasmPThread;
    private static _wasmPThreadLib;
    private static _sdk;
    private static _picoLLMMutex;
    private constructor();
    /**
     * Get model's context length.
     */
    get contextLength(): number;
    /**
     * Get maximum number of top choices for `.generate()`.
     */
    get maxTopChoices(): number;
    /**
     * Get the model's name.
     */
    get model(): string;
    /**
     * Get PicoLLM version.
     */
    get version(): string;
    static setSdk(sdk: string): void;
    /**
     * Creates an instance of picoLLM.
     *
     * @param accessKey AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)
     * @param model PicoLLM model representation, see PicoLLMModel for details.
     * @param model.modelFile The model file can be one or chunks (in order) of:
     *  - URL string of the model file.
     *  - File object containing the contents of the model file.
     *  - Blob object containing the bytes of the model file.
     * @param model.cacheFilePath Custom path to save the model in storage. Set to a different name to use multiple
     * models across `picoLLM` instances.
     * @param model.cacheFileVersion PicoLLM model version. Set to a higher number to update the model file.
     * @param model.cacheFileOverwrite Flag to force overwrite the model in storage even if it exists.
     * @param model.numFetchRetries Number of retries to try and fetch the model file.
     * @param options Optional init configuration arguments, see PicoLLMInitOptions for details.
     * @param options.device String representation of the device to use for inference. If set to `best`,
     * picoLLM picks the most suitable device. If set to `cpu`, the engine will run on the CPU with the default number of
     * threads. To specify the number of threads, set this argument to `cpu:${NUM_THREADS}`, where `${NUM_THREADS}`
     * is the desired number of threads. The number of threads is capped at the max available cores determined by the browser.
     *
     * @returns An instance of the PicoLLM.
     */
    static create(accessKey: string, model: PicoLLMModel, options?: PicoLLMInitOptions): Promise<PicoLLM>;
    /**
     * Set base64 wasm file with SIMD and pthread feature.
     * @param wasmPThread Base64'd wasm file to use to initialize wasm.
     */
    static setWasmPThread(wasmPThread: string): void;
    /**
     * Set base64 SIMD and thread wasm file in text format.
     * @param wasmPThreadLib Base64'd wasm file in text format.
     */
    static setWasmPThreadLib(wasmPThreadLib: string): void;
    private static invalidUserAgent;
    static _init(accessKey: string, modelPath: string, options?: PicoLLMInitOptions): Promise<PicoLLM>;
    /**
     * Given a text prompt and a set of generation parameters, creates a completion text and relevant metadata.
     *
     * @param prompt Prompt.
     * @param options Optional generate configuration arguments, see PicoLLMGenerateOptions for details.
     * @param options.completionTokenLimit Maximum number of tokens in the completion. If the generation process stops due
     * to reaching this limit, the `.endpoint` parameter in `PicoLLMCompletion` output will be
     * `PicoLLMEndpoint.COMPLETION_TOKEN_LIMIT_REACHED`. Set to `undefined` to impose no limit.
     * @param options.stopPhrases The generation process stops when it encounters any of these phrases in the completion. The
     * already generated completion, including the encountered stop phrase, will be returned. The `endpoint` parameter
     * in `PicoLLMCompletion` output will be `PicoLLMEndpoint.STOP_PHRASE_ENCOUNTERED`. Set to `undefined` to turn off this
     * feature.
     * @param options.seed The internal random number generator uses it as its seed if set to a positive integer value.
     * Seeding enforces deterministic outputs.  Set to `undefined` for randomized outputs for a given prompt.
     * @param options.presencePenalty It penalizes logits already appearing in the partial completion if set to a positive
     * value. If set to `0` or `undefined`, it has no effect.
     * @param options.frequencyPenalty If set to a positive floating-point value, it penalizes logits proportional to the
     * frequency of their appearance in the partial completion. If set to `0` or `undefined`, it has no effect.
     * @param options.temperature Sampling temperature. Temperature is a non-negative floating-point value that controls the
     * randomness of the sampler. A higher temperature smoothens the samplers' output, increasing the randomness. In
     * contrast, a lower temperature creates a narrower distribution and reduces variability. Setting it to `0` or
     * `undefined` selects the maximum logit during sampling.
     * @param options.topP A positive floating-point number within 0, and 1. It restricts the sampler's choices to
     * high-probability logits that form the `topP` portion of the probability mass. Hence, it avoids randomly
     * selecting unlikely logits. A value of `1` or `undefined` enables the sampler to pick any token with non-zero
     * probability turning off the feature.
     * @param options.numTopChoices If set to a positive value, picoLLM returns the list of the highest probability tokens
     * for any generated token. Set to `0` to turn off the feature. The maximum number of top choices is `.maxTopChoices`.
     * @param options.streamCallback If not set to `undefined`, picoLLM executes this callback every time a new piece of
     * completion string becomes available.
     */
    generate(prompt: string, options?: PicoLLMGenerateOptions): Promise<PicoLLMCompletion>;
    /**
     * Given a text prompt, an image, and a set of generation parameters, creates a completion text and relevant metadata.
     *
     * For use with vision models only.
     *
     * @param prompt Text prompt.
     * @param image Image prompt.
     * @param image.width Width of the image in pixels.
     * @param image.height Height of the image in pixels.
     * @param image.data Image pixel data in 8-bit, RGB format.
     * @param options Optional generate configuration arguments, see PicoLLMGenerateWithImageOptions for details.
     * @param options.completionTokenLimit Maximum number of tokens in the completion. If the generation process stops due
     * to reaching this limit, the `.endpoint` parameter in `PicoLLMCompletion` output will be
     * `PicoLLMEndpoint.COMPLETION_TOKEN_LIMIT_REACHED`. Set to `undefined` to impose no limit.
     * @param options.stopPhrases The generation process stops when it encounters any of these phrases in the completion. The
     * already generated completion, including the encountered stop phrase, will be returned. The `endpoint` parameter
     * in `PicoLLMCompletion` output will be `PicoLLMEndpoint.STOP_PHRASE_ENCOUNTERED`. Set to `undefined` to turn off this
     * feature.
     * @param options.seed The internal random number generator uses it as its seed if set to a positive integer value.
     * Seeding enforces deterministic outputs.  Set to `undefined` for randomized outputs for a given prompt.
     * @param options.presencePenalty It penalizes logits already appearing in the partial completion if set to a positive
     * value. If set to `0` or `undefined`, it has no effect.
     * @param options.frequencyPenalty If set to a positive floating-point value, it penalizes logits proportional to the
     * frequency of their appearance in the partial completion. If set to `0` or `undefined`, it has no effect.
     * @param options.temperature Sampling temperature. Temperature is a non-negative floating-point value that controls the
     * randomness of the sampler. A higher temperature smoothens the samplers' output, increasing the randomness. In
     * contrast, a lower temperature creates a narrower distribution and reduces variability. Setting it to `0` or
     * `undefined` selects the maximum logit during sampling.
     * @param options.topP A positive floating-point number within 0, and 1. It restricts the sampler's choices to
     * high-probability logits that form the `topP` portion of the probability mass. Hence, it avoids randomly
     * selecting unlikely logits. A value of `1` or `undefined` enables the sampler to pick any token with non-zero
     * probability turning off the feature.
     * @param options.numTopChoices If set to a positive value, picoLLM returns the list of the highest probability tokens
     * for any generated token. Set to `0` to turn off the feature. The maximum number of top choices is `.maxTopChoices`.
     * @param options.streamCallback If not set to `undefined`, picoLLM executes this callback every time a new piece of
     * completion string becomes available.
     * @param options.promptProgressCallback If not set to `undefined`, picoLLM uses this callback to report the prompt evaluation
     * progress as a floating-point number within (0, 100]. A value of 100 indicates that prompt evaluation is complete and
     * completion tokens are now being generated.
     */
    generateWithImage(prompt: string, image: PicoLLMImage, options?: PicoLLMGenerateWithImageOptions): Promise<PicoLLMCompletion>;
    /**
     * Generates numerical vector representations of the input text prompt.
     *
     * For use with embedding models only.
     *
     * @param prompt Text prompt.
     */
    generateEmbeddings(prompt: string): Promise<PicoLLMEmbeddingsCompletion>;
    /**
     * Generates a completion text representing text found in the given image.
     *
     * For use with OCR (Optical Character Recognition) models only.
     *
     * @param image Image prompt.
     * @param image.width Width of the image in pixels.
     * @param image.height Height of the image in pixels.
     * @param image.data Image pixel data in 8-bit, RGB format.
     * @param options Optional generate configuration arguments, see PicoLLMGenerateOCROptions for details.
     * @param options.completionTokenLimit Maximum number of tokens in the completion. If the generation process stops due
     * to reaching this limit, the `.endpoint` parameter in `PicoLLMCompletion` output will be
     * `PicoLLMEndpoint.COMPLETION_TOKEN_LIMIT_REACHED`. Set to `undefined` to impose no limit.
     * @param options.streamCallback If not set to `undefined`, picoLLM executes this callback every time a new piece of
     * completion string becomes available.
     * @param options.promptProgressCallback If not set to `undefined`, picoLLM uses this callback to report the prompt evaluation
     * progress as a floating-point number within (0, 100]. A value of 100 indicates that prompt evaluation is complete and
     * completion tokens are now being generated.
     */
    generateOCR(image: PicoLLMImage, options?: PicoLLMGenerateOCROptions): Promise<PicoLLMCompletion>;
    /**
     * Interrupts `generate()` if generation is in progress. Otherwise, it has no effect.
     */
    interrupt(): Promise<void>;
    /**
     * Tokenizes a given text using the model's tokenizer. This is a low-level function meant for benchmarking and
     * advanced usage. `.generate()` should be used when possible.
     *
     * @param text Text.
     * @param bos If set to `True`, the tokenizer prepends the beginning of the sentence token to the result.
     * @param eos If set to `True`, the tokenizer appends the end of the sentence token to the result.
     * @returns Tokens representing the input text.
     */
    tokenize(text: string, bos: boolean, eos: boolean): Promise<number[]>;
    /**
     * Performs a single forward pass given a token and returns the logits. This is a low-level function for
     * benchmarking and advanced usage. `.generate()` should be used when possible.
     *
     * @param token Input token.
     * @returns Logits.
     */
    forward(token: number): Promise<number[]>;
    /**
     * Resets the internal state of LLM. It should be called in conjunction with `.forward()` when processing a new
     * sequence of tokens. This is a low-level function for benchmarking and advanced usage. `.generate()` should be
     * used when possible.
     */
    reset(): Promise<void>;
    /**
     * Return the Dialog object corresponding to the loaded model. The model needs to be instruction-tuned and have a
     * specific chat template.
     *
     * @param mode Some models (e.g., `phi-2`) define multiple chat template models. For example, `phi-2` allows
     * both `qa` and `chat` templates.
     * @param history History refers to the number of latest back-and-forths to include in the prompt. Setting history
     * to `undefined` will embed the entire dialog in the prompt.
     * @param system System instruction to embed in the prompt for configuring the model's responses.
     * @returns Constructed dialog object.
     */
    getDialog(mode?: string, history?: number, system?: string): Dialog;
    /**
     * Releases resources acquired by WebAssembly module.
     */
    release(): Promise<void>;
    /**
     * Lists all available devices that picoLLM can use for inference. Each entry in the list can be the `device` argument
     * of `.create` method.
     *
     * @returns List of all available devices that picoLLM can use for inference.
     */
    static listAvailableDevices(): Promise<string[]>;
    private static initWasm;
    private static getMessageStack;
    private static wrapAsyncFunction;
}
//# sourceMappingURL=picollm.d.ts.map