-
Notifications
You must be signed in to change notification settings - Fork 47
/
model_registration.py
307 lines (301 loc) Β· 9.01 KB
/
model_registration.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
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
from __future__ import annotations
from langchain_benchmarks.schema import ModelRegistry, RegisteredModel
_OPEN_AI_MODELS = [
RegisteredModel(
provider="openai",
name="gpt-3.5-turbo-1106",
type="chat",
description=(
"The latest GPT-3.5 Turbo model with improved instruction following, "
"JSON mode, reproducible outputs, parallel function calling, and more. "
"Returns a maximum of 4,096 output tokens."
),
params={
"model": "gpt-3.5-turbo-1106",
},
),
RegisteredModel(
provider="openai",
name="gpt-3.5-turbo",
type="chat",
description="Currently points to gpt-3.5-turbo-0613.",
params={
"model": "gpt-3.5-turbo",
},
),
RegisteredModel(
provider="openai",
name="gpt-3.5-turbo-16k",
type="chat",
description="Currently points to gpt-3.5-turbo-0613.",
params={
"model": "gpt-3.5-turbo-16k",
},
),
RegisteredModel(
provider="openai",
name="gpt-3.5-turbo-instruct",
type="llm",
description=(
"Similar capabilities as text-davinci-003 but compatible with legacy "
"Completions endpoint and not Chat Completions."
),
params={
"model": "gpt-3.5-turbo-instruct",
},
),
RegisteredModel(
provider="openai",
name="gpt-3.5-turbo-0613",
type="chat",
description=(
"Legacy Snapshot of gpt-3.5-turbo from June 13th 2023. "
"Will be deprecated on June 13, 2024."
),
params={
"model": "gpt-3.5-turbo-0613",
},
),
RegisteredModel(
provider="openai",
name="gpt-3.5-turbo-16k-0613",
type="chat",
description=(
"Legacy Snapshot of gpt-3.5-16k-turbo from June 13th 2023. "
"Will be deprecated on June 13, 2024."
),
params={
"model": "gpt-3.5-turbo-16k-0613",
},
),
RegisteredModel(
provider="openai",
name="gpt-3.5-turbo-0301",
type="chat",
description=(
"Legacy Snapshot of gpt-3.5-turbo from March 1st 2023. "
"Will be deprecated on June 13th 2024."
),
params={
"model": "gpt-3.5-turbo-0301",
},
),
RegisteredModel(
provider="openai",
name="text-davinci-003",
type="llm",
description=(
"Legacy Can do language tasks with better quality and consistency than "
"the curie, babbage, or ada models. Will be deprecated on Jan 4th 2024."
),
params={
"model": "text-davinci-003",
},
),
RegisteredModel(
provider="openai",
name="text-davinci-002",
type="llm",
description=(
"Legacy Similar capabilities to text-davinci-003 but trained with "
"supervised fine-tuning instead of reinforcement learning. "
"Will be deprecated on Jan 4th 2024."
),
params={
"model": "text-davinci-002",
},
),
RegisteredModel(
provider="openai",
name="code-davinci-002",
type="llm",
description="Legacy Optimized for code-completion tasks. Will be deprecated "
"on Jan 4th 2024.",
params={
"model": "code-davinci-002",
},
),
RegisteredModel(
provider="openai",
name="gpt-4-1106-preview",
type="chat",
description="GPT-4 TurboNew - The latest GPT-4 model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. Returns a maximum of 4,096 output tokens. This preview model is not yet suited for production traffic.",
params={
"model": "gpt-4-1106-preview",
},
),
RegisteredModel(
provider="openai",
name="gpt-4-0613",
type="chat",
description="Snapshot of gpt-4 from June 13th 2023 with improved function calling support.",
params={
"model": "gpt-4-0613",
},
),
RegisteredModel(
provider="openai",
name="gpt-4-32k-0613",
type="chat",
description="Snapshot of gpt-4-32k from June 13th 2023 with improved function calling support.",
params={
"model": "gpt-4-32k-0613",
},
),
RegisteredModel(
provider="openai",
name="gpt-4-0314",
description="Snapshot of gpt-4 from March 14th 2023 with function calling support. This model version will be deprecated on June 13th 2024.",
type="chat",
params={
"model": "gpt-4-0314",
},
),
RegisteredModel(
provider="openai",
name="gpt-4-32k-0314",
description="Snapshot of gpt-4-32k from March 14th 2023 with function calling support. This model version will be deprecated on June 13th 2024.",
type="chat",
params={
"model": "gpt-4-32k-0314",
},
),
]
_FIREWORKS_MODELS = [
RegisteredModel(
provider="fireworks",
name="llama-v2-7b-chat-fw",
type="chat",
description="7b parameter LlamaChat model",
params={
"model": "accounts/fireworks/models/llama-v2-7b-chat",
},
),
RegisteredModel(
provider="fireworks",
name="llama-v2-13b-chat-fw",
type="chat",
description="13b parameter LlamaChat model",
params={
"model": "accounts/fireworks/models/llama-v2-13b-chat",
},
),
RegisteredModel(
provider="fireworks",
name="llama-v2-70b-chat-fw",
type="chat",
description="70b parameter LlamaChat model",
params={
"model": "accounts/fireworks/models/llama-v2-70b-chat",
},
),
RegisteredModel(
provider="fireworks",
name="yi-34b-200k-fw",
type="llm",
description=" 4B LLM model from 01.ai, with context window 200k.",
params={
"model": "accounts/fireworks/models/yi-34b-200k",
},
),
RegisteredModel(
provider="fireworks",
name="mixtral-8x7b-instruct-fw",
description="Mistral MoE 8x7B Instruct v0.1 model with Sparse "
"Mixture of Experts. Fine tuned for instruction following",
type="llm",
params={"model": "accounts/fireworks/models/mixtral-8x7b-instruct"},
),
]
_ANTHROPIC_MODELS = [
RegisteredModel(
provider="anthropic",
name="claude-3-haiku-20240307",
description="Fastest and most compact model for near-instant responsiveness",
type="chat",
params={"model": "claude-3-haiku-20240307"},
),
RegisteredModel(
provider="anthropic",
name="claude-3-sonnet-20240229",
description="Ideal balance of intelligence and speed for enterprise workloads",
type="chat",
params={"model": "claude-3-sonnet-20240229"},
),
RegisteredModel(
provider="anthropic",
name="claude-3-opus-20240229",
description="Most powerful model for highly complex tasks",
type="chat",
params={"model": "claude-3-opus-20240229"},
),
RegisteredModel(
provider="anthropic",
name="claude-2",
description="Superior performance on tasks that require complex reasoning",
type="chat",
params={
"model": "claude-2",
},
),
RegisteredModel(
provider="anthropic",
name="claude-2.1",
description=(
"Same performance as Claude 2, plus significant reduction in model "
"hallucination rates"
),
type="chat",
params={
"model": "claude-2.1",
},
),
RegisteredModel(
provider="anthropic",
name="claude-instant-1.2",
description="low-latency, high throughput.",
type="chat",
params={
"model": "claude-instant-1.2",
},
),
RegisteredModel(
provider="anthropic",
name="claude-instant-1",
description="low-latency, high throughput.",
type="chat",
params={
"model": "claude-instant-1",
},
),
]
_GOOGLE_GENAI_MODELS = [
RegisteredModel(
provider="google-genai",
name="gemini-pro",
description="Gemini Pro is a large model from Google trained on a diverse set of tasks.",
type="chat",
params={
"model": "gemini-pro",
"convert_system_message_to_human": True,
},
)
]
_ANYSCALE_MODELS = [
RegisteredModel(
provider="anyscale",
name="mistral-7b-instruct-v0.1",
description="Mistral 7B model fine-tuned for function-calling.",
type="chat",
params={
"model": "mistralai/Mistral-7B-Instruct-v0.1",
},
),
]
model_registry = ModelRegistry(
registered_models=_OPEN_AI_MODELS
+ _FIREWORKS_MODELS
+ _ANYSCALE_MODELS
+ _ANTHROPIC_MODELS
+ _GOOGLE_GENAI_MODELS
)