BerriAI/litellm · error · ValueError
No results found in the response={response}
Error message
No results found in the response={response} What it means
After a successful TogetherAI rerank HTTP call, LiteLLM parses the JSON body and expects a 'results' key. If response.get('results') is None — the key is absent or explicitly null — _transform_response raises ValueError with the whole response embedded, because it cannot construct a RerankResponse without results. This indicates a malformed or unexpected Together payload rather than an HTTP failure (that would have raised earlier).
Source
Thrown at litellm/llms/together_ai/rerank/transformation.py:29
RerankBilledUnits,
RerankResponse,
RerankResponseDocument,
RerankResponseMeta,
RerankResponseResult,
RerankTokens,
)
class TogetherAIRerankConfig:
def _transform_response(self, response: dict) -> RerankResponse:
_billed_units: Final = RerankBilledUnits(**response.get("usage", {}))
_tokens: Final = RerankTokens(**response.get("usage", {}))
rerank_meta: Final = RerankResponseMeta(billed_units=_billed_units, tokens=_tokens)
_results: Final[list[dict] | None] = response.get("results")
if _results is None:
raise ValueError(f"No results found in the response={response}")
rerank_results: Final[list[RerankResponseResult]] = []
for result in _results:
# Validate required fields exist
if not all(key in result for key in ["index", "relevance_score"]):
raise ValueError(f"Missing required fields in the result={result}")
# Get document data if it exists
document_data = result.get("document", {})
document = RerankResponseDocument(text=str(document_data.get("text", ""))) if document_data else None
# Create typed result
rerank_result = RerankResponseResult(
index=int(result["index"]),
relevance_score=float(result["relevance_score"]),
)
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Upgrade (or pin) litellm to a release matching the current Together rerank response schema.
- Inspect the response echoed in the message to see what Together actually returned (often an inline error object).
- If a mock/proxy intercepts the call, make it return {'results': [...], 'usage': {...}} shaped payloads.
- Report the exact response body to litellm maintainers if the provider changed its contract.
Example fix
# before (mock/interceptor returns wrong shape)
# 200 OK body: {"message": "ok"}
resp = litellm.rerank(model="together_ai/rerank-english-v2.0", query=q, documents=docs)
# ValueError: No results found in the response={'message': 'ok'}
# after — return the documented shape
# 200 OK body: {"results": [{"index": 0, "relevance_score": 0.98}], "usage": {...}}
resp = litellm.rerank(model="together_ai/rerank-english-v2.0", query=q, documents=docs) Defensive patterns
Strategy: try-catch
Validate before calling
def looks_like_together_rerank_response(body: dict) -> bool:
"""Cheap contract check when you control/mock the response source."""
return isinstance(body, dict) and isinstance(body.get("results"), list) Try / catch
try:
resp = litellm.rerank(model="together_ai/rerank-english-v2.0", query=q, documents=docs)
except ValueError as e:
if "No results found in the response" in str(e):
# provider contract break: log body for maintainers, fall back to no rerank
logger.warning("together rerank returned no results: %s", e)
resp = None
else:
raise Prevention
- Pin litellm versions and test against a recorded (VCR) Together response so contract drift is caught in CI.
- Make mock servers return documented shapes including 'results'.
- Treat parse ValueErrors as provider-contract incidents — report with the echoed response body.
When it happens
Trigger: Together returns 200 with a body lacking 'results' (e.g. an error object, empty response, or an API shape change); a proxy/interceptor rewrites the response body; a different endpoint version returns {'message': ...} with status 200.
Common situations: Together shipping a response-format change that LiteLLM's current version doesn't handle; middlewares (mock servers, gateway rewrites) returning stub JSON; edge cases where Together returns an empty result set as null.
Related errors
- Missing required fields in the result={result}
- No results found in the response={response}
- Missing required fields in the result={result}
- TogetherAI does not support max_chunks_per_doc
- response.text
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/eead51e2c267cbe8.
Report an issue: GitHub.