locustfile.py 532 Bytes
Newer Older
1
2
3
4
5
6
from locust import HttpUser, task


class GenerationUser(HttpUser):
    @task
    def generate(self):
7
        prompt = "Question: What is the longest river on the earth? Answer:"
8
        for i in range(4, 9):
9
10
            data = {"max_tokens": 2**i, "prompt": prompt}
            with self.client.post("/generation", json=data, catch_response=True) as response:
11
12
13
                if response.status_code in (200, 406):
                    response.success()
                else:
14
                    response.failure("Response wrong")