Skip to content

Problem proxying the reranker via litellm #11

@oatmealm

Description

@oatmealm

I'm was trying to proxy embed-rerank via litellm. embeddings works great but there seems to be an issue with the re-ranker. I've tried cohere compatible api, which keeps failing.

curl http://[litellm]:4000/rerank -H   timeout: 
      "Content-Type: application/json" -H                10s
      "Authorization: Bearer sk-1234" -d
      '{"model":"qwen3-reranker-4b","query":"What is the
       capital of the United
      States?","documents":["Carson City is the capital
      city of Nevada.","Washington, D.C. is the capital
      of the United States."],"top_n":2}')
  ⎿ {                                                        
      "error": {
        "message": "2 validation errors for
    RerankResponse\nresults.0.document\n  Input should be a
    valid dictionary [type=dict_type, input_value=None,
    input_type=NoneType]\n    For further information visit
    https://errors.pydantic.dev/2.10/v/dict_type\nresults.1.d
    ocument\n  Input should be a valid dictionary
    [type=dict_type, input_value=None, input_type=NoneType]\n
        For further information visit
    https://errors.pydantic.dev/2.10/v/dict_type",
        "type": "None",
        "param": "None",
        "code": "500"
      }
    }

According to Claude, embed-rerank should omit the document field entirely when return_documents is false (or not provided), not include it with a null value.

Huggingface api works though.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions