Skip to content

fix(ts): request float OpenAI embeddings - #5170

Merged
blazingretinol merged 4 commits into
mem0ai:mainfrom
pragnyanramtha:codex/fix-openai-embedder-float-encoding
Jun 4, 2026
Merged

blazingretinol merged 4 commits into
mem0ai:mainfrom
pragnyanramtha:codex/fix-openai-embedder-float-encoding

Conversation

@pragnyanramtha

Copy link
Copy Markdown
Contributor

Summary

  • request encoding_format: "float" from the TypeScript OSS OpenAI embedder
  • apply the same behavior to both embed() and embedBatch()
  • update the OpenAI embedder unit tests to assert the float encoding request while preserving existing embeddingDims behavior

Why

The OpenAI Node SDK may request base64 embeddings by default when encoding_format is omitted. OpenAI-compatible proxies can mishandle that mode, returning vectors that decode to the wrong dimension and later fail in vector stores. This mirrors the Python SDK fix from #4058 for the TypeScript SDK path.

Closes #5168.

Validation

  • pnpm exec jest src/oss/tests/openai-embedder.test.ts --runInBand
  • pnpm run build

@CLAassistant

CLAassistant commented May 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@pragnyanramtha
pragnyanramtha marked this pull request as ready for review May 16, 2026 23:31
Copilot AI review requested due to automatic review settings May 16, 2026 23:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@dumbax-debug

Copy link
Copy Markdown

Confirmed against the reproduction in #5168 — this fix (encoding_format: "float" in both embed paths) resolves the silent 192-dim zero-vector failure with LiteLLM in front of vLLM + nomic-embed-text-v1.5 (expected 768 dim).

We've been running an equivalent runtime-wrapper patch in production since 2026-05-01 without regressions. Diff is minimal and mirrors the Python #4058 fix. LGTM 👍

@blazingretinol
blazingretinol merged commit 64b9646 into mem0ai:main Jun 4, 2026
12 of 13 checks passed
blazingretinol added a commit that referenced this pull request Jun 10, 2026
Python v2.0.5 additions:
- feat: add explain=True search score breakdowns (#5102)
- fix(memory): reject empty/whitespace search queries (#5258)
- fix(llms/xai): forward tools, add XAIConfig, parse tool_calls (#5190)
- fix(pgvector): use open=False to prevent ConnectionPool hang in Docker (#5155)
- fix(vector-stores): filter S3 vector list results client-side (#5018)
- fix(vector_stores): Upstash namespace passed as top-level kwarg (#5202)

TypeScript v3.0.7 additions:
- feat: add explain search score breakdowns (#5102)
- fix(embeddings): request float encoding_format from OpenAI (#5170)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: OpenAIEmbedder in mem0-ts fails with OpenAI-compatible proxies (encoding_format default base64) — port #4058 to TS SDK

6 participants