mem0ai/mem0

feat(ts-sdk): add HuggingFace embedding provider

Open

#5769 aperta il 23 giu 2026

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Python (6343 fork)batch import
enhancementgood first issuehelp wantedsdk-typescriptsize:M

Metriche repository

Star
 (55.741 star)
Metriche merge PR
 (Merge medio 6g 11h) (208 PR mergiate in 30 g)

Descrizione

Summary

The Python SDK supports HuggingFace as an embedding provider, but the TypeScript OSS SDK (mem0ai/oss) does not. Add it to bring the TS SDK to parity.

Python reference mem0/embeddings/huggingface.py
Registered in (Python) mem0/utils/factory.py (EmbedderFactory)
Target file (TypeScript) mem0-ts/src/oss/src/embeddings/huggingface.ts
Suggested implementation API mode: @huggingface/inference. Optional local mode: @huggingface/transformers (transformers.js).

Requirements

  • Implement HuggingFaceEmbedder in mem0-ts/src/oss/src/embeddings/huggingface.ts, extending Embedder (mem0-ts/src/oss/src/embeddings/base.ts) and mirroring the Python provider's behavior (embed / embedBatch).
  • Register the "huggingface" provider in mem0-ts/src/oss/src/utils/factory.ts (EmbedderFactory).
  • Add config typing in mem0-ts/src/oss/src/types/.
  • Add a unit test under mem0-ts/src/oss/src/tests/.
  • Add @huggingface/inference to mem0-ts/package.json (optional/peer dependency, lazy-imported like other providers).
  • Update docs under docs/ if this provider is user-facing.

Reference pattern

Mirror an existing TS provider: embeddings/openai.ts.

Notes

Python defaults to LOCAL sentence-transformers. Start with the HF Inference API for hosted-model parity; a local transformers.js path can follow. Document which models are supported.


Part of the TypeScript ↔ Python SDK provider-parity effort. One provider per issue (atomic).

Guida contributor