mlflow/mlflow · error · MlflowException

predict_fn must accept either 'messages' or 'input' paramete

Error message

predict_fn must accept either 'messages' or 'input' parameter for the conversation history. Use 'messages' for Chat Completions API format or 'input' for Responses API format.

What it means

Error "predict_fn must accept either 'messages' or 'input' parameter for the conversation history. Use 'messages' for Chat Completions API format or 'input' for Responses API format." thrown in mlflow/mlflow.

Source

Thrown at mlflow/genai/simulators/simulator.py:363

        return self.invoke_llm(prompt)


def _is_missing_context_value(value: Any) -> bool:
    return value is None or (isinstance(value, float) and math.isnan(value))


def _validate_simulator_predict_fn_signature(
    predict_fn: Callable[..., dict[str, Any]],
) -> None:
    parameters = inspect.signature(predict_fn).parameters
    if "messages" in parameters and "input" in parameters:
        raise MlflowException(
            "predict_fn cannot have both 'messages' and 'input' parameters. "
            "Use 'messages' for Chat Completions API format or 'input' for Responses "
            "API format."
        )
    if "messages" not in parameters and "input" not in parameters:
        raise MlflowException(
            "predict_fn must accept either 'messages' or 'input' parameter for the "
            "conversation history. Use 'messages' for Chat Completions API format or "
            "'input' for Responses API format."
        )


@format_docstring(_MODEL_API_DOC)
class ConversationSimulator:
    """
    Generates multi-turn conversations by simulating user interactions with a target agent.

    The simulator creates a simulated user agent that interacts with your agent's predict function.
    Each conversation is traced in MLflow, allowing you to evaluate how your agent handles
    various user goals and personas.

    The predict function passed to the simulator must accept the conversation history
    as a list of message dictionaries (e.g., ``[{"role": "user", "content": "..."}]``).
    Two formats are supported:

View on GitHub (pinned to 6a27f2decc)

When it happens

Trigger: Thrown at mlflow/genai/simulators/simulator.py:363 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29). Data as JSON: /api/errors/befbca7cca4e694f. Report an issue: GitHub.