-
Notifications
You must be signed in to change notification settings - Fork 31
/
constants.ts
309 lines (295 loc) · 6.75 KB
/
constants.ts
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
export const STABLE_DIFFUSION_API_URL = "https://api.stability.ai/v1/generation";
export const STABLE_DIFFUSION_TEXT_TO_IMAGE = "text-to-image";
export enum Providers {
OPENAI = "openai",
CHAT_OPENAI = "chat_openai",
ANTHROPIC = "anthropic",
AZURE_CHAT_OPENAI = "azure_chat_openai",
COHERE = "cohere",
REPLICATE = "replicate",
}
/**
* Enum representing the different types of model input.
*/
export enum ModelInputType {
PROMPT = "prompt",
MESSAGES = "messages",
}
/**
* Enum representing different user roles.
*/
export enum UserRole {
SUPER_ADMIN = "super_admin",
ADMIN = "admin",
}
export enum ResponseFormatType {
TEXT = "text",
JSON_OBJECT = "json_object",
}
/**
* Array of model objects with provider, name, input type, order, input and output cost, and cost factor.
*/
export const models = [
{
provider: Providers.CHAT_OPENAI,
name: "gpt-3.5-turbo-1106",
inputType: ModelInputType.MESSAGES,
order: 1,
inputCost: 0.001,
outputCost: 0.002,
costFactor: 1000,
},
{
provider: Providers.CHAT_OPENAI,
name: "gpt-3.5-turbo-0613",
inputType: ModelInputType.MESSAGES,
order: 2,
inputCost: 0.0015,
outputCost: 0.002,
costFactor: 1000,
},
{
provider: Providers.CHAT_OPENAI,
name: "gpt-3.5-turbo-16k-0613",
inputType: ModelInputType.MESSAGES,
order: 3,
inputCost: 0.003,
outputCost: 0.004,
costFactor: 1000,
},
{
provider: Providers.CHAT_OPENAI,
name: "gpt-4-0613",
inputType: ModelInputType.MESSAGES,
order: 4,
inputCost: 0.03,
outputCost: 0.06,
costFactor: 1000,
},
{
provider: Providers.CHAT_OPENAI,
name: "gpt-4-1106-preview",
inputType: ModelInputType.MESSAGES,
order: 5,
inputCost: 0.01,
outputCost: 0.03,
costFactor: 1000,
},
{
provider: Providers.CHAT_OPENAI,
name: "gpt-4-32k-0613",
inputType: ModelInputType.MESSAGES,
order: 6,
inputCost: 0.06,
outputCost: 0.12,
costFactor: 1000,
},
{
provider: Providers.AZURE_CHAT_OPENAI,
name: "gpt-35-turbo",
inputType: ModelInputType.MESSAGES,
order: 7,
inputCost: 0.0015,
outputCost: 0.002,
costFactor: 1000,
},
{
provider: Providers.AZURE_CHAT_OPENAI,
name: "gpt-35-turbo-16k",
inputType: ModelInputType.MESSAGES,
order: 8,
inputCost: 0.003,
outputCost: 0.004,
costFactor: 1000,
},
{
provider: Providers.AZURE_CHAT_OPENAI,
name: "gpt-4",
inputType: ModelInputType.MESSAGES,
order: 9,
inputCost: 0.03,
outputCost: 0.06,
costFactor: 1000,
},
{
provider: Providers.AZURE_CHAT_OPENAI,
name: "gpt-4-turbo",
inputType: ModelInputType.MESSAGES,
order: 10,
inputCost: 0.01,
outputCost: 0.03,
costFactor: 1000,
},
{
provider: Providers.AZURE_CHAT_OPENAI,
name: "gpt-4-32k",
inputType: ModelInputType.MESSAGES,
order: 11,
inputCost: 0.06,
outputCost: 0.12,
costFactor: 1000,
},
{
provider: Providers.OPENAI,
name: "gpt-3.5-turbo-instruct",
inputType: ModelInputType.PROMPT,
order: 12,
inputCost: 0.0015,
outputCost: 0.002,
costFactor: 1000,
},
{
provider: Providers.OPENAI,
name: "text-davinci-003",
inputType: ModelInputType.PROMPT,
order: 13,
inputCost: 0.02,
outputCost: 0.02,
costFactor: 1000,
},
{
provider: Providers.OPENAI,
name: "text-ada-001",
inputType: ModelInputType.PROMPT,
order: 14,
inputCost: 0.02,
outputCost: 0.02,
costFactor: 1000,
},
{
provider: Providers.OPENAI,
name: "text-babbage-001",
inputType: ModelInputType.PROMPT,
order: 15,
inputCost: 0.02,
outputCost: 0.02,
costFactor: 1000,
},
{
provider: Providers.OPENAI,
name: "text-curie-001",
inputType: ModelInputType.PROMPT,
order: 16,
inputCost: 0.02,
outputCost: 0.02,
costFactor: 1000,
},
{
provider: Providers.OPENAI,
name: "ada-instruct-beta",
inputType: ModelInputType.PROMPT,
order: 17,
inputCost: 0.02,
outputCost: 0.02,
costFactor: 1000,
},
{
provider: Providers.OPENAI,
name: "babbage-instruct-beta",
inputType: ModelInputType.PROMPT,
order: 18,
inputCost: 0.02,
outputCost: 0.02,
costFactor: 1000,
},
{
provider: Providers.OPENAI,
name: "curie-instruct-beta",
inputType: ModelInputType.PROMPT,
order: 19,
inputCost: 0.02,
outputCost: 0.02,
costFactor: 1000,
},
{
provider: Providers.ANTHROPIC,
name: "claude-instant-1.1",
inputType: ModelInputType.PROMPT,
order: 20,
inputCost: 1.63,
outputCost: 5.51,
costFactor: 1000000,
},
{
provider: Providers.ANTHROPIC,
name: "claude-instant-1.2",
inputType: ModelInputType.PROMPT,
order: 21,
inputCost: 1.63,
outputCost: 5.51,
costFactor: 1000000,
},
{
provider: Providers.ANTHROPIC,
name: "claude-2",
inputType: ModelInputType.PROMPT,
order: 22,
inputCost: 8.0,
outputCost: 24.0,
costFactor: 1000000,
},
{
provider: Providers.ANTHROPIC,
name: "claude-2.1",
inputType: ModelInputType.PROMPT,
order: 23,
inputCost: 8.0,
outputCost: 24.0,
costFactor: 1000000,
},
{
provider: Providers.COHERE,
name: "command",
inputType: ModelInputType.PROMPT,
order: 24,
inputCost: 15.0,
outputCost: 15.0,
costFactor: 1000000,
},
];
/**
* Enum representing error messages.
*/
export enum ImageVendor {
DALL_E = "dall-e",
STABLE_DIFFUSION = "stable-diffusion",
}
// eslint-disable-next-line @typescript-eslint/naming-convention
export enum ERROR_MESSAGES {
INCORRECT_PASSWORD = "Incorrect Password",
USER_NOT_FOUND = "User not found",
PROMPT_NOT_FOUND = "Prompt not found",
MODEL_NOT_FOUND = "Model not found",
NO_MODELS_AVAILABLE = "No models available",
HEALTH_CHECK_DATA_NOT_FOUND = "No health check data found",
MODEL_USAGE_DATA_NOT_FOUND = "No model usage data found",
}
/**
* Enum representing server-sent events.
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
export enum SSE_EVENTS {
UPDATE = "update",
META = "meta",
ERROR = "error",
GENERATION_SOURCE = "generation_source",
END = "end",
}
export enum ImageChatModels {
GPT_4_VISION_PREVIEW = "gpt-4-vision-preview",
LLAVA = "llava",
}
/**
* Expression representing the cron job for health check.
*/
export const HEALTH_CHECK_CRON_JOB_EXPRESSION = "*/5 * * * *";
export const DEFAULT_TIMEOUT_IN_MS = 60 * 1000;
export const DEFAULT_MAX_RETRIES = 3;
export const MODEL_LATENCY_LIMIT_FOR_GENERATION = 4000;
export const STABLE_DIFFUSION_IMAGE_GENERATION_PARAMS = {
steps: 40,
seed: 0,
cfg_scale: 5,
};
export const STABLE_DIFFUSION_IMAGE_GENERATION_PARAMS_HEIGHT = 1024;
export const STABLE_DIFFUSION_IMAGE_GENERATION_PARAMS_WIDTH = 1024;