{"record":{"id":"c72f20fc56efa10a","repo":"HKUDS/DeepTutor","slug":"cohere-model-model-name-does-not-support-multi","errorCode":null,"errorMessage":"Cohere model '{model_name}' does not support multimodal `contents`.","messagePattern":"Cohere model '(.+?)' does not support multimodal `contents`\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/services/embedding/adapters/cohere.py","lineNumber":88,"sourceCode":"        input_type = request.input_type or \"search_document\"\n\n        if api_version == \"v1\":\n            if request.contents:\n                raise ValueError(\n                    \"Cohere v1 API does not support multimodal `contents`. \"\n                    \"Use embed-v4.0 (v2 API) for multimodal.\"\n                )\n            payload = {\n                \"texts\": request.texts,\n                \"model\": model_name,\n                \"input_type\": input_type,\n            }\n\n            if not request.truncate:\n                payload[\"truncate\"] = \"NONE\"\n        else:\n            if request.contents and not bool(model_info.get(\"multimodal\", False)):\n                raise ValueError(\n                    f\"Cohere model '{model_name}' does not support multimodal `contents`.\"\n                )\n            payload = {\n                \"model\": model_name,\n                \"embedding_types\": [\"float\"],\n                \"input_type\": input_type,\n            }\n\n            if request.contents:\n                # Cohere v2 multimodal: `inputs: [{content: [{type, text|image_url}]}]`\n                # We translate the simple [{text|image|video}] contract into v2's\n                # nested form. v2 cannot mix text+image in one input, so each\n                # content dict becomes its own input item.\n                inputs = []\n                for item in request.contents:\n                    if not isinstance(item, dict):\n                        continue\n                    kind, value = next(iter(item.items()))","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/services/embedding/adapters/cohere.py#L70-L106","documentation":"On the v2 API path, the adapter checks the model catalog's 'multimodal' flag before sending contents; if the configured model doesn't declare multimodal support it raises with the model name. Even on v2, text-only models (embed-v3.0 family) cannot take image/text content parts.","triggerScenarios":"api_version='v2' with request.contents populated but the catalog entry for model_name has multimodal=false or missing (e.g. embed-english-v3.0), then embed().","commonSituations":"Switching to v2 but keeping a v3.0 model; custom/outdated catalog entries lacking the 'multimodal' key; typo'd model name resolving to a text-only entry.","solutions":["Switch to a multimodal model such as embed-v4.0 (declared multimodal in the catalog)","If the catalog entry is custom and the model truly supports it, add \"multimodal\": true","Drop contents and send texts only for text-only models"],"exampleFix":"# before\nawait cohere.embed(EmbeddingRequest(model=\"embed-english-v3.0\", contents=parts))\n# after\nawait cohere.embed(EmbeddingRequest(model=\"embed-v4.0\", contents=parts))","handlingStrategy":"validation","validationCode":"def model_allows_contents(model_info: dict, request: EmbeddingRequest) -> bool:\n    return not request.contents or bool(model_info.get(\"multimodal\", False))","typeGuard":null,"tryCatchPattern":"try:\n    await adapter.embed(req)\nexcept ValueError as e:\n    if \"does not support multimodal\" in str(e):\n        req = replace(req, contents=None)  # degrade to text-only\n        return await adapter.embed(req)\n    raise","preventionTips":["Keep the model catalog's multimodal flags in sync with provider docs","Default multimodal pipelines to embed-v4.0-class models"],"tags":["cohere","embeddings","multimodal","model-capability"],"backgroundTag":"model-capability-unsupported","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}