@mediapipe/tasks-genai
v0.10.27
Published
MediaPipe GenAI Tasks
Downloads
19,779
Readme
MediaPipe Tasks GenAI Package
This package contains the GenAI tasks for MediaPipe.
LLM Inference
The MediaPipe LLM Inference task generates text responses from input text. For Gemma 3n models, it can process input images and audio as well.
In order to begin, you must have a model available. You can download one of these:
Alternatively, you can browse for more pre-converted models on our LiteRT HuggingFace community, where files named "-web.task" are specially converted to run optimally in the browser. All text-only variants of Gemma 3 are available there, as well as MedGemma-27B-Text. See our web inference guide for more information. Note that only models encoded for the GPU backend are currently supported.
const genai = await FilesetResolver.forGenAiTasks(
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-genai/wasm"
);
const llmInference = await LlmInference.createFromModelPath(genai, MODEL_URL);
const response = await llmInference.generateResponse(inputText);