Langchain-Chatchat

Форк
0
/
test_server_state_api.py 
47 строк · 1.0 Кб
1
import sys
2
from pathlib import Path
3
root_path = Path(__file__).parent.parent.parent
4
sys.path.append(str(root_path))
5

6
from webui_pages.utils import ApiRequest
7

8
import pytest
9
from pprint import pprint
10
from typing import List
11

12

13
api = ApiRequest()
14

15

16
def test_get_default_llm():
17
    llm = api.get_default_llm_model()
18
    
19
    print(llm)
20
    assert isinstance(llm, tuple)
21
    assert isinstance(llm[0], str) and isinstance(llm[1], bool)
22

23

24
def test_server_configs():
25
    configs = api.get_server_configs()
26
    pprint(configs, depth=2)
27

28
    assert isinstance(configs, dict)
29
    assert len(configs) > 0
30

31

32
def test_list_search_engines():
33
    engines = api.list_search_engines()
34
    pprint(engines)
35

36
    assert isinstance(engines, list)
37
    assert len(engines) > 0
38

39

40
@pytest.mark.parametrize("type", ["llm_chat", "agent_chat"])
41
def test_get_prompt_template(type):
42
    print(f"prompt template for: {type}")
43
    template = api.get_prompt_template(type=type)
44

45
    print(template)
46
    assert isinstance(template, str)
47
    assert len(template) > 0
48

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.