XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

~ | fixed Vercel Provider

06c448da
abc <98614666+xtekky@users.noreply.github.com>
提交于

代码差异

2 个文件 +416 -315
Modified g4f/Provider/Vercel.py +24 -315
@@ -1,6 +1,6 @@
1 1 from __future__ import annotations
2 2
3 import json, base64, requests, random, uuid
3 import json, base64, requests, random, os
4 4
5 5 try:
6 6 import execjs
@@ -13,12 +13,13 @@ from .base_provider import AbstractProvider
13 13 from ..errors import MissingRequirementsError
14 14
15 15 class Vercel(AbstractProvider):
16 url = 'https://sdk.vercel.ai'
17 working = False
16 url = 'https://chat.vercel.ai'
17 working = True
18 18 supports_message_history = True
19 supports_gpt_35_turbo = True
20 supports_stream = True
21
19 supports_gpt_35_turbo = True
20 supports_stream = True
21 supports_gpt_4 = False
22
22 23 @staticmethod
23 24 def create_completion(
24 25 model: str,
@@ -29,43 +30,34 @@ class Vercel(AbstractProvider):
29 30 ) -> CreateResult:
30 31 if not has_requirements:
31 32 raise MissingRequirementsError('Install "PyExecJS" package')
32
33 if not model:
34 model = "gpt-3.5-turbo"
35 elif model not in model_info:
36 raise ValueError(f"Vercel does not support {model}")
37
33
38 34 headers = {
39 'authority': 'sdk.vercel.ai',
35 'authority': 'chat.vercel.ai',
40 36 'accept': '*/*',
41 37 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
42 38 'cache-control': 'no-cache',
43 39 'content-type': 'application/json',
44 40 'custom-encoding': get_anti_bot_token(),
45 'origin': 'https://sdk.vercel.ai',
41 'origin': 'https://chat.vercel.ai',
46 42 'pragma': 'no-cache',
47 'referer': 'https://sdk.vercel.ai/',
48 'sec-ch-ua': '"Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"',
43 'referer': 'https://chat.vercel.ai/',
44 'sec-ch-ua': '"Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"',
49 45 'sec-ch-ua-mobile': '?0',
50 46 'sec-ch-ua-platform': '"macOS"',
51 47 'sec-fetch-dest': 'empty',
52 48 'sec-fetch-mode': 'cors',
53 49 'sec-fetch-site': 'same-origin',
54 'user-agent': f'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.{random.randint(99, 999)}.{random.randint(99, 999)} Safari/537.36',
50 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
55 51 }
56 52
57 53 json_data = {
58 'model' : model_info[model]['id'],
59 'messages' : messages,
60 'playgroundId': str(uuid.uuid4()),
61 'chatIndex' : 0,
62 **model_info[model]['default_params'],
63 **kwargs
54 'messages': messages,
55 'id' : f'{os.urandom(3).hex()}a',
64 56 }
65
66 max_retries = kwargs.get('max_retries', 20)
57
58 max_retries = kwargs.get('max_retries', 6)
67 59 for _ in range(max_retries):
68 response = requests.post('https://sdk.vercel.ai/api/generate',
60 response = requests.post('https://chat.vercel.ai/api/chat',
69 61 headers=headers, json=json_data, stream=True, proxies={"https": proxy})
70 62 try:
71 63 response.raise_for_status()
@@ -74,8 +66,7 @@ class Vercel(AbstractProvider):
74 66 for token in response.iter_content(chunk_size=None):
75 67 yield token.decode()
76 68 break
77
78
69
79 70 def get_anti_bot_token() -> str:
80 71 headers = {
81 72 'authority': 'sdk.vercel.ai',
@@ -93,7 +84,7 @@ def get_anti_bot_token() -> str:
93 84 'user-agent': f'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.{random.randint(99, 999)}.{random.randint(99, 999)} Safari/537.36',
94 85 }
95 86
96 response = requests.get('https://sdk.vercel.ai/openai.jpeg',
87 response = requests.get('https://chat.vercel.ai/openai.jpeg',
97 88 headers=headers).text
98 89
99 90 raw_data = json.loads(base64.b64decode(response,
@@ -101,292 +92,10 @@ def get_anti_bot_token() -> str:
101 92
102 93 js_script = '''const globalThis={marker:"mark"};String.prototype.fontcolor=function(){return `<font>${this}</font>`};
103 94 return (%s)(%s)''' % (raw_data['c'], raw_data['a'])
95
96 sec_list = [execjs.compile(js_script).call('')[0], [], "sentinel"]
104 97
105 raw_token = json.dumps({'r': execjs.compile(js_script).call(''), 't': raw_data['t']},
98 raw_token = json.dumps({'r': sec_list, 't': raw_data['t']},
106 99 separators = (",", ":"))
107 100
108 return base64.b64encode(raw_token.encode('utf-16le')).decode()
109
110 class ModelInfo(TypedDict):
111 id: str
112 default_params: dict[str, Any]
113
114 model_info: dict[str, ModelInfo] = {
115 # 'claude-instant-v1': {
116 # 'id': 'anthropic:claude-instant-v1',
117 # 'default_params': {
118 # 'temperature': 1,
119 # 'maximumLength': 1024,
120 # 'topP': 1,
121 # 'topK': 1,
122 # 'presencePenalty': 1,
123 # 'frequencyPenalty': 1,
124 # 'stopSequences': ['\n\nHuman:'],
125 # },
126 # },
127 # 'claude-v1': {
128 # 'id': 'anthropic:claude-v1',
129 # 'default_params': {
130 # 'temperature': 1,
131 # 'maximumLength': 1024,
132 # 'topP': 1,
133 # 'topK': 1,
134 # 'presencePenalty': 1,
135 # 'frequencyPenalty': 1,
136 # 'stopSequences': ['\n\nHuman:'],
137 # },
138 # },
139 # 'claude-v2': {
140 # 'id': 'anthropic:claude-v2',
141 # 'default_params': {
142 # 'temperature': 1,
143 # 'maximumLength': 1024,
144 # 'topP': 1,
145 # 'topK': 1,
146 # 'presencePenalty': 1,
147 # 'frequencyPenalty': 1,
148 # 'stopSequences': ['\n\nHuman:'],
149 # },
150 # },
151 'replicate/llama70b-v2-chat': {
152 'id': 'replicate:replicate/llama-2-70b-chat',
153 'default_params': {
154 'temperature': 0.75,
155 'maximumLength': 3000,
156 'topP': 1,
157 'repetitionPenalty': 1,
158 },
159 },
160 'a16z-infra/llama7b-v2-chat': {
161 'id': 'replicate:a16z-infra/llama7b-v2-chat',
162 'default_params': {
163 'temperature': 0.75,
164 'maximumLength': 3000,
165 'topP': 1,
166 'repetitionPenalty': 1,
167 },
168 },
169 'a16z-infra/llama13b-v2-chat': {
170 'id': 'replicate:a16z-infra/llama13b-v2-chat',
171 'default_params': {
172 'temperature': 0.75,
173 'maximumLength': 3000,
174 'topP': 1,
175 'repetitionPenalty': 1,
176 },
177 },
178 'replicate/llama-2-70b-chat': {
179 'id': 'replicate:replicate/llama-2-70b-chat',
180 'default_params': {
181 'temperature': 0.75,
182 'maximumLength': 3000,
183 'topP': 1,
184 'repetitionPenalty': 1,
185 },
186 },
187 'bigscience/bloom': {
188 'id': 'huggingface:bigscience/bloom',
189 'default_params': {
190 'temperature': 0.5,
191 'maximumLength': 1024,
192 'topP': 0.95,
193 'topK': 4,
194 'repetitionPenalty': 1.03,
195 },
196 },
197 'google/flan-t5-xxl': {
198 'id': 'huggingface:google/flan-t5-xxl',
199 'default_params': {
200 'temperature': 0.5,
201 'maximumLength': 1024,
202 'topP': 0.95,
203 'topK': 4,
204 'repetitionPenalty': 1.03,
205 },
206 },
207 'EleutherAI/gpt-neox-20b': {
208 'id': 'huggingface:EleutherAI/gpt-neox-20b',
209 'default_params': {
210 'temperature': 0.5,
211 'maximumLength': 1024,
212 'topP': 0.95,
213 'topK': 4,
214 'repetitionPenalty': 1.03,
215 'stopSequences': [],
216 },
217 },
218 'OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5': {
219 'id': 'huggingface:OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5',
220 'default_params': {
221 'maximumLength': 1024,
222 'typicalP': 0.2,
223 'repetitionPenalty': 1,
224 },
225 },
226 'OpenAssistant/oasst-sft-1-pythia-12b': {
227 'id': 'huggingface:OpenAssistant/oasst-sft-1-pythia-12b',
228 'default_params': {
229 'maximumLength': 1024,
230 'typicalP': 0.2,
231 'repetitionPenalty': 1,
232 },
233 },
234 'bigcode/santacoder': {
235 'id': 'huggingface:bigcode/santacoder',
236 'default_params': {
237 'temperature': 0.5,
238 'maximumLength': 1024,
239 'topP': 0.95,
240 'topK': 4,
241 'repetitionPenalty': 1.03,
242 },
243 },
244 'command-light-nightly': {
245 'id': 'cohere:command-light-nightly',
246 'default_params': {
247 'temperature': 0.9,
248 'maximumLength': 1024,
249 'topP': 1,
250 'topK': 0,
251 'presencePenalty': 0,
252 'frequencyPenalty': 0,
253 'stopSequences': [],
254 },
255 },
256 'command-nightly': {
257 'id': 'cohere:command-nightly',
258 'default_params': {
259 'temperature': 0.9,
260 'maximumLength': 1024,
261 'topP': 1,
262 'topK': 0,
263 'presencePenalty': 0,
264 'frequencyPenalty': 0,
265 'stopSequences': [],
266 },
267 },
268 # 'gpt-4': {
269 # 'id': 'openai:gpt-4',
270 # 'default_params': {
271 # 'temperature': 0.7,
272 # 'maximumLength': 8192,
273 # 'topP': 1,
274 # 'presencePenalty': 0,
275 # 'frequencyPenalty': 0,
276 # 'stopSequences': [],
277 # },
278 # },
279 # 'gpt-4-0613': {
280 # 'id': 'openai:gpt-4-0613',
281 # 'default_params': {
282 # 'temperature': 0.7,
283 # 'maximumLength': 8192,
284 # 'topP': 1,
285 # 'presencePenalty': 0,
286 # 'frequencyPenalty': 0,
287 # 'stopSequences': [],
288 # },
289 # },
290 'code-davinci-002': {
291 'id': 'openai:code-davinci-002',
292 'default_params': {
293 'temperature': 0.5,
294 'maximumLength': 1024,
295 'topP': 1,
296 'presencePenalty': 0,
297 'frequencyPenalty': 0,
298 'stopSequences': [],
299 },
300 },
301 'gpt-3.5-turbo': {
302 'id': 'openai:gpt-3.5-turbo',
303 'default_params': {
304 'temperature': 0.7,
305 'maximumLength': 4096,
306 'topP': 1,
307 'topK': 1,
308 'presencePenalty': 1,
309 'frequencyPenalty': 1,
310 'stopSequences': [],
311 },
312 },
313 'gpt-3.5-turbo-16k': {
314 'id': 'openai:gpt-3.5-turbo-16k',
315 'default_params': {
316 'temperature': 0.7,
317 'maximumLength': 16280,
318 'topP': 1,
319 'topK': 1,
320 'presencePenalty': 1,
321 'frequencyPenalty': 1,
322 'stopSequences': [],
323 },
324 },
325 'gpt-3.5-turbo-16k-0613': {
326 'id': 'openai:gpt-3.5-turbo-16k-0613',
327 'default_params': {
328 'temperature': 0.7,
329 'maximumLength': 16280,
330 'topP': 1,
331 'topK': 1,
332 'presencePenalty': 1,
333 'frequencyPenalty': 1,
334 'stopSequences': [],
335 },
336 },
337 'text-ada-001': {
338 'id': 'openai:text-ada-001',
339 'default_params': {
340 'temperature': 0.5,
341 'maximumLength': 1024,
342 'topP': 1,
343 'presencePenalty': 0,
344 'frequencyPenalty': 0,
345 'stopSequences': [],
346 },
347 },
348 'text-babbage-001': {
349 'id': 'openai:text-babbage-001',
350 'default_params': {
351 'temperature': 0.5,
352 'maximumLength': 1024,
353 'topP': 1,
354 'presencePenalty': 0,
355 'frequencyPenalty': 0,
356 'stopSequences': [],
357 },
358 },
359 'text-curie-001': {
360 'id': 'openai:text-curie-001',
361 'default_params': {
362 'temperature': 0.5,
363 'maximumLength': 1024,
364 'topP': 1,
365 'presencePenalty': 0,
366 'frequencyPenalty': 0,
367 'stopSequences': [],
368 },
369 },
370 'text-davinci-002': {
371 'id': 'openai:text-davinci-002',
372 'default_params': {
373 'temperature': 0.5,
374 'maximumLength': 1024,
375 'topP': 1,
376 'presencePenalty': 0,
377 'frequencyPenalty': 0,
378 'stopSequences': [],
379 },
380 },
381 'text-davinci-003': {
382 'id': 'openai:text-davinci-003',
383 'default_params': {
384 'temperature': 0.5,
385 'maximumLength': 4097,
386 'topP': 1,
387 'presencePenalty': 0,
388 'frequencyPenalty': 0,
389 'stopSequences': [],
390 },
391 },
392 }
101 return base64.b64encode(raw_token.encode('utf-8')).decode()
Added g4f/Provider/deprecated/Vercel.py +392 -0
@@ -0,0 +1,392 @@
1 from __future__ import annotations
2
3 import json, base64, requests, random, uuid
4
5 try:
6 import execjs
7 has_requirements = True
8 except ImportError:
9 has_requirements = False
10
11 from ...typing import Messages, TypedDict, CreateResult, Any
12 from ..base_provider import AbstractProvider
13 from ...errors import MissingRequirementsError
14
15 class Vercel(AbstractProvider):
16 url = 'https://sdk.vercel.ai'
17 working = False
18 supports_message_history = True
19 supports_gpt_35_turbo = True
20 supports_stream = True
21
22 @staticmethod
23 def create_completion(
24 model: str,
25 messages: Messages,
26 stream: bool,
27 proxy: str = None,
28 **kwargs
29 ) -> CreateResult:
30 if not has_requirements:
31 raise MissingRequirementsError('Install "PyExecJS" package')
32
33 if not model:
34 model = "gpt-3.5-turbo"
35 elif model not in model_info:
36 raise ValueError(f"Vercel does not support {model}")
37
38 headers = {
39 'authority': 'sdk.vercel.ai',
40 'accept': '*/*',
41 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
42 'cache-control': 'no-cache',
43 'content-type': 'application/json',
44 'custom-encoding': get_anti_bot_token(),
45 'origin': 'https://sdk.vercel.ai',
46 'pragma': 'no-cache',
47 'referer': 'https://sdk.vercel.ai/',
48 'sec-ch-ua': '"Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"',
49 'sec-ch-ua-mobile': '?0',
50 'sec-ch-ua-platform': '"macOS"',
51 'sec-fetch-dest': 'empty',
52 'sec-fetch-mode': 'cors',
53 'sec-fetch-site': 'same-origin',
54 'user-agent': f'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.{random.randint(99, 999)}.{random.randint(99, 999)} Safari/537.36',
55 }
56
57 json_data = {
58 'model' : model_info[model]['id'],
59 'messages' : messages,
60 'playgroundId': str(uuid.uuid4()),
61 'chatIndex' : 0,
62 **model_info[model]['default_params'],
63 **kwargs
64 }
65
66 max_retries = kwargs.get('max_retries', 20)
67 for _ in range(max_retries):
68 response = requests.post('https://chat.vercel.ai/api/chat',
69 headers=headers, json=json_data, stream=True, proxies={"https": proxy})
70 try:
71 response.raise_for_status()
72 except:
73 continue
74 for token in response.iter_content(chunk_size=None):
75 yield token.decode()
76 break
77
78
79 def get_anti_bot_token() -> str:
80 headers = {
81 'authority': 'sdk.vercel.ai',
82 'accept': '*/*',
83 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
84 'cache-control': 'no-cache',
85 'pragma': 'no-cache',
86 'referer': 'https://sdk.vercel.ai/',
87 'sec-ch-ua': '"Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"',
88 'sec-ch-ua-mobile': '?0',
89 'sec-ch-ua-platform': '"macOS"',
90 'sec-fetch-dest': 'empty',
91 'sec-fetch-mode': 'cors',
92 'sec-fetch-site': 'same-origin',
93 'user-agent': f'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.{random.randint(99, 999)}.{random.randint(99, 999)} Safari/537.36',
94 }
95
96 response = requests.get('https://sdk.vercel.ai/openai.jpeg',
97 headers=headers).text
98
99 raw_data = json.loads(base64.b64decode(response,
100 validate=True))
101
102 js_script = '''const globalThis={marker:"mark"};String.prototype.fontcolor=function(){return `<font>${this}</font>`};
103 return (%s)(%s)''' % (raw_data['c'], raw_data['a'])
104
105 raw_token = json.dumps({'r': execjs.compile(js_script).call(''), 't': raw_data['t']},
106 separators = (",", ":"))
107
108 return base64.b64encode(raw_token.encode('utf-16le')).decode()
109
110 class ModelInfo(TypedDict):
111 id: str
112 default_params: dict[str, Any]
113
114 model_info: dict[str, ModelInfo] = {
115 # 'claude-instant-v1': {
116 # 'id': 'anthropic:claude-instant-v1',
117 # 'default_params': {
118 # 'temperature': 1,
119 # 'maximumLength': 1024,
120 # 'topP': 1,
121 # 'topK': 1,
122 # 'presencePenalty': 1,
123 # 'frequencyPenalty': 1,
124 # 'stopSequences': ['\n\nHuman:'],
125 # },
126 # },
127 # 'claude-v1': {
128 # 'id': 'anthropic:claude-v1',
129 # 'default_params': {
130 # 'temperature': 1,
131 # 'maximumLength': 1024,
132 # 'topP': 1,
133 # 'topK': 1,
134 # 'presencePenalty': 1,
135 # 'frequencyPenalty': 1,
136 # 'stopSequences': ['\n\nHuman:'],
137 # },
138 # },
139 # 'claude-v2': {
140 # 'id': 'anthropic:claude-v2',
141 # 'default_params': {
142 # 'temperature': 1,
143 # 'maximumLength': 1024,
144 # 'topP': 1,
145 # 'topK': 1,
146 # 'presencePenalty': 1,
147 # 'frequencyPenalty': 1,
148 # 'stopSequences': ['\n\nHuman:'],
149 # },
150 # },
151 'replicate/llama70b-v2-chat': {
152 'id': 'replicate:replicate/llama-2-70b-chat',
153 'default_params': {
154 'temperature': 0.75,
155 'maximumLength': 3000,
156 'topP': 1,
157 'repetitionPenalty': 1,
158 },
159 },
160 'a16z-infra/llama7b-v2-chat': {
161 'id': 'replicate:a16z-infra/llama7b-v2-chat',
162 'default_params': {
163 'temperature': 0.75,
164 'maximumLength': 3000,
165 'topP': 1,
166 'repetitionPenalty': 1,
167 },
168 },
169 'a16z-infra/llama13b-v2-chat': {
170 'id': 'replicate:a16z-infra/llama13b-v2-chat',
171 'default_params': {
172 'temperature': 0.75,
173 'maximumLength': 3000,
174 'topP': 1,
175 'repetitionPenalty': 1,
176 },
177 },
178 'replicate/llama-2-70b-chat': {
179 'id': 'replicate:replicate/llama-2-70b-chat',
180 'default_params': {
181 'temperature': 0.75,
182 'maximumLength': 3000,
183 'topP': 1,
184 'repetitionPenalty': 1,
185 },
186 },
187 'bigscience/bloom': {
188 'id': 'huggingface:bigscience/bloom',
189 'default_params': {
190 'temperature': 0.5,
191 'maximumLength': 1024,
192 'topP': 0.95,
193 'topK': 4,
194 'repetitionPenalty': 1.03,
195 },
196 },
197 'google/flan-t5-xxl': {
198 'id': 'huggingface:google/flan-t5-xxl',
199 'default_params': {
200 'temperature': 0.5,
201 'maximumLength': 1024,
202 'topP': 0.95,
203 'topK': 4,
204 'repetitionPenalty': 1.03,
205 },
206 },
207 'EleutherAI/gpt-neox-20b': {
208 'id': 'huggingface:EleutherAI/gpt-neox-20b',
209 'default_params': {
210 'temperature': 0.5,
211 'maximumLength': 1024,
212 'topP': 0.95,
213 'topK': 4,
214 'repetitionPenalty': 1.03,
215 'stopSequences': [],
216 },
217 },
218 'OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5': {
219 'id': 'huggingface:OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5',
220 'default_params': {
221 'maximumLength': 1024,
222 'typicalP': 0.2,
223 'repetitionPenalty': 1,
224 },
225 },
226 'OpenAssistant/oasst-sft-1-pythia-12b': {
227 'id': 'huggingface:OpenAssistant/oasst-sft-1-pythia-12b',
228 'default_params': {
229 'maximumLength': 1024,
230 'typicalP': 0.2,
231 'repetitionPenalty': 1,
232 },
233 },
234 'bigcode/santacoder': {
235 'id': 'huggingface:bigcode/santacoder',
236 'default_params': {
237 'temperature': 0.5,
238 'maximumLength': 1024,
239 'topP': 0.95,
240 'topK': 4,
241 'repetitionPenalty': 1.03,
242 },
243 },
244 'command-light-nightly': {
245 'id': 'cohere:command-light-nightly',
246 'default_params': {
247 'temperature': 0.9,
248 'maximumLength': 1024,
249 'topP': 1,
250 'topK': 0,
251 'presencePenalty': 0,
252 'frequencyPenalty': 0,
253 'stopSequences': [],
254 },
255 },
256 'command-nightly': {
257 'id': 'cohere:command-nightly',
258 'default_params': {
259 'temperature': 0.9,
260 'maximumLength': 1024,
261 'topP': 1,
262 'topK': 0,
263 'presencePenalty': 0,
264 'frequencyPenalty': 0,
265 'stopSequences': [],
266 },
267 },
268 # 'gpt-4': {
269 # 'id': 'openai:gpt-4',
270 # 'default_params': {
271 # 'temperature': 0.7,
272 # 'maximumLength': 8192,
273 # 'topP': 1,
274 # 'presencePenalty': 0,
275 # 'frequencyPenalty': 0,
276 # 'stopSequences': [],
277 # },
278 # },
279 # 'gpt-4-0613': {
280 # 'id': 'openai:gpt-4-0613',
281 # 'default_params': {
282 # 'temperature': 0.7,
283 # 'maximumLength': 8192,
284 # 'topP': 1,
285 # 'presencePenalty': 0,
286 # 'frequencyPenalty': 0,
287 # 'stopSequences': [],
288 # },
289 # },
290 'code-davinci-002': {
291 'id': 'openai:code-davinci-002',
292 'default_params': {
293 'temperature': 0.5,
294 'maximumLength': 1024,
295 'topP': 1,
296 'presencePenalty': 0,
297 'frequencyPenalty': 0,
298 'stopSequences': [],
299 },
300 },
301 'gpt-3.5-turbo': {
302 'id': 'openai:gpt-3.5-turbo',
303 'default_params': {
304 'temperature': 0.7,
305 'maximumLength': 4096,
306 'topP': 1,
307 'topK': 1,
308 'presencePenalty': 1,
309 'frequencyPenalty': 1,
310 'stopSequences': [],
311 },
312 },
313 'gpt-3.5-turbo-16k': {
314 'id': 'openai:gpt-3.5-turbo-16k',
315 'default_params': {
316 'temperature': 0.7,
317 'maximumLength': 16280,
318 'topP': 1,
319 'topK': 1,
320 'presencePenalty': 1,
321 'frequencyPenalty': 1,
322 'stopSequences': [],
323 },
324 },
325 'gpt-3.5-turbo-16k-0613': {
326 'id': 'openai:gpt-3.5-turbo-16k-0613',
327 'default_params': {
328 'temperature': 0.7,
329 'maximumLength': 16280,
330 'topP': 1,
331 'topK': 1,
332 'presencePenalty': 1,
333 'frequencyPenalty': 1,
334 'stopSequences': [],
335 },
336 },
337 'text-ada-001': {
338 'id': 'openai:text-ada-001',
339 'default_params': {
340 'temperature': 0.5,
341 'maximumLength': 1024,
342 'topP': 1,
343 'presencePenalty': 0,
344 'frequencyPenalty': 0,
345 'stopSequences': [],
346 },
347 },
348 'text-babbage-001': {
349 'id': 'openai:text-babbage-001',
350 'default_params': {
351 'temperature': 0.5,
352 'maximumLength': 1024,
353 'topP': 1,
354 'presencePenalty': 0,
355 'frequencyPenalty': 0,
356 'stopSequences': [],
357 },
358 },
359 'text-curie-001': {
360 'id': 'openai:text-curie-001',
361 'default_params': {
362 'temperature': 0.5,
363 'maximumLength': 1024,
364 'topP': 1,
365 'presencePenalty': 0,
366 'frequencyPenalty': 0,
367 'stopSequences': [],
368 },
369 },
370 'text-davinci-002': {
371 'id': 'openai:text-davinci-002',
372 'default_params': {
373 'temperature': 0.5,
374 'maximumLength': 1024,
375 'topP': 1,
376 'presencePenalty': 0,
377 'frequencyPenalty': 0,
378 'stopSequences': [],
379 },
380 },
381 'text-davinci-003': {
382 'id': 'openai:text-davinci-003',
383 'default_params': {
384 'temperature': 0.5,
385 'maximumLength': 4097,
386 'topP': 1,
387 'presencePenalty': 0,
388 'frequencyPenalty': 0,
389 'stopSequences': [],
390 },
391 },
392 }