2022-11-11 09:08:17 +00:00
|
|
|
from locust import HttpUser, task
|
|
|
|
|
|
|
|
|
|
|
|
class GenerationUser(HttpUser):
|
|
|
|
@task
|
|
|
|
def generate(self):
|
2023-09-19 06:20:26 +00:00
|
|
|
prompt = "Question: What is the longest river on the earth? Answer:"
|
2022-11-11 09:08:17 +00:00
|
|
|
for i in range(4, 9):
|
2023-09-19 06:20:26 +00:00
|
|
|
data = {"max_tokens": 2**i, "prompt": prompt}
|
|
|
|
with self.client.post("/generation", json=data, catch_response=True) as response:
|
2022-11-11 09:08:17 +00:00
|
|
|
if response.status_code in (200, 406):
|
|
|
|
response.success()
|
|
|
|
else:
|
2023-09-19 06:20:26 +00:00
|
|
|
response.failure("Response wrong")
|