From df55052de18fe29f06cfcb6cd8f9e2ff380329e8 Mon Sep 17 00:00:00 2001 From: eason2026 Date: Mon, 20 Jul 2026 14:45:30 +0800 Subject: [PATCH] fix(embedding): don't send encoding_format by default for OpenAI-compatible providers SiliconFlow and other OpenAI-compatible providers reject the `encoding_format` parameter with HTTP 400. Only send it when explicitly set by the user, matching the existing opt-in pattern used for `dimensions` (send_dimensions flag). Closes #651 --- deeptutor/services/embedding/adapters/openai_compatible.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deeptutor/services/embedding/adapters/openai_compatible.py b/deeptutor/services/embedding/adapters/openai_compatible.py index dd9b1234d..90149fc70 100644 --- a/deeptutor/services/embedding/adapters/openai_compatible.py +++ b/deeptutor/services/embedding/adapters/openai_compatible.py @@ -167,8 +167,9 @@ class OpenAICompatibleEmbeddingAdapter(BaseEmbeddingAdapter): payload = { "input": input_payload, "model": model, - "encoding_format": request.encoding_format or "float", } + if request.encoding_format: + payload["encoding_format"] = request.encoding_format # `dimensions` is opt-in. The user's `send_dimensions` flag wins when set # explicitly (True/False); otherwise we fall back to a model-family