Langchain-Chatchat
47 строк · 1.0 Кб
1import sys2from pathlib import Path3root_path = Path(__file__).parent.parent.parent4sys.path.append(str(root_path))5
6from webui_pages.utils import ApiRequest7
8import pytest9from pprint import pprint10from typing import List11
12
13api = ApiRequest()14
15
16def test_get_default_llm():17llm = api.get_default_llm_model()18
19print(llm)20assert isinstance(llm, tuple)21assert isinstance(llm[0], str) and isinstance(llm[1], bool)22
23
24def test_server_configs():25configs = api.get_server_configs()26pprint(configs, depth=2)27
28assert isinstance(configs, dict)29assert len(configs) > 030
31
32def test_list_search_engines():33engines = api.list_search_engines()34pprint(engines)35
36assert isinstance(engines, list)37assert len(engines) > 038
39
40@pytest.mark.parametrize("type", ["llm_chat", "agent_chat"])41def test_get_prompt_template(type):42print(f"prompt template for: {type}")43template = api.get_prompt_template(type=type)44
45print(template)46assert isinstance(template, str)47assert len(template) > 048