BerriAI/litellm · error · ValueError

Invalid RAGFlow endpoint type: {endpoint_type}. Must be 'cha

Error message

Invalid RAGFlow endpoint type: {endpoint_type}. Must be 'chat' or 'agent'

What it means

Model-format parser guard in the RAGFlow chat config: the second path segment (endpoint type) is neither 'chat' nor 'agent', so LiteLLM cannot decide whether to target a RAGFlow chat session or an agent endpoint.

Source

Thrown at litellm/llms/ragflow/chat/transformation.py:56

        Returns:
            Tuple of (endpoint_type, id, model_name)

        Raises:
            ValueError: If model format is invalid
        """
        parts: Final = model.split("/")
        if len(parts) < 4:
            raise ValueError(
                f"Invalid RAGFlow model format: {model}. "
                f"Expected format: ragflow/chat/{{chat_id}}/{{model}} or ragflow/agent/{{agent_id}}/{{model}}"
            )

        if parts[0] != "ragflow":
            raise ValueError(f"Invalid RAGFlow model format: {model}. Must start with 'ragflow/'")

        endpoint_type: Final = parts[1]
        if endpoint_type not in ["chat", "agent"]:
            raise ValueError(f"Invalid RAGFlow endpoint type: {endpoint_type}. Must be 'chat' or 'agent'")

        entity_id: Final = parts[2]
        model_name: Final = "/".join(parts[3:])  # Handle model names that might contain slashes

        return endpoint_type, entity_id, model_name

    def get_complete_url(
        self,
        api_base: str | None,
        api_key: str | None,
        model: str,
        optional_params: dict,
        litellm_params: dict,
        stream: bool | None = None,
    ) -> str:
        """
        Get the complete URL for the RAGFlow API call.

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use 'chat' or 'agent' as the endpoint type segment in the model string.
  2. Check the model string's second segment for typos.

Example fix

model="ragflow/chat/<chat_id>/<model>"  # not ragflow/session/...
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when the RAGFlow endpoint type segment is neither 'chat' nor 'agent'.

Common situations: See trigger scenarios.


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