ohlcv-ai 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,475 @@
1
+ export enum AliYunModelType {
2
+ QWEN_TURBO = 'qwen-turbo',
3
+ QWEN_PLUS = 'qwen-plus',
4
+ QWEN_MAX = 'qwen-max',
5
+ QWEN_MAX_LONGCONTEXT = 'qwen-max-longcontext',
6
+ QWEN_2_5B = 'qwen2.5-0.5b',
7
+ QWEN_2_5B_INSTRUCT = 'qwen2.5-0.5b-instruct',
8
+ QWEN_2_5B_7B = 'qwen2.5-7b',
9
+ QWEN_2_5B_7B_INSTRUCT = 'qwen2.5-7b-instruct',
10
+ QWEN_2_5B_14B = 'qwen2.5-14b',
11
+ QWEN_2_5B_14B_INSTRUCT = 'qwen2.5-14b-instruct',
12
+ QWEN_2_5B_32B = 'qwen2.5-32b',
13
+ QWEN_2_5B_32B_INSTRUCT = 'qwen2.5-32b-instruct',
14
+ QWEN_2_5B_72B = 'qwen2.5-72b',
15
+ QWEN_2_5B_72B_INSTRUCT = 'qwen2.5-72b-instruct',
16
+ QWEN_2_5B_CODER = 'qwen2.5-coder',
17
+ QWEN_2_5B_CODER_7B = 'qwen2.5-coder-7b',
18
+ QWEN_2_5B_CODER_14B = 'qwen2.5-coder-14b',
19
+ QWEN_2_5B_CODER_32B = 'qwen2.5-coder-32b',
20
+ QWEN_VL_LITE = 'qwen-vl-lite',
21
+ QWEN_VL_PLUS = 'qwen-vl-plus',
22
+ QWEN_VL_MAX = 'qwen-vl-max',
23
+ QWEN_AUDIO_TURBO = 'qwen-audio-turbo',
24
+ QWEN_AUDIO_CHAT = 'qwen-audio-chat',
25
+ QWEN_MATH_7B = 'qwen-math-7b',
26
+ LLAMA2_7B_CHAT_V2 = 'llama2-7b-chat-v2',
27
+ BAICHUAN2_7B_CHAT_V1 = 'baichuan2-7b-chat-v1',
28
+ QWEN_FINANCIAL = 'qwen-financial',
29
+ QWEN_FINANCIAL_14B = 'qwen-financial-14b',
30
+ QWEN_FINANCIAL_32B = 'qwen-financial-32b',
31
+ QWEN_MEDICAL = 'qwen-medical',
32
+ QWEN_MEDICAL_14B = 'qwen-medical-14b',
33
+ QWEN_MEDICAL_32B = 'qwen-medical-32b',
34
+ QWEN_OMNI = 'qwen-omni',
35
+ QWEN_OMNI_PRO = 'qwen-omni-pro'
36
+ }
37
+
38
+ export interface Model {
39
+ name: string;
40
+ displayName: string;
41
+ endpoint: string;
42
+ endpoints?: string[];
43
+ format: 'openai' | 'dashscope';
44
+ description?: string;
45
+ maxTokens?: number;
46
+ contextLength?: number;
47
+ capabilities?: string[];
48
+ }
49
+
50
+ export const ALIYUN_MODELS: Map<AliYunModelType, Model> = new Map([
51
+ [
52
+ AliYunModelType.QWEN_TURBO,
53
+ {
54
+ name: AliYunModelType.QWEN_TURBO,
55
+ displayName: 'Qwen-Turbo',
56
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
57
+ endpoints: [
58
+ 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
59
+ 'https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation'
60
+ ],
61
+ format: 'openai',
62
+ description: 'Lightweight version, fast response speed, suitable for general conversation scenarios',
63
+ maxTokens: 2000,
64
+ contextLength: 8000,
65
+ capabilities: ['text-generation', 'chat']
66
+ }
67
+ ],
68
+ [
69
+ AliYunModelType.QWEN_PLUS,
70
+ {
71
+ name: AliYunModelType.QWEN_PLUS,
72
+ displayName: 'Qwen-Plus',
73
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
74
+ endpoints: [
75
+ 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions'
76
+ ],
77
+ format: 'openai',
78
+ description: 'Enhanced version, suitable for complex tasks and long text processing',
79
+ maxTokens: 6000,
80
+ contextLength: 32000,
81
+ capabilities: ['text-generation', 'chat', 'reasoning']
82
+ }
83
+ ],
84
+ [
85
+ AliYunModelType.QWEN_MAX,
86
+ {
87
+ name: AliYunModelType.QWEN_MAX,
88
+ displayName: 'Qwen-Max',
89
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
90
+ endpoints: [
91
+ 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions'
92
+ ],
93
+ format: 'openai',
94
+ description: 'Maximum version, strongest capabilities, suitable for high-demand professional tasks',
95
+ maxTokens: 8000,
96
+ contextLength: 32000,
97
+ capabilities: ['text-generation', 'chat', 'reasoning', 'coding', 'analysis']
98
+ }
99
+ ],
100
+ [
101
+ AliYunModelType.QWEN_MAX_LONGCONTEXT,
102
+ {
103
+ name: AliYunModelType.QWEN_MAX_LONGCONTEXT,
104
+ displayName: 'Qwen-Max-LongContext',
105
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
106
+ endpoints: [
107
+ 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions'
108
+ ],
109
+ format: 'openai',
110
+ description: 'Supports 128K long context, suitable for long document processing',
111
+ maxTokens: 8000,
112
+ contextLength: 128000,
113
+ capabilities: ['text-generation', 'chat', 'document-analysis']
114
+ }
115
+ ],
116
+ // Qwen2.5 series models
117
+ [
118
+ AliYunModelType.QWEN_2_5B,
119
+ {
120
+ name: AliYunModelType.QWEN_2_5B,
121
+ displayName: 'Qwen2.5-0.5B',
122
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
123
+ format: 'openai',
124
+ description: 'Ultra-lightweight 0.5B parameter model for edge devices',
125
+ maxTokens: 4000,
126
+ contextLength: 32000,
127
+ capabilities: ['text-generation', 'chat']
128
+ }
129
+ ],
130
+ [
131
+ AliYunModelType.QWEN_2_5B_INSTRUCT,
132
+ {
133
+ name: AliYunModelType.QWEN_2_5B_INSTRUCT,
134
+ displayName: 'Qwen2.5-0.5B-Instruct',
135
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
136
+ format: 'openai',
137
+ description: 'Instruction-tuned 0.5B model for specific tasks',
138
+ maxTokens: 4000,
139
+ contextLength: 32000,
140
+ capabilities: ['instruction-following', 'chat']
141
+ }
142
+ ],
143
+ [
144
+ AliYunModelType.QWEN_2_5B_7B,
145
+ {
146
+ name: AliYunModelType.QWEN_2_5B_7B,
147
+ displayName: 'Qwen2.5-7B',
148
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
149
+ format: 'openai',
150
+ description: '7B parameter base model, balanced performance and efficiency',
151
+ maxTokens: 6000,
152
+ contextLength: 32000,
153
+ capabilities: ['text-generation', 'reasoning']
154
+ }
155
+ ],
156
+ [
157
+ AliYunModelType.QWEN_2_5B_7B_INSTRUCT,
158
+ {
159
+ name: AliYunModelType.QWEN_2_5B_7B_INSTRUCT,
160
+ displayName: 'Qwen2.5-7B-Instruct',
161
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
162
+ format: 'openai',
163
+ description: 'Instruction-tuned 7B model for chat and tasks',
164
+ maxTokens: 6000,
165
+ contextLength: 32000,
166
+ capabilities: ['chat', 'instruction-following', 'coding']
167
+ }
168
+ ],
169
+ [
170
+ AliYunModelType.QWEN_2_5B_14B,
171
+ {
172
+ name: AliYunModelType.QWEN_2_5B_14B,
173
+ displayName: 'Qwen2.5-14B',
174
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
175
+ format: 'openai',
176
+ description: '14B parameter model with enhanced capabilities',
177
+ maxTokens: 8000,
178
+ contextLength: 32000,
179
+ capabilities: ['text-generation', 'analysis', 'reasoning']
180
+ }
181
+ ],
182
+ [
183
+ AliYunModelType.QWEN_2_5B_32B,
184
+ {
185
+ name: AliYunModelType.QWEN_2_5B_32B,
186
+ displayName: 'Qwen2.5-32B',
187
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
188
+ format: 'openai',
189
+ description: '32B parameter high-performance model',
190
+ maxTokens: 8000,
191
+ contextLength: 32000,
192
+ capabilities: ['text-generation', 'complex-reasoning', 'analysis']
193
+ }
194
+ ],
195
+ [
196
+ AliYunModelType.QWEN_2_5B_72B,
197
+ {
198
+ name: AliYunModelType.QWEN_2_5B_72B,
199
+ displayName: 'Qwen2.5-72B',
200
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
201
+ format: 'openai',
202
+ description: '72B parameter state-of-the-art model',
203
+ maxTokens: 8000,
204
+ contextLength: 32000,
205
+ capabilities: ['text-generation', 'expert-analysis', 'research']
206
+ }
207
+ ],
208
+ // Qwen2.5 Coder series
209
+ [
210
+ AliYunModelType.QWEN_2_5B_CODER,
211
+ {
212
+ name: AliYunModelType.QWEN_2_5B_CODER,
213
+ displayName: 'Qwen2.5-Coder',
214
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
215
+ format: 'openai',
216
+ description: 'Specialized code generation model',
217
+ maxTokens: 8000,
218
+ contextLength: 32000,
219
+ capabilities: ['code-generation', 'code-explanation', 'debugging']
220
+ }
221
+ ],
222
+ [
223
+ AliYunModelType.QWEN_2_5B_CODER_7B,
224
+ {
225
+ name: AliYunModelType.QWEN_2_5B_CODER_7B,
226
+ displayName: 'Qwen2.5-Coder-7B',
227
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
228
+ format: 'openai',
229
+ description: '7B parameter code generation model',
230
+ maxTokens: 8000,
231
+ contextLength: 32000,
232
+ capabilities: ['code-generation', 'programming']
233
+ }
234
+ ],
235
+ [
236
+ AliYunModelType.QWEN_2_5B_CODER_14B,
237
+ {
238
+ name: AliYunModelType.QWEN_2_5B_CODER_14B,
239
+ displayName: 'Qwen2.5-Coder-14B',
240
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
241
+ format: 'openai',
242
+ description: '14B parameter advanced code generation model',
243
+ maxTokens: 8000,
244
+ contextLength: 32000,
245
+ capabilities: ['code-generation', 'code-review', 'optimization']
246
+ }
247
+ ],
248
+ // Vision-Language models
249
+ [
250
+ AliYunModelType.QWEN_VL_LITE,
251
+ {
252
+ name: AliYunModelType.QWEN_VL_LITE,
253
+ displayName: 'Qwen-VL-Lite',
254
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
255
+ format: 'openai',
256
+ description: 'Lightweight vision-language model for basic image understanding',
257
+ maxTokens: 2000,
258
+ contextLength: 8000,
259
+ capabilities: ['image-understanding', 'visual-qa']
260
+ }
261
+ ],
262
+ [
263
+ AliYunModelType.QWEN_VL_PLUS,
264
+ {
265
+ name: AliYunModelType.QWEN_VL_PLUS,
266
+ displayName: 'Qwen-VL-Plus',
267
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
268
+ format: 'openai',
269
+ description: 'Vision-language model supporting image understanding',
270
+ maxTokens: 4000,
271
+ contextLength: 32000,
272
+ capabilities: ['image-understanding', 'document-analysis', 'visual-reasoning']
273
+ }
274
+ ],
275
+ [
276
+ AliYunModelType.QWEN_VL_MAX,
277
+ {
278
+ name: AliYunModelType.QWEN_VL_MAX,
279
+ displayName: 'Qwen-VL-Max',
280
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
281
+ format: 'openai',
282
+ description: 'Most powerful vision-language model',
283
+ maxTokens: 8000,
284
+ contextLength: 32000,
285
+ capabilities: ['image-understanding', 'video-analysis', 'multimodal-reasoning']
286
+ }
287
+ ],
288
+ // Audio models
289
+ [
290
+ AliYunModelType.QWEN_AUDIO_TURBO,
291
+ {
292
+ name: AliYunModelType.QWEN_AUDIO_TURBO,
293
+ displayName: 'Qwen-Audio-Turbo',
294
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
295
+ format: 'openai',
296
+ description: 'Fast audio processing and speech-to-text model',
297
+ maxTokens: 2000,
298
+ contextLength: 8000,
299
+ capabilities: ['speech-recognition', 'audio-analysis']
300
+ }
301
+ ],
302
+ [
303
+ AliYunModelType.QWEN_AUDIO_CHAT,
304
+ {
305
+ name: AliYunModelType.QWEN_AUDIO_CHAT,
306
+ displayName: 'Qwen-Audio-Chat',
307
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
308
+ format: 'openai',
309
+ description: 'Audio conversation and processing model',
310
+ maxTokens: 4000,
311
+ contextLength: 32000,
312
+ capabilities: ['audio-chat', 'voice-assistant', 'speech-synthesis']
313
+ }
314
+ ],
315
+ // Specialized models
316
+ [
317
+ AliYunModelType.QWEN_MATH_7B,
318
+ {
319
+ name: AliYunModelType.QWEN_MATH_7B,
320
+ displayName: 'Qwen-Math-7B',
321
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
322
+ format: 'openai',
323
+ description: 'Specialized for mathematical reasoning and problem solving',
324
+ maxTokens: 4000,
325
+ contextLength: 32000,
326
+ capabilities: ['mathematical-reasoning', 'problem-solving']
327
+ }
328
+ ],
329
+ [
330
+ AliYunModelType.LLAMA2_7B_CHAT_V2,
331
+ {
332
+ name: AliYunModelType.LLAMA2_7B_CHAT_V2,
333
+ displayName: 'LLaMA2-7B-Chat',
334
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
335
+ format: 'openai',
336
+ description: 'Meta\'s LLaMA2-7B model',
337
+ maxTokens: 2000,
338
+ contextLength: 8000,
339
+ capabilities: ['chat', 'text-generation']
340
+ }
341
+ ],
342
+ [
343
+ AliYunModelType.BAICHUAN2_7B_CHAT_V1,
344
+ {
345
+ name: AliYunModelType.BAICHUAN2_7B_CHAT_V1,
346
+ displayName: 'Baichuan2-7B-Chat',
347
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
348
+ format: 'openai',
349
+ description: 'Baichuan AI\'s Baichuan2-7B model',
350
+ maxTokens: 2000,
351
+ contextLength: 8000,
352
+ capabilities: ['chat', 'chinese-nlp']
353
+ }
354
+ ],
355
+ [
356
+ AliYunModelType.QWEN_FINANCIAL,
357
+ {
358
+ name: AliYunModelType.QWEN_FINANCIAL,
359
+ displayName: 'Qwen-Financial',
360
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
361
+ format: 'openai',
362
+ description: 'Specialized for financial analysis and market insights',
363
+ maxTokens: 6000,
364
+ contextLength: 32000,
365
+ capabilities: ['financial-analysis', 'market-prediction', 'risk-assessment']
366
+ }
367
+ ],
368
+ [
369
+ AliYunModelType.QWEN_MEDICAL,
370
+ {
371
+ name: AliYunModelType.QWEN_MEDICAL,
372
+ displayName: 'Qwen-Medical',
373
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
374
+ format: 'openai',
375
+ description: 'Specialized for medical consultation and health analysis',
376
+ maxTokens: 6000,
377
+ contextLength: 32000,
378
+ capabilities: ['medical-consultation', 'health-analysis', 'diagnostic-support']
379
+ }
380
+ ],
381
+ // Omni models (multimodal)
382
+ [
383
+ AliYunModelType.QWEN_OMNI,
384
+ {
385
+ name: AliYunModelType.QWEN_OMNI,
386
+ displayName: 'Qwen-Omni',
387
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
388
+ format: 'openai',
389
+ description: 'Omnidirectional multimodal model supporting text, image, audio',
390
+ maxTokens: 8000,
391
+ contextLength: 64000,
392
+ capabilities: ['text-generation', 'image-understanding', 'audio-processing', 'multimodal']
393
+ }
394
+ ],
395
+ [
396
+ AliYunModelType.QWEN_OMNI_PRO,
397
+ {
398
+ name: AliYunModelType.QWEN_OMNI_PRO,
399
+ displayName: 'Qwen-Omni-Pro',
400
+ endpoint: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
401
+ format: 'openai',
402
+ description: 'Professional omnidirectional multimodal model with advanced capabilities',
403
+ maxTokens: 16000,
404
+ contextLength: 128000,
405
+ capabilities: ['text-generation', 'multimodal', 'complex-reasoning', 'expert-analysis']
406
+ }
407
+ ]
408
+ ]);
409
+
410
+ export function getModel(type: AliYunModelType): Model | undefined {
411
+ return ALIYUN_MODELS.get(type);
412
+ }
413
+
414
+ export function getAllModels(): Model[] {
415
+ return Array.from(ALIYUN_MODELS.values());
416
+ }
417
+
418
+ export function getModelByName(name: string): Model | undefined {
419
+ for (const model of ALIYUN_MODELS.values()) {
420
+ if (model.name === name) {
421
+ return model;
422
+ }
423
+ }
424
+ return undefined;
425
+ }
426
+
427
+ export function getAvailableAliYunModelTypes(): AliYunModelType[] {
428
+ return Array.from(ALIYUN_MODELS.keys());
429
+ }
430
+
431
+ // Helper functions for specific model categories
432
+ export function getTextModels(): Model[] {
433
+ return getAllModels().filter(model =>
434
+ model.capabilities?.includes('text-generation') &&
435
+ !model.capabilities?.includes('image-understanding') &&
436
+ !model.capabilities?.includes('audio-processing')
437
+ );
438
+ }
439
+
440
+ export function getVisionModels(): Model[] {
441
+ return getAllModels().filter(model =>
442
+ model.capabilities?.includes('image-understanding')
443
+ );
444
+ }
445
+
446
+ export function getAudioModels(): Model[] {
447
+ return getAllModels().filter(model =>
448
+ model.capabilities?.includes('audio-processing') ||
449
+ model.capabilities?.includes('speech-recognition')
450
+ );
451
+ }
452
+
453
+ export function getCodingModels(): Model[] {
454
+ return getAllModels().filter(model =>
455
+ model.capabilities?.includes('code-generation') ||
456
+ model.capabilities?.includes('programming')
457
+ );
458
+ }
459
+
460
+ export function getSpecializedModels(): Model[] {
461
+ const specializedCapabilities = [
462
+ 'financial-analysis',
463
+ 'medical-consultation',
464
+ 'mathematical-reasoning'
465
+ ];
466
+ return getAllModels().filter(model =>
467
+ model.capabilities?.some(cap => specializedCapabilities.includes(cap))
468
+ );
469
+ }
470
+
471
+ export function getMultimodalModels(): Model[] {
472
+ return getAllModels().filter(model =>
473
+ model.capabilities?.includes('multimodal')
474
+ );
475
+ }