test_anthropic_backend.py 756 Bytes
Newer Older
1
import json
Lianmin Zheng's avatar
Lianmin Zheng committed
2
3
4
import unittest

from sglang import Anthropic, set_default_backend
Liangsheng Yin's avatar
Liangsheng Yin committed
5
from sglang.test.test_programs import test_mt_bench, test_stream
Lianmin Zheng's avatar
Lianmin Zheng committed
6
7
8
9
10
11
12
13
14
15


class TestAnthropicBackend(unittest.TestCase):
    backend = None
    chat_backend = None

    def setUp(self):
        cls = type(self)

        if cls.backend is None:
16
            cls.backend = Anthropic("claude-3-haiku-20240307")
Lianmin Zheng's avatar
Lianmin Zheng committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
            set_default_backend(cls.backend)

    def test_mt_bench(self):
        test_mt_bench()

    def test_stream(self):
        test_stream()


if __name__ == "__main__":
    unittest.main(warnings="ignore")

    # from sglang.global_config import global_config

    # global_config.verbosity = 2
    # t = TestAnthropicBackend()
    # t.setUp()
    # t.test_mt_bench()