{"record":{"id":"07a3759fb385f20a","repo":"BerriAI/litellm","slug":"either-model-or-agent-must-be-provided","errorCode":null,"errorMessage":"Either 'model' or 'agent' must be provided","messagePattern":"Either 'model' or 'agent' must be provided","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/gemini/interactions/transformation.py","lineNumber":154,"sourceCode":"        - ``response_mime_type`` is folded into ``response_format`` and stripped from\n          the body (the field was removed in Api-Revision 2026-05-20).\n        - ``generation_config.image_config`` is moved to a ``response_format`` entry\n          with ``\"type\": \"image\"`` (also removed from generation_config in 2026-05-20).\n\n        When on the legacy schema (use_legacy_interactions_schema=True):\n        - All fields are forwarded as-is.\n        \"\"\"\n        use_legacy: Final[bool] = litellm.use_legacy_interactions_schema\n\n        request_body: Final[dict[str, Any]] = {}\n\n        # Model or Agent (one required)\n        if model:\n            request_body[\"model\"] = GeminiModelInfo.get_base_model(model) or model\n        elif agent:\n            request_body[\"agent\"] = agent\n        else:\n            raise ValueError(\"Either 'model' or 'agent' must be provided\")\n\n        # Input\n        if input is not None:\n            request_body[\"input\"] = input\n\n        # Pass through optional params — legacy schema keeps all fields as-is.\n        optional_keys: Final = [\n            \"tools\",\n            \"system_instruction\",\n            \"stream\",\n            \"store\",\n            \"background\",\n            \"environment\",\n            \"response_modalities\",\n            \"previous_interaction_id\",\n        ]\n        for key in optional_keys:\n            if optional_params.get(key) is not None:","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/gemini/interactions/transformation.py#L136-L172","documentation":"Error \"Either 'model' or 'agent' must be provided\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/gemini/interactions/transformation.py:154 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass either model or agent in the interactions request."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}