パッケージの詳細

@mediapipe/tasks-genai

tmullen7.2kApache-2.00.10.25

MediaPipe GenAI Tasks

AR, ML, Augmented, MediaPipe

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 Gemma 3n E4B or Gemma 3n E2B, or 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);