This repository has been archived by the owner on Nov 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenai_users.py
90 lines (62 loc) · 2.27 KB
/
openai_users.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from locust import User, task, constant
from test_clients import OpenAIClient
class _GPT35turboUser_(User):
abstract = True
def __init__(self, env):
super().__init__(env)
self.client = OpenAIClient("gpt-3.5-turbo")
wait_time = constant(1)
class GPT35turboUser(_GPT35turboUser_):
wait_time = constant(1)
@task
def chat_completion(self):
msg = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the role of automatic differentiation in neural networks?"},
]
self.client.chat_completion(msg)
class _GPT35turbo16kUser_(User):
abstract = True
def __init__(self, env):
super().__init__(env)
self.client = OpenAIClient("gpt-3.5-turbo-16k")
wait_time = constant(1)
class GPT35turbo16kUser(_GPT35turbo16kUser_):
wait_time = constant(1)
@task
def chat_completion(self):
msg = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the role of automatic differentiation in neural networks?"},
]
self.client.chat_completion(msg)
class _GPT35turbo1106User_(User):
abstract = True
def __init__(self, env):
super().__init__(env)
self.client = OpenAIClient("gpt-3.5-turbo-1106")
wait_time = constant(1)
class GPT35turbo1106User(_GPT35turbo1106User_):
wait_time = constant(1)
@task
def chat_completion(self):
msg = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the role of automatic differentiation in neural networks?"},
]
self.client.chat_completion(msg)
class _GPT40613User_(User):
abstract = True
def __init__(self, env):
super().__init__(env)
self.client = OpenAIClient("gpt-4-0613")
wait_time = constant(1)
class GPT40613User(_GPT40613User_):
wait_time = constant(1)
@task
def chat_completion(self):
msg = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the role of automatic differentiation in neural networks?"},
]
self.client.chat_completion(msg)