Skip to content

fix(embedder): pin encoding_format=float on OpenAI embedding calls - #1782

Open
crajah wants to merge 2 commits into
getzep:mainfrom
crajah:fix/embedder-encoding-format
Open

crajah wants to merge 2 commits into
getzep:mainfrom
crajah:fix/embedder-encoding-format

Conversation

@crajah

@crajah crajah commented Aug 19, 2026

Copy link
Copy Markdown

Problem

OpenAIEmbedder calls embeddings.create() without specifying encoding_format. Left unset, the OpenAI SDK negotiates base64 on its own — and gateways fronting non-OpenAI providers reject the parameter outright:

litellm.UnsupportedParamsError: vertex_ai does not support parameters:
{'encoding_format': 'base64'}, for model=gemini-embedding-001

Every embedding call fails, so ingestion cannot proceed at all behind such a gateway. Hit in practice with LiteLLM proxying to Vertex AI for gemini-embedding-001.

Fix

Pin encoding_format='float' on both create() and create_batch(). It is the API default and the portable choice, so this is a no-op against OpenAI itself while unblocking OpenAI-compatible gateways.

Notes

  • Split out of feat: add PostGraph driver — PostgreSQL-backed graph backend #1777 deliberately: that PR adds a driver, whereas this touches shared core code affecting every backend, and should be reviewable — or droppable — on its own.
  • Leaving it to callers is not reachable today: OpenAIEmbedderConfig exposes no way to pass the parameter through.

crajah added 2 commits August 19, 2026 14:12
Left unset, the OpenAI SDK negotiates base64, and gateways fronting
non-OpenAI providers reject the parameter outright — litellm to Vertex AI
fails every call for gemini-embedding-001 with UnsupportedParamsError.
'float' is the API default and the portable choice.

Separate from the driver commit because this is shared core code affecting
every backend, not the PostGraph driver, and should be reviewable or
droppable on its own.

@linhongyu510 linhongyu510 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.

Verified the current head. Both create() and create_batch() now pass encoding_format="float" explicitly, while preserving model/input handling and embedding-dimension truncation. This matches the OpenAI embeddings API contract and avoids SDK-side base64 negotiation for compatible gateways. Local validation: pytest tests/embedder/test_openai.py -q — 2 passed; an additional focused mock check confirmed the keyword on both call paths; Ruff check/format and git diff --check passed. No blocking issue found. Non-blocking: the existing tests do not assert encoding_format, so adding those assertions would make the regression coverage durable.

This branch has not been deployed

No deployments
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.

2 participants