{"record":{"id":"22266e68790c3020","repo":"run-llama/llama_index","slug":"model-name-llm-metadata-model-name-does-not-supp","errorCode":null,"errorMessage":"Model name {llm.metadata.model_name} does not support function calling API. ","messagePattern":"Model name (.+?) does not support function calling API\\. ","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/program/function_program.py","lineNumber":110,"sourceCode":"\n    @classmethod\n    def from_defaults(\n        cls,\n        output_cls: Type[Model],\n        prompt_template_str: Optional[str] = None,\n        prompt: Optional[BasePromptTemplate] = None,\n        llm: Optional[LLM] = None,\n        verbose: bool = False,\n        allow_parallel_tool_calls: bool = False,\n        tool_choice: Optional[Union[str, Dict[str, Any]]] = None,\n        tool_required: bool = True,\n        **kwargs: Any,\n    ) -> \"FunctionCallingProgram\":\n        llm = llm or Settings.llm  # type: ignore\n        assert llm is not None\n\n        if not llm.metadata.is_function_calling_model:\n            raise ValueError(\n                f\"Model name {llm.metadata.model_name} does not support \"\n                \"function calling API. \"\n            )\n\n        if prompt is None and prompt_template_str is None:\n            raise ValueError(\"Must provide either prompt or prompt_template_str.\")\n        if prompt is not None and prompt_template_str is not None:\n            raise ValueError(\"Must provide either prompt or prompt_template_str.\")\n        if prompt_template_str is not None:\n            prompt = PromptTemplate(prompt_template_str)\n\n        return cls(\n            output_cls=output_cls,\n            llm=llm,  # type: ignore\n            prompt=cast(PromptTemplate, prompt),\n            tool_choice=tool_choice,\n            allow_parallel_tool_calls=allow_parallel_tool_calls,\n            tool_required=tool_required,","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/program/function_program.py#L92-L128","documentation":"Error \"Model name {llm.metadata.model_name} does not support function calling API. \" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/program/function_program.py:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Switch to a model that supports the function calling API (e.g. gpt-4o).","Use PydanticProgramMode.LLM for text-based structured output instead."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}