import type { ProgressInfo, TextGenerationPipeline, StoppingCriteria as TransformersStoppingCriteria } from "../subprocess/transformers-types.js"; import { type TransformersRuntimeMetadata } from "../subprocess/worker-runtime.js"; import { type TinyOnnxDevice } from "./device.js"; import { type TinyModelDtype } from "./dtype.js"; export interface TransformersRuntime extends TransformersRuntimeMetadata { env: { cacheDir?: string; allowLocalModels?: boolean; logLevel?: unknown; }; LogLevel: { ERROR: unknown; }; StoppingCriteria: new () => TransformersStoppingCriteria; pipeline: (task: "text-generation", model: string, options: { device: TinyOnnxDevice; dtype: TinyModelDtype; progress_callback: (info: ProgressInfo) => void; }) => Promise; } /** Stops generation at the first occurrence of `text` in the *generated* tokens. * * The window must be anchored to the generation boundary, not to the end of the * whole sequence: a prompt that itself contains the stop string (chat-level * few-shot examples ending in ``, for instance) would otherwise match on * prompt tokens and stop before the model emits anything. */ export declare function createStopOnTextCriteria(transformers: TransformersRuntime, tokenizer: TextGenerationPipeline["tokenizer"], text: string): TransformersStoppingCriteria; /** Run the ONNX worker for the model/endpoint selected by the CLI worker host environment. */ export declare function startTinyWorkerFromEnvironment(): Promise;