Skip to content

Upgrade cocoindex[litellm] dependency or filter encoding_format=None for OpenAI-compatible embeddings #122

@lemoay

Description

@lemoay

Summary

ccc index fails when provider: litellm is used with an OpenAI-compatible embeddings endpoint, because the outgoing embeddings request includes:

{
  "input": ["hello"],
  "model": "Qwen/Qwen3-Embedding-8B",
  "encoding_format": null
}

If encoding_format is omitted entirely, or changed to "float", the same request succeeds.

This appears to match LiteLLM's previously documented encoding_format=None regression for OpenAI-like embeddings.


Why I believe this is dependency-related

The current cocoindex-code pyproject.toml pins:

cocoindex[litellm]==1.0.0a38

So this issue appears to come from the cocoindex[litellm] / LiteLLM dependency path rather than from provider configuration alone.

Relevant source:

LiteLLM also published an official incident report on February 18, 2026 describing a very similar bug:

  • a change explicitly sent encoding_format=None
  • OpenAI-like embedding endpoints that strictly validated the field rejected the request
  • the upstream fix was to filter out None / empty-string values before sending the request

Relevant source:


Environment

  • OS: Windows
  • Python: 3.12
  • Installed via: uv tool install cocoindex-code

Embedding config:

embedding:
  provider: litellm
  model: openai/Qwen/Qwen3-Embedding-8B

envs:
  OPENAI_API_KEY: <redacted>
  OPENAI_BASE_URL: https://api.siliconflow.cn/v1

Reproduction

  1. Configure cocoindex-code to use provider: litellm
  2. Point it to an OpenAI-compatible embeddings endpoint
  3. Run:
ccc index
  1. Observe that indexing fails when the embeddings request is sent

Actual Behavior

The outgoing embeddings request contains:

{
  "input": ["hello"],
  "model": "Qwen/Qwen3-Embedding-8B",
  "encoding_format": null
}

The provider rejects this as an invalid parameter.


Expected Behavior

For OpenAI-compatible embedding providers:

  • if encoding_format is unset, it should be omitted from the request body
  • or it should be set to a valid value such as "float"

It should not be serialized as null.


What I found

I captured the outgoing request and confirmed that encoding_format: null was being sent.

I then patched my local LiteLLM installation as follows:

if encoding_format is not None:
    optional_params["encoding_format"] = encoding_format
else:
    optional_params["encoding_format"] = "float"

After this local patch, indexing worked.

A cleaner fix may be to omit None values entirely before sending the request to OpenAI-compatible embedding providers.


Why this seems to match the known LiteLLM bug

LiteLLM's official incident report says the regression was caused by explicitly passing encoding_format=None in embedding requests, and that the upstream fix was to filter out None and empty string values before sending requests to OpenAI-like providers.

That seems consistent with what I observed here:

  • request fails when encoding_format: null is present
  • request succeeds when the field is omitted
  • request also succeeds when it is forced to "float"

Suggested Fix

One of the following would likely resolve the issue:

  1. Upgrade the cocoindex[litellm] dependency path to a version that includes the upstream LiteLLM fix
  2. Filter out encoding_format=None before sending embedding requests
  3. As a fallback, explicitly send "float" instead of null

Notes

This does not appear to be model-specific.

The issue is the serialized request field:

"encoding_format": null

Once that field is omitted or changed to "float", the same provider/model combination works correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions