File size: 1,053 Bytes
9563e4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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