forked from Azure-Samples/rag-postgres-openai-python
-
Notifications
You must be signed in to change notification settings - Fork 32
/
locustfile.py
50 lines (46 loc) · 1.61 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
47
48
49
50
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(
[
"Summarize GitHub services shown in Python sessions",
"Livestreams about Copilot",
"In-person sessions about GitHub Actions",
]
),
"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}
},
},
)