-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.py
35 lines (32 loc) · 1.03 KB
/
api.py
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
import httpx
async def llmapi_chat_start(message):
url = "https://api.llmapi.io/v1/chat/start"
print(message)
async with httpx.AsyncClient() as client:
response = await client.post(
url,
json=message.dict(),
headers={"Content-Type": "application/json"},
timeout=60,
)
return response.json()
async def llmapi_chat_end(message):
url = "https://api.llmapi.io/v1/chat/end"
async with httpx.AsyncClient() as client:
response = await client.post(
url,
json=message.dict(),
headers={"Content-Type": "application/json"},
timeout=60,
)
return response.json()
async def llmapi_chat_ask(message):
url = "https://api.llmapi.io/v1/chat/ask"
async with httpx.AsyncClient() as client:
response = await client.post(
url,
json=message.dict(),
headers={"Content-Type": "application/json"},
timeout=60,
)
return response.json()