Files
DeepTutor/tests/services/config/test_visualize_params.py
Bingxi Zhao (Frank) eabc17d79f release: v1.6.10
Native LightRAG role models: extraction, keyword, query and vision each
resolve their own model, vision indexing pins a vision-capable model
instead of silently degrading, and a knowledge base records which models
and which embedding built it. A published index refuses queries after its
embedding identity changes rather than searching a foreign vector space,
and a rebuild is confirmed against the configuration it will actually
use — a stale confirmation is rejected instead of quietly rebuilding
something else. A failed publication is withdrawn, not left half-written.

PDF attachments follow the parsing engine configured for the workspace,
report the stage they are in, and a truncated answer says it was
truncated with the counters that prove it. Providers are no longer
filtered out of the embedding picker on an unverifiable capability guess:
configure the model and test it. Visualize's temperature and token budget
are settings rather than literals. Notebook evidence no longer depends on
the chat session that produced it.

See assets/releases/ver1-6-10.md for the full notes, and the README
translations for the propagated prose.
2026-09-22 21:36:27 +08:00

65 lines
2.2 KiB
Python

"""The visualize loop's output budget must be readable from agents.yaml.
``visualize`` built its pipeline with ``max_tokens=16000`` written into the call,
so a reasoning model that spends most of a round inside ``<think>`` truncated the
``submit_visualization`` arguments mid-JSON and the canvas came back empty — with
no setting anywhere that changed it (#1546).
"""
from __future__ import annotations
from pathlib import Path
from typing import Any
import pytest
import yaml
from deeptutor.services.config import capabilities_settings as module
from deeptutor.services.config.capabilities_settings import get_visualize_params
def _settings_root(tmp_path: Path, content: dict[str, Any]) -> Path:
settings_dir = tmp_path / "data" / "user" / "settings"
settings_dir.mkdir(parents=True, exist_ok=True)
(settings_dir / "agents.yaml").write_text(yaml.dump(content), encoding="utf-8")
return tmp_path
def test_visualize_defaults_match_the_previously_hardcoded_call(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
"""An install that never touched this keeps exactly the old behaviour."""
monkeypatch.setattr(module, "PROJECT_ROOT", _settings_root(tmp_path, {"capabilities": {}}))
assert get_visualize_params() == {"temperature": 0.15, "max_tokens": 16000}
def test_visualize_budget_is_overridable_from_agents_yaml(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
monkeypatch.setattr(
module,
"PROJECT_ROOT",
_settings_root(
tmp_path,
{"capabilities": {"visualize": {"temperature": 0.4, "max_tokens": 48000}}},
),
)
assert get_visualize_params() == {"temperature": 0.4, "max_tokens": 48000}
def test_visualize_is_exposed_to_the_settings_page(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
"""The same block the UI reads and writes, so the page cannot drift."""
monkeypatch.setattr(module, "PROJECT_ROOT", _settings_root(tmp_path, {"capabilities": {}}))
payload = module.capabilities_settings_dict()
assert payload["visualize"] == {"temperature": 0.15, "max_tokens": 16000}
module.save_capabilities_settings({"visualize": {"max_tokens": 32000}})
assert get_visualize_params()["max_tokens"] == 32000