zylon-ai/private-gpt · warning · ValueError
No default model configured to set LLM
Error message
No default model configured to set LLM
What it means
ValueError from the deprecated llm setter on LLMComponent: assigning component.llm requires a default model id to exist, because the setter replaces the registry entry for the default model (preserving its tokenizer). With no default configured there is no entry to replace, so the assignment is rejected. The setter also logs a deprecation warning — it is intended for tests only.
Source
Thrown at private_gpt/components/llm/llm_component.py:218
):
seen.add(id(model_id))
tokenizer_fn: TokenizerFn | AsyncTokenizerFn | None = None
if component.tokenizer:
if isinstance(component.tokenizer, AsyncTokenizerBase):
tokenizer_fn = get_async_tokenizer_fn(component.tokenizer)
else:
tokenizer_fn = get_tokenizer_fn(component.tokenizer)
yield component.llm, model_config, tokenizer_fn
@property
def llm(self) -> LLM:
return self.get_llm()
@llm.setter
def llm(self, value: LLM) -> None:
if not self._default_model_id:
raise ValueError("No default model configured to set LLM")
before_tokenizer: TokenizerBase | None = None
llm_instance = self.registry.get(self._default_model_id)
if llm_instance:
before_tokenizer = llm_instance.tokenizer
self.registry.unregister(self._default_model_id)
instance = LLMInstance(llm=value, tokenizer=before_tokenizer)
logger.warning(
"Directly setting the LLM instance is deprecated. "
"Use ONLY for testing purposes."
)
self.registry.register(self._default_model_id, instance)
@property
def alias(self) -> str | None:
return self.get_alias()
View on GitHub (pinned to 4a030776a3)
Solutions
- In tests, configure a minimal model entry (or mock _default_model_id) before assigning so a default exists.
- Prefer configuring llm.models/default_model in settings over the setter; the setter is deprecated and test-only.
- If you must use the setter, ensure the component booted with at least one registered default model.
Example fix
# before component = LLMComponent() component.llm = mock_llm # raises: no default # after (give the component a default first, e.g. in settings/test fixture) component = build_component_with_default_model() component.llm = mock_llm
Defensive patterns
Strategy: validation
Validate before calling
def can_set_llm(component) -> bool:
return bool(component._default_model_id) Try / catch
try:
component.llm = mock_llm
except ValueError as e:
if 'No default model configured' in str(e):
# configure a default first, or register a model, then retry
raise RuntimeError('Configure a default model before assigning llm') from e
raise Prevention
- Treat the llm setter as test-only; production code should go through settings/registry.
- In test fixtures, always build the component with one minimal model entry.
- Assert _default_model_id is set in fixture setup so failures point at configuration, not the setter.
When it happens
Trigger: Doing `component.llm = my_llm` on a component where no default model was configured (empty config or nothing registered).
Common situations: Test fixtures wiring a mock LLM into a component built without model settings; production code using the deprecated direct-assignment API instead of configuration.
Related errors
- Audio blocks found but no audio-capable LLM provided.
- Configured model does not support function calling
- Invalid reasoning_effort budget: {budget}. Must be a number
- LLM mode '{mode}' is not supported. Available: {available}
- Default LLM model '{model_id}' could not be initialized: {e}
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/c9e20f4cb3f700f6.
Report an issue: GitHub.