{"record":{"id":"782aeeaf8ddf1aec","repo":"langchain-ai/langchain","slug":"unsupported-function-function-functions-must-b","errorCode":null,"errorMessage":"Unsupported function\n\n{function}\n\nFunctions must be passed in as Dict, pydantic.BaseModel, or Callable. If they're a dict they must either be in OpenAI function format or valid JSON schema with top-level 'title' key.","messagePattern":"Unsupported function\n\n(.+?)\n\nFunctions must be passed in as Dict, pydantic\\.BaseModel, or Callable\\. If they're a dict they must either be in OpenAI function format or valid JSON schema with top-level 'title' key\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/utils/function_calling.py","lineNumber":468,"sourceCode":"            \"dict[str, Any]\", _convert_python_function_to_openai_function(function)\n        )\n    else:\n        if isinstance(function, dict) and (\n            \"type\" in function or \"properties\" in function\n        ):\n            msg = (\n                f\"Unsupported function\\n\\n{function}\\n\\nTo use a JSON schema as a \"\n                \"function, it must have a top-level 'title' key to be used as the \"\n                \"function name.\"\n            )\n            raise ValueError(msg)\n        msg = (\n            f\"Unsupported function\\n\\n{function}\\n\\nFunctions must be passed in\"\n            \" as Dict, pydantic.BaseModel, or Callable. If they're a dict they must\"\n            \" either be in OpenAI function format or valid JSON schema with top-level\"\n            \" 'title' key.\"\n        )\n        raise ValueError(msg)\n\n    if strict is not None:\n        if \"strict\" in oai_function and oai_function[\"strict\"] != strict:\n            msg = (\n                f\"Tool/function already has a 'strict' key with value \"\n                f\"{oai_function['strict']} which is different from the explicit \"\n                f\"`strict` arg received {strict=}.\"\n            )\n            raise ValueError(msg)\n        oai_function[\"strict\"] = strict\n        if strict:\n            # All fields must be `required`\n            parameters = oai_function.get(\"parameters\")\n            if isinstance(parameters, dict):\n                fields = parameters.get(\"properties\")\n                if isinstance(fields, dict) and fields:\n                    parameters = dict(parameters)\n                    parameters[\"required\"] = list(fields.keys())","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/utils/function_calling.py#L450-L486","documentation":"Error \"Unsupported function\n\n{function}\n\nFunctions must be passed in as Dict, pydantic.BaseModel, or Callable. If they're a dict they must either be in OpenAI function format or valid JSON schema with top-level 'title' key.\" thrown in langchain-ai/langchain.","triggerScenarios":"Raised when convert_to_openai_function receives an unsupported object: not a dict in OpenAI function format, not a valid JSON schema with 'title', not a pydantic.BaseModel, and not a callable.","commonSituations":"See trigger scenarios.","solutions":["Pass the function as a dict in OpenAI function format, a pydantic.BaseModel subclass, or a Python callable.","If passing a dict, ensure it is either OpenAI function format or a valid JSON schema with a top-level 'title' key."],"exampleFix":"convert_to_openai_function(MyModel)  # or a callable, or {'name':..., 'parameters': {...}}","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}