Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@mediapipe/tasks-genai-experimental

linchan606Apache-2.00.10.22-rc.20250304TypeScript support: included

MediaPipe GenAI Experimental Tasks

AR, ML, Augmented, MediaPipe, MediaPipe Tasks

readme

MediaPipe Tasks GenAI Experimental Package

This package contains experimental GenAI tasks for MediaPipe.

RAG Pipeline Inference

You can use the RAG Pipeline to augment an LLM Inference Task with existing knowledge.

const genaiFileset = await FilesetResolver.forGenAiTasks();
const genaiExperimentalFileset =
  await FilesetResolver.forGenAiExperimentalTasks();
const llmInference = await LlmInference.createFromModelPath(genaiFileset, ...);
const ragPipeline = await RagPipeline.createWithEmbeddingModel(
  genaiExperimentalFileset,
  llmInference,
  EMBEDDING_MODEL_URL,
);
await ragPipeline.recordBatchedMemory([
  'Paris is the capital of France.',
  'Berlin is the capital of Germany.',
]);
const result = await ragPipeline.generateResponse(
  'What is the capital of France?',
);
console.log(result);