From d2aef0b8ad021d5be3fa5191557127913df42275 Mon Sep 17 00:00:00 2001 From: Whitroom <1062015905@qq.com> Date: Wed, 12 Apr 2023 16:04:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api_test.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 api_test.py diff --git a/api_test.py b/api_test.py new file mode 100644 index 0000000..f47bf1f --- /dev/null +++ b/api_test.py @@ -0,0 +1,17 @@ +import unittest +from httpx import AsyncClient + +class TestGenerateChat(unittest.IsolatedAsyncioTestCase): + async def test_generate_chat(self): + async with AsyncClient() as ac: + response = await ac.post( + "http://localhost:8000/", + json={ + "prompt": "你好", + "history": [], + "max_length": 2048, + "top_p": 0.7, + "temperature": 0.95 + }) + self.assertEqual(response.status_code, 200) + print(response.json()) \ No newline at end of file