zylon-ai/private-gpt · error · ValueError
INVALID_REQUEST_ERROR
INVALID_REQUEST_ERROR
Error message
Configured model does not support function calling
What it means
Identical guard in the synchronous ChatEngine.initialize_run: llm = self._llm_component.get_llm(request.system.model) must be a FunctionCallingLLM or the run is aborted with ValueError before the context-stack requirement and sampling-params validation are checked. Tagged INVALID_REQUEST_ERROR, so it is treated as caller error (bad model choice in the request), not an internal fault.
Source
Thrown at private_gpt/components/engines/chat/chat_engine.py:869
thinking="",
signature=f"sig_{uuid4().hex}",
),
)
stream_delta_state.active_block.index = run.block_count
run.block_count += 1
stream_delta_state.active_block_kind = target_kind
handler.emit(stream_delta_state.active_block)
def initialize_run(
self,
request: ChatRequest,
context_stack: ContextStack | None = None,
hooks: list[ToolExecutionHook] | None = None,
) -> _LoopRun:
"""Build initial llm and state for one run."""
llm = self._llm_component.get_llm(request.system.model)
if not isinstance(llm, FunctionCallingLLM):
raise ValueError("Configured model does not support function calling")
if not isinstance(request, ResolvedChatRequest) and context_stack is None:
raise ValueError("Configured context stack is required")
llm_kwargs = ChatLLMParameters.model_validate(request.sampling_params)
if request.thinking.enabled and request.thinking.type:
llm_kwargs = llm_kwargs.model_copy(
update={
"reasoning_effort": ReasoningEffort.from_str(request.thinking.type)
}
)
if request.response_format and request.response_format.output_cls:
structured = StructuredOutputsParams.from_optional(
output_cls=request.response_format.output_cls,
)
if structured is not None:
llm_kwargs = llm_kwargs.model_copy(
update={"structured_outputs": structured}View on GitHub (pinned to 4a030776a3)
Solutions
- Set system.model to a function-calling-capable model in the request
- Make custom LLM classes subclass FunctionCallingLLM
- Validate the resolved LLM type in a pre-flight check before submitting the request
- Use a FunctionCallingLLM-based mock in tests
Example fix
# before request.system.model = 'my-completion-model' # ValueError # after request.system.model = 'my-tool-model' # resolves to FunctionCallingLLM
Defensive patterns
Strategy: type-guard
Validate before calling
llm = llm_component.get_llm(request.system.model)
if not isinstance(llm, FunctionCallingLLM):
raise InvalidRequestError(f'model {request.system.model!r} lacks function calling') Type guard
from llama_index.core.llms import FunctionCallingLLM
def is_function_calling_llm(llm) -> TypeGuard[FunctionCallingLLM]:
return isinstance(llm, FunctionCallingLLM) Try / catch
try:
run = engine.initialize_run(request, context_stack)
except ValueError as e:
if 'function calling' in str(e):
return JSONResponse({'error': {'code': 'INVALID_REQUEST_ERROR', 'message': str(e)}}, 400)
raise Prevention
- Advertise tool support per model in your model catalog and enforce it client-side
- Run isinstance(llm, FunctionCallingLLM) as a pre-flight before initialize_run
- Use FunctionCallingLLM-based mocks in engine tests
When it happens
Trigger: Calling initialize_run / streaming chat APIs with request.system.model pointing at a non-function-calling LLM — completion-only models, generic wrappers, or mocks that don't subclass FunctionCallingLLM.
Common situations: Requesting a small/cheap model without tool support while the engine's features (tools, structured output via response_format) require function calling; custom LLM integrations not inheriting FunctionCallingLLM; model id resolving to an unexpected LLM class after provider config changes.
Related errors
- Configured model does not support function calling
- Expected tool calls in response but found none. Message: {re
- OVERLOADED_CONDENSATION_ERROR
- Audio blocks found but no audio-capable LLM provided.
- Failed to describe audio in the message.
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/54525af4a8357f8e.
Report an issue: GitHub.