BerriAI/litellm · error · ValueError

No results found in the response={_json_response}

Error message

No results found in the response={_json_response}

What it means

Voyage's rerank API returns results under a "data" key (not OpenAI's "results"). After successfully parsing the JSON, the transformer checks _json_response.get("data"); if the key is absent or None, this ValueError is raised. It means the request reached Voyage and a JSON body came back, but the payload does not contain the expected results array - an API contract change, an error body with 200, or an unexpected model response.

Source

Thrown at litellm/llms/voyage/rerank/transformation.py:106

        litellm_params: dict = {},
    ) -> RerankResponse:
        if raw_response.status_code != 200:
            raise VoyageError(message=raw_response.text, status_code=raw_response.status_code)

        logging_obj.post_call(original_response=raw_response.text)

        try:
            _json_response: Final = raw_response.json()
        except Exception:
            raise VoyageError(
                message=f"Failed to parse response: {raw_response.text}",
                status_code=raw_response.status_code,
            )

        # Voyage AI returns results in "data" key, not "results"
        _results: Final[list[dict] | None] = _json_response.get("data")
        if _results is None:
            raise ValueError(f"No results found in the response={_json_response}")

        # Transform to LiteLLM format
        transformed_results: Final = []
        for result in _results:
            transformed_result: dict[str, Any] = {
                "index": result["index"],
                "relevance_score": result["relevance_score"],
            }
            if "document" in result:
                if isinstance(result["document"], str):
                    transformed_result["document"] = {"text": result["document"]}
                else:
                    transformed_result["document"] = result["document"]
            transformed_results.append(transformed_result)

        usage: Final = _json_response.get("usage", {})
        total_tokens: Final = usage.get("total_tokens", 0)
        _billed_units: Final = RerankBilledUnits(total_tokens=total_tokens)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Inspect the full JSON printed in the exception message to see the actual payload shape.
  2. Upgrade (or pin) litellm to a version matching the Voyage rerank API contract you target.
  3. If using a custom api_base, make sure it exposes Voyage-shaped responses ({"data": [...]}) or switch the model to the matching provider prefix.
  4. Report/check the Voyage changelog if the payload is an unexpected error body with status 200.

Example fix

# before (custom endpoint returns OpenAI-shaped {"results": [...]})
result = litellm.rerank(model="voyage/my-reranker", query=q, documents=docs, api_base="https://gw.internal")
# -> ValueError: No results found in the response={'results': [...]}

# after (use the provider whose response shape the endpoint returns)
result = litellm.rerank(model="openai/my-reranker" if using_openai_shape else "voyage/my-reranker", query=q, documents=docs, api_base="https://gw.internal")
Defensive patterns

Strategy: try-catch

Try / catch

try:
    result = litellm.rerank(model="voyage/voyage-3-rerank", query=q, documents=docs)
except ValueError as e:
    if "No results found in the response" in str(e):
        logging.error("Voyage rerank payload missing 'data': %s", e)
        # surface as a typed upstream-contract error, not a crash
        raise UpstreamContractError("voyage rerank schema changed") from e
    raise

Prevention

When it happens

Trigger: Voyage changes/renames the response field; an error payload {"error": ...} delivered with status 200; pointing litellm at a custom api_base whose rerank endpoint returns {"results": [...]} in OpenAI shape instead of Voyage shape; extremely large document lists returning an empty object.

Common situations: Version drift between litellm's Voyage adapter and the live Voyage API; gateway middleware rewrapping responses; custom rerank backends that mimic OpenAI rather than Voyage.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/59be9f8aa98f1c1c. Report an issue: GitHub.