Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(voice-engine): offer only tool-calling models on the Local voice card

rubenluetke10-beepe62af71abfb4
diff --git a/jarvis/realtime/local_voice_setup.py b/jarvis/realtime/local_voice_setup.py
index 2a05f29e16..1a8ca847ce 100644
--- a/jarvis/realtime/local_voice_setup.py
+++ b/jarvis/realtime/local_voice_setup.py
@@ -596,11 +596,38 @@ def _visible_models(names: Iterable[str]) -> list[str]:
return sorted(n for n in names if not is_hidden_alias(n))
+async def _without_toolless(names: set[str]) -> set[str]:
+ """Drop models that declare capabilities but not ``tools`` (embedding, OCR).
+
+ Live voice needs tool calls; an embedding model on the picker can never
+ answer. A model whose capabilities are unknown stays (empty = unknown,
+ never "can do nothing"), and so does every name when Ollama's inventory
+ cannot be read.
+ """
+ try:
+ from jarvis.brain.ollama_inventory import ( # noqa: PLC0415
+ OllamaServerError,
+ cached_snapshot,
+ same_model,
+ )
+ from jarvis.brain.ollama_pull import server_root # noqa: PLC0415
+ except ImportError:
+ return names
+ try:
+ snapshot = await cached_snapshot(server_root())
+ except OllamaServerError as exc:
+ log.info("Ollama inventory unreadable; offering every installed model: %s", exc)
+ return names
+ toolless = [m.name for m in snapshot.models if m.capabilities and "tools" not in m.capabilities]
+ return {n for n in names if not any(same_model(n, t) for t in toolless)}
+
+
async def card_status(
cfg: Any,
*,
installed_llms: Callable[[], Awaitable[tuple[set[str], str | None]]] | None = None,
machine: str | None = None,
+ tool_capable: Callable[[set[str]], Awaitable[set[str]]] | None = None,
) -> dict[str, Any]:
"""Everything the Local voice card renders, in one payload.
@@ -627,6 +654,9 @@ async def card_status(
installed_llms = installed_models
names, llm_error = await installed_llms()
+ choices = set(names)
+ if choices and not llm_error:
+ choices = await (tool_capable or _without_toolless)(choices)
section = getattr(cfg, "voice_engine", None)
configured = str(getattr(section, "llm_model", "") or "")
@@ -636,7 +666,7 @@ async def card_status(
elif recorded.get("llm_model"):
llm_model, llm_source = str(recorded["llm_model"]), "setup"
else:
- llm_model, _present = choose_llm(machine, names)
+ llm_model, _present = choose_llm(machine, choices)
llm_source = "default"
llm_installed = None if llm_error else any(_same_tag(llm_model, n) for n in names)
@@ -666,7 +696,7 @@ async def card_status(
"llm_source": llm_source,
"llm_installed": llm_installed,
"llm_error": llm_error or "",
- "llm_choices": _visible_models(names),
+ "llm_choices": _visible_models(choices),
"voice": settings.tts,
"voices": list(VOICE_ENGINE_VOICES),
"machine_class": machine,
diff --git a/tests/unit/ui/web/test_local_voice_routes.py b/tests/unit/ui/web/test_local_voice_routes.py
index 81a9d916f8..5cf6efce16 100644
--- a/tests/unit/ui/web/test_local_voice_routes.py
+++ b/tests/unit/ui/web/test_local_voice_routes.py
@@ -31,7 +31,12 @@ def home(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
async def installed() -> tuple[set[str], str | None]:
return {"qwen3.5:2b"}, None
+ async def every_model_calls_tools(names: set[str]) -> set[str]:
+ return names
+
monkeypatch.setattr(ollama_pull, "installed_models", installed)
+ # Never read the machine's real Ollama inventory from a test.
+ monkeypatch.setattr(setup, "_without_toolless", every_model_calls_tools)
setup._reset_for_tests()
LocalVoiceProvider._engine = None
yield engine_home
diff --git a/tests/unit/voice_engine/test_local_voice_setup.py b/tests/unit/voice_engine/test_local_voice_setup.py
index 6922a2f167..da987f2233 100644
--- a/tests/unit/voice_engine/test_local_voice_setup.py
+++ b/tests/unit/voice_engine/test_local_voice_setup.py
@@ -175,11 +175,22 @@ def test_only_measured_platforms_count_as_verified() -> None:
assert setup.expected_latency("gpu") == {"low_s": None, "high_s": None, "basis": "selftest"}
-def _status(cfg, *, installed=frozenset(), error=None, machine="nvidia"):
+def _status(cfg, *, installed=frozenset(), error=None, machine="nvidia", toolless=frozenset()):
async def llms():
return set(installed), error
- return asyncio.run(setup.card_status(cfg, installed_llms=llms, machine=machine))
+ async def tool_capable(names: set[str]) -> set[str]:
+ return names - set(toolless)
+
+ return asyncio.run(setup.card_status(cfg, installed_llms=llms, machine=machine,
+ tool_capable=tool_capable))
+
+
+def test_models_without_tool_calls_are_not_offered(_isolated_home: Path) -> None:
+ status = _status(JarvisConfig(), installed={"qwen3.5:2b", "bge-m3:latest"},
+ toolless={"bge-m3:latest"}, machine="cpu")
+ assert status["llm_choices"] == ["qwen3.5:2b"]
+ assert status["llm_model"] == "qwen3.5:2b" and status["llm_installed"] is True
def test_status_before_setup_names_the_next_step(_isolated_home: Path) -> None: