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
This commit is contained in:
eason2026
2026-07-20 14:45:30 +08:00
parent b728354863
commit df55052de1

View File

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