mem0ai/mem0 · error · RuntimeError

Sarvam API request failed: {e}

Error message

Sarvam API request failed: {e}

What it means

Error "Sarvam API request failed: {e}" thrown in mem0ai/mem0.

Source

Thrown at mem0/llms/sarvam.py:92

                if param in self.config.model:
                    params[param] = self.config.model[param]

        # Forward any per-call provider-specific parameters (LLMBase contract).
        params.update(kwargs)

        try:
            response = requests.post(url, headers=headers, json=params, timeout=30)
            response.raise_for_status()

            result = response.json()

            if "choices" in result and len(result["choices"]) > 0:
                return result["choices"][0]["message"]["content"]
            else:
                raise ValueError("No response choices found in Sarvam API response")

        except requests.exceptions.RequestException as e:
            raise RuntimeError(f"Sarvam API request failed: {e}")
        except KeyError as e:
            raise ValueError(f"Unexpected response format from Sarvam API: {e}")

View on GitHub (pinned to 001c235229)

Solutions

  1. Check network connectivity and Sarvam API key validity.
  2. Review the exception message for HTTP status and retry with backoff for transient errors.

When it happens

Trigger: Thrown at mem0/llms/sarvam.py:92 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/632675f5372aefff. Report an issue: GitHub.