{"record":{"id":"befbca7cca4e694f","repo":"mlflow/mlflow","slug":"predict-fn-must-accept-either-messages-or-input","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/genai/simulators/simulator.py","lineNumber":363,"sourceCode":"        return self.invoke_llm(prompt)\n\n\ndef _is_missing_context_value(value: Any) -> bool:\n    return value is None or (isinstance(value, float) and math.isnan(value))\n\n\ndef _validate_simulator_predict_fn_signature(\n    predict_fn: Callable[..., dict[str, Any]],\n) -> None:\n    parameters = inspect.signature(predict_fn).parameters\n    if \"messages\" in parameters and \"input\" in parameters:\n        raise MlflowException(\n            \"predict_fn cannot have both 'messages' and 'input' parameters. \"\n            \"Use 'messages' for Chat Completions API format or 'input' for Responses \"\n            \"API format.\"\n        )\n    if \"messages\" not in parameters and \"input\" not in parameters:\n        raise MlflowException(\n            \"predict_fn must accept either 'messages' or 'input' parameter for the \"\n            \"conversation history. Use 'messages' for Chat Completions API format or \"\n            \"'input' for Responses API format.\"\n        )\n\n\n@format_docstring(_MODEL_API_DOC)\nclass ConversationSimulator:\n    \"\"\"\n    Generates multi-turn conversations by simulating user interactions with a target agent.\n\n    The simulator creates a simulated user agent that interacts with your agent's predict function.\n    Each conversation is traced in MLflow, allowing you to evaluate how your agent handles\n    various user goals and personas.\n\n    The predict function passed to the simulator must accept the conversation history\n    as a list of message dictionaries (e.g., ``[{\"role\": \"user\", \"content\": \"...\"}]``).\n    Two formats are supported:","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/genai/simulators/simulator.py#L345-L381","documentation":"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.","triggerScenarios":"Thrown at mlflow/genai/simulators/simulator.py:363 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}