-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_timeout.py
More file actions
25 lines (23 loc) · 843 Bytes
/
Copy pathtest_timeout.py
File metadata and controls
25 lines (23 loc) · 843 Bytes
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
import asyncio
import httpx
import time
async def main():
start = time.time()
try:
async with httpx.AsyncClient() as client:
resp = await client.post(
"http://127.0.0.1:4000/v1/chat/completions",
json={
"model": "frugallm",
"messages": [{"role": "user", "content": "Write a 5 page essay."}]
},
headers={"Authorization": "Bearer sk-sidecar-1"},
timeout=1800.0 # we want to see if litellm times out on its own
)
print(f"Status: {resp.status_code}")
print(f"Time: {time.time() - start:.2f}s")
print(resp.text[:200])
except Exception as e:
print(f"Exception: {e}")
print(f"Time: {time.time() - start:.2f}s")
asyncio.run(main())