-
Notifications
You must be signed in to change notification settings - Fork 146
/
locustfile.py
46 lines (42 loc) · 1.45 KB
/
locustfile.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
36
37
38
39
40
41
42
43
44
45
46
import random
import time
from locust import HttpUser, between, task
class ChatUser(HttpUser):
wait_time = between(5, 20)
@task
def ask_question(self):
self.client.get("/")
time.sleep(5)
self.client.post(
"/chat",
json={
"messages": [
{
"content": random.choice(
["Best shoe for hiking?", "Climbing shoe cheaper than $30?", "Waterproof camping gear?"]
),
"role": "user",
}
],
"context": {
"overrides": {"use_advanced_flow": True, "top": 3, "retrieval_mode": "hybrid", "temperature": 0.3}
},
},
)
time.sleep(5)
self.client.post(
"/chat",
json={
"messages": [
{"content": "Best shoe for hiking?", "role": "user"},
{
"content": "For the best shoe for hiking, I recommend the Trailblaze Steel-Blue Hiking Shoes.",
"role": "assistant",
},
{"content": "any other options?", "role": "user"},
],
"context": {
"overrides": {"use_advanced_flow": True, "top": 3, "retrieval_mode": "hybrid", "temperature": 0.3}
},
},
)