{"record":{"id":"d87b669da8a33d4d","repo":"BerriAI/litellm","slug":"raw-response-text-d87b66","errorCode":null,"errorMessage":"{raw_response.text}","messagePattern":"\\{raw_response\\.text\\}","errorType":"http","errorClass":"InfinityError","httpStatus":null,"severity":"error","filePath":"litellm/llms/infinity/embedding/transformation.py","lineNumber":120,"sourceCode":"            \"model\": model,\n            **optional_params,\n        }\n\n    def transform_embedding_response(\n        self,\n        model: str,\n        raw_response: httpx.Response,\n        model_response: EmbeddingResponse,\n        logging_obj: LiteLLMLoggingObj,\n        api_key: str | None = None,\n        request_data: dict = {},\n        optional_params: dict = {},\n        litellm_params: dict = {},\n    ) -> EmbeddingResponse:\n        try:\n            raw_response_json: Final = raw_response.json()\n        except Exception:\n            raise InfinityError(message=raw_response.text, status_code=raw_response.status_code)\n\n        # model_response.usage\n        model_response.model = raw_response_json.get(\"model\")\n        model_response.data = raw_response_json.get(\"data\")\n        model_response.object = raw_response_json.get(\"object\")\n\n        usage: Final = Usage(\n            prompt_tokens=raw_response_json.get(\"usage\", {}).get(\"prompt_tokens\", 0),\n            total_tokens=raw_response_json.get(\"usage\", {}).get(\"total_tokens\", 0),\n        )\n        model_response.usage = usage\n        return model_response\n\n    def get_error_class(self, error_message: str, status_code: int, headers: dict | httpx.Headers) -> BaseLLMException:\n        return InfinityError(message=error_message, status_code=status_code, headers=headers)\n","sourceCodeStart":102,"sourceCodeEnd":136,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/infinity/embedding/transformation.py#L102-L136","documentation":"Raised when the Infinity embedding server's response body is not valid JSON. The raw body text and HTTP status are wrapped in InfinityError — typical when the base URL points at a wrong route (HTML page), the service is down, or a proxy intercepts the request.","triggerScenarios":"api_base pointing at a non-Infinity route or wrong port (e.g. missing /embeddings suffix is fine since it's appended, but hitting the docs UI), the Infinity container not started, or auth middleware returning HTML.","commonSituations":"Local dev where Infinity runs on a different port than configured; service crashed mid-request; URL with a typo'd path prefix.","solutions":["Check the embedded body text — it usually names the real endpoint/problem.","Confirm Infinity is running: curl http://<api_base>/models.","Correct api_base host/port in the client or proxy config."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"def infinity_alive(base: str) -> bool:\n    import httpx\n    try:\n        return httpx.get(f'{base.rstrip(\"/\")}/models', timeout=5).status_code == 200\n    except Exception:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.embedding(model='infinity/m', input=texts, api_base=base)\nexcept Exception as e:\n    if 'InfinityError' in type(e).__name__ and ('<html' in str(e) or 'not connect' in str(e)):\n        raise RuntimeError(f'Infinity at {base} unreachable or not JSON; check service') from e\n    raise","preventionTips":["Add readiness probes on the Infinity deployment","Verify api_base with /models once at client init"],"tags":["infinity","embeddings","response-format","self-hosted","json"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}