feat(mem0-ts): add LM Studio embedder and LLM support#4354
Merged
whysosaket merged 1 commit intomainfrom Mar 17, 2026
Merged
Conversation
Add LM Studio as a supported provider for both embeddings and LLM in the TypeScript SDK, bringing it to parity with the Python SDK. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8ea9c1b to
9aff112
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
whysosaket
approved these changes
Mar 17, 2026
13 tasks
jamebobob
pushed a commit
to jamebobob/mem0-vigil-recall
that referenced
this pull request
Mar 29, 2026
Co-authored-by: utkarsh240799 <utkarsh240799@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Python mem0 SDK supports LM Studio as both an embedder and LLM provider, but the TypeScript SDK does not. Users configuring LM Studio via OpenClaw or mem0-ts get
Unsupported embedder provider: lmstudio/Unsupported LLM provider: lmstudioerrors.Reported in #4235.
Solution
Add
LMStudioEmbedderandLMStudioLLMclasses to mem0-ts, matching the Python SDK's feature set:LMStudioEmbedder— Standalone embedder using the OpenAI client withencoding_format: "float"(required because LM Studio doesn't support the OpenAI SDK's defaultbase64encoding, which produces zero vectors). Includes newline normalization and error wrapping.LMStudioLLM— ExtendsOpenAILLMwith LM Studio defaults (localhost:1234, dummy API key, Meta Llama model). Wraps errors with clear messages.ConfigManager— Normalizes Python SDK snake_case keys (lmstudio_base_url→baseURL,embedding_dims→embeddingDims) for both embedder and LLM configs. Uses nullish coalescing (??) so existing providers are unaffected."lmstudio"registered in bothEmbedderFactoryandLLMFactory.index.ts, documented in OpenClaw README.Files changed
mem0-ts/src/oss/src/embeddings/lmstudio.tsLMStudioEmbeddermem0-ts/src/oss/src/llms/lmstudio.tsLMStudioLLMmem0-ts/src/oss/src/utils/factory.tslmstudioin both factoriesmem0-ts/src/oss/src/index.tsmem0-ts/src/oss/src/config/manager.tsopenclaw/README.mdlmstudioas supported providerTesting
Unit tests (always run)
lmstudio-embedder.test.ts(4 tests) — embed withencoding_format: "float", newline normalization, error wrapping, batch embeddinglmstudio-llm.test.ts(5 tests) — text response, tool calls, error wrapping, chat responseconfig-manager.test.ts(14 new tests) — snake_case normalization for embedder and LLM, camelCase precedence, full OpenClaw-style config from issue OpenClaw integration doesn’t support lmstudio #4235, mocked Memory E2E flow (factory wiring, dimension auto-detect, search, add)factory.test.ts(2 new tests) —EmbedderFactory.create("lmstudio")and unsupported provider errorIntegration tests (require local LM Studio, skipped by default)
lmstudio-integration.test.ts(10 tests) — Tested against real LM Studio server withtext-embedding-nomic-embed-text-v1.5(embedder) andqwen2.5-0.5b-instruct(LLM). Enable withLMSTUDIO_INTEGRATION=1.Regression
Checklist
Maintainer Checklist