Type Alias: CreateTransformersJsPipeline
ts
type CreateTransformersJsPipeline = (input: {
device?: TransformersJsDevice;
dtype?: TransformersJsDtype;
model: string;
onInitProgress?: TransformersJsProgressCallback;
sessionOptions?: TransformersJsSessionOptions;
}) => Promise<TransformersJsPipeline>;Defined in: src/batteries/llm/transformers_js/types.ts:123
Factory that loads a text-generation pipeline and resolves it ready to use.
Parameters
| Parameter | Type | Description |
|---|---|---|
input | { device?: TransformersJsDevice; dtype?: TransformersJsDtype; model: string; onInitProgress?: TransformersJsProgressCallback; sessionOptions?: TransformersJsSessionOptions; } | - |
input.device? | TransformersJsDevice | - |
input.dtype? | TransformersJsDtype | - |
input.model | string | - |
input.onInitProgress? | TransformersJsProgressCallback | - |
input.sessionOptions? | TransformersJsSessionOptions | ONNX Runtime session options forwarded verbatim to pipeline(...) as session_options. |
Returns
Promise<TransformersJsPipeline>
Remarks
The default factory dynamically imports @huggingface/transformers and calls pipeline('text-generation', model, { device, dtype, … }). Supply a custom factory to control loading, inject a pre-warmed pipeline, or mock it in tests.