-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Locust loadtest * Add vals to gunicorn conf, improve locustfile * Update gunicorn.conf.py * Reformat locustfile * Add locust to dev requirements
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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={ | ||
"history": [{"user": random.choice(["What is included in my Northwind Health Plus plan that is not in standard?", "What does a Product Manager do?", "What happens in a performance review?", "Whats your whistleblower policy?"])}], | ||
"approach": "rrr", | ||
"overrides": {"retrieval_mode": "hybrid", "semantic_ranker": True, "semantic_captions": False, "top": 3, "suggest_followup_questions": False}, | ||
}, | ||
) | ||
time.sleep(5) | ||
self.client.post( | ||
"/chat", | ||
json={ | ||
"history": [ | ||
{ | ||
"user": "What happens in a performance review?", | ||
"bot": "During the performance review at Contoso Electronics, the supervisor will discuss the employee's performance over the past year and provide feedback on areas for improvement. They will also provide an opportunity for the employee to discuss their goals and objectives for the upcoming year. The review is a two-way dialogue between managers and employees, and employees will receive a written summary of their performance review which will include a rating of their performance, feedback, and goals and objectives for the upcoming year [employee_handbook-3.pdf].", | ||
}, | ||
{"user": "Does my plan cover eye exams?"}, | ||
], | ||
"approach": "rrr", | ||
"overrides": {"retrieval_mode": "hybrid", "semantic_ranker": True, "semantic_captions": False, "top": 3, "suggest_followup_questions": False}, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ pytest-asyncio | |
coverage | ||
pytest-cov | ||
pre-commit | ||
locust |