{"record":{"id":"f3c75aa9e2bce3e7","repo":"BerriAI/litellm","slug":"no-embeddings-found-in-litellm-embedding-response","errorCode":null,"errorMessage":"No embeddings found in LiteLLM embedding response.","messagePattern":"No embeddings found in LiteLLM embedding response\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/router_strategy/auto_router/litellm_encoder.py","lineNumber":23,"sourceCode":"from semantic_router.encoders.base import AsymmetricDenseMixin\n\nimport litellm\nfrom litellm._logging import verbose_router_logger\n\nif TYPE_CHECKING:\n    from litellm.router import Router\nelse:\n    Router = Any\n\n\ndef litellm_to_list(embeds: litellm.EmbeddingResponse) -> list[list[float]]:\n    \"\"\"Convert a LiteLLM embedding response to a list of embeddings.\n\n    :param embeds: The LiteLLM embedding response.\n    :return: A list of embeddings.\n    \"\"\"\n    if not embeds or not isinstance(embeds, litellm.EmbeddingResponse) or not embeds.data:\n        raise ValueError(\"No embeddings found in LiteLLM embedding response.\")\n    return [x[\"embedding\"] for x in embeds.data]\n\n\nclass CustomDenseEncoder(DenseEncoder):\n    model_config = ConfigDict(extra=\"allow\")\n\n    def __init__(self, litellm_router_instance: Optional[\"Router\"] = None, **kwargs):\n        # Extract litellm_router_instance from kwargs if passed there\n        if \"litellm_router_instance\" in kwargs:\n            litellm_router_instance = kwargs.pop(\"litellm_router_instance\")\n\n        super().__init__(**kwargs)\n        self.litellm_router_instance = litellm_router_instance\n\n\nclass LiteLLMRouterEncoder(CustomDenseEncoder, AsymmetricDenseMixin):\n    \"\"\"LiteLLM encoder class for generating embeddings using LiteLLM.\n","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/router_strategy/auto_router/litellm_encoder.py#L5-L41","documentation":"Guard in litellm_to_list: the object passed as an embedding response is falsy, not a litellm.EmbeddingResponse, or has an empty data list, so there are no embedding vectors to return to semantic-router.","triggerScenarios":"Thrown at litellm/router_strategy/auto_router/litellm_encoder.py:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the embedding model returns embeddings; check model name and credentials for the embedding call."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}