Skip to content

fix: allow configuring embeddings encoding format - #322

Open
sergicasau wants to merge 2 commits into
danny-avila:mainfrom
sergicasau:fix/configurable-embeddings-encoding-format
Open

sergicasau wants to merge 2 commits into
danny-avila:mainfrom
sergicasau:fix/configurable-embeddings-encoding-format

Conversation

@sergicasau

@sergicasau sergicasau commented Sep 2, 2026

Copy link
Copy Markdown

Description

When using IONOS as an OpenAI-compatible embeddings provider, the OpenAI SDK sends encoding_format: "base64" by default.

IONOS cannot process this format correctly and returns an error because an embedding encoded as Base64 cannot be unmarshalled into the expected float array.

Setting RAG_CHECK_EMBEDDING_CTX_LENGTH=false fixes the input format, but does not change the embedding response format.

Solution

This PR adds the optional EMBEDDINGS_ENCODING_FORMAT environment variable and forwards it through model_kwargs to OpenAIEmbeddings and AzureOpenAIEmbeddings.

For IONOS, it can be configured as:

EMBEDDINGS_ENCODING_FORMAT=float

This follows the approach discussed by @metbosch in #163 (comment).

Related to #163.

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