from app.models.chat import SourceRef from app.pipeline.nodes.generate import _build_low_trust_fallback def test_low_trust_fallback_for_version_parity_queries() -> None: sources = [ SourceRef( title="Sorting Demo", url="https://github.com/1337Xcode/sortingdemo", section="Overview", source_type="project", ) ] answer = _build_low_trust_fallback( "Is the source code up-to-date with the online demo version?", sources, ) assert "cannot be verified" in answer assert "[1]" in answer def test_low_trust_fallback_general_query_is_concise() -> None: sources = [ SourceRef( title="Sorting Demo", url="https://github.com/1337Xcode/sortingdemo", section="Overview", source_type="project", ) ] answer = _build_low_trust_fallback( "What technology is used to build Sorting Demo?", sources, ) assert "Sorting Demo" in answer assert "[1]" in answer