run-llama/llama_index · error · ValueError
Model name {llm.metadata.model_name} does not support functi
Error message
Model name {llm.metadata.model_name} does not support function calling API. What it means
Error "Model name {llm.metadata.model_name} does not support function calling API. " thrown in run-llama/llama_index.
Source
Thrown at llama-index-core/llama_index/core/program/function_program.py:110
@classmethod
def from_defaults(
cls,
output_cls: Type[Model],
prompt_template_str: Optional[str] = None,
prompt: Optional[BasePromptTemplate] = None,
llm: Optional[LLM] = None,
verbose: bool = False,
allow_parallel_tool_calls: bool = False,
tool_choice: Optional[Union[str, Dict[str, Any]]] = None,
tool_required: bool = True,
**kwargs: Any,
) -> "FunctionCallingProgram":
llm = llm or Settings.llm # type: ignore
assert llm is not None
if not llm.metadata.is_function_calling_model:
raise ValueError(
f"Model name {llm.metadata.model_name} does not support "
"function calling API. "
)
if prompt is None and prompt_template_str is None:
raise ValueError("Must provide either prompt or prompt_template_str.")
if prompt is not None and prompt_template_str is not None:
raise ValueError("Must provide either prompt or prompt_template_str.")
if prompt_template_str is not None:
prompt = PromptTemplate(prompt_template_str)
return cls(
output_cls=output_cls,
llm=llm, # type: ignore
prompt=cast(PromptTemplate, prompt),
tool_choice=tool_choice,
allow_parallel_tool_calls=allow_parallel_tool_calls,
tool_required=tool_required,View on GitHub (pinned to afd0fef371)
Solutions
- Switch to a model that supports the function calling API (e.g. gpt-4o).
- Use PydanticProgramMode.LLM for text-based structured output instead.
When it happens
Trigger: Thrown at llama-index-core/llama_index/core/program/function_program.py:110 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/22266e68790c3020.
Report an issue: GitHub.