utilitas 1999.1.50 → 1999.1.52

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.
package/lib/alan.mjs CHANGED
@@ -26,6 +26,7 @@ Here are some guidelines designed for specific types of problems, to be followed
26
26
  General inquiries, writing, translation, and common knowledge Q&A:
27
27
  - Uses a friendly, concise, and easy-to-understand tone to provides accurate and comprehensive answers.
28
28
  - Avoid overusing the \`;\`' symbol, as it is a common mistake made by AI.
29
+ - Unless requested, please use simple Markdown formatting, avoid complex nested formats that may reduce readability.
29
30
  - Unless the user specifies a language, respond according to the language of the question, If the language is uncertain, use English as the default.
30
31
 
31
32
  Issues related to computers, programming, code, mathematics, science and engineering:
@@ -55,36 +56,34 @@ const [
55
56
  ];
56
57
 
57
58
  const [
58
- OPENAI, GEMINI, OPENAI_TRAINING, OLLAMA, GPT_4O, GPT_O1, GPT_O3_MINI,
59
- GEMINI_20_FLASH, NOVA, DEEPSEEK_R1, MD_CODE, TEXT_EMBEDDING_3_SMALL,
60
- TEXT_EMBEDDING_3_LARGE, CLOUD_37_SONNET, AUDIO, WAV, ATTACHMENTS, CHAT,
61
- OPENAI_VOICE, MEDIUM, LOW, HIGH, GPT_REASONING_EFFORT, THINK, THINK_STR,
62
- THINK_END, AZURE, TOOLS_STR, TOOLS_END, TOOLS, TEXT, THINKING, OK, FUNC,
63
- GPT_45, REDACTED_THINKING, GEMMA_3_27B, AZURE_OPENAI, ANTHROPIC,
64
- VERTEX_ANTHROPIC, GEMMA327B, v8k, ais, MAX_TOOL_RECURSION, LOG, name, user,
65
- system, assistant, MODEL, JSON_OBJECT, TOOL, silent, GEMINI_EMBEDDING_M,
66
- INVALID_FILE, tokenSafeRatio, GPT_QUERY_LIMIT, CONTENT_IS_REQUIRED,
67
- OPENAI_HI_RES_SIZE, k, kT, m, minute, hour, gb, trimTailing, EBD,
68
- GEMINI_20_FLASH_EXP, IMAGE, JINA, JINA_DEEPSEARCH, JINA_CLIP, VERTEX,
69
- GEMINI_25_PRO, SILICONFLOW, SF_DEEPSEEK_V3,
59
+ OPENAI, GEMINI, OPENAI_TRAINING, OLLAMA, GPT_4O, GPT_O3, GEMINI_25_FLASH,
60
+ NOVA, DEEPSEEK_R1, MD_CODE, TEXT_EMBEDDING_3_SMALL, TEXT_EMBEDDING_3_LARGE,
61
+ CLOUD_37_SONNET, AUDIO, WAV, ATTACHMENTS, CHAT, OPENAI_VOICE, MEDIUM, LOW,
62
+ HIGH, GPT_REASONING_EFFORT, THINK, THINK_STR, THINK_END, AZURE, TOOLS_STR,
63
+ TOOLS_END, TOOLS, TEXT, THINKING, OK, FUNC, GPT_41, REDACTED_THINKING,
64
+ GEMMA_3_27B, AZURE_OPENAI, ANTHROPIC, VERTEX_ANTHROPIC, v8k, ais,
65
+ MAX_TOOL_RECURSION, LOG, name, user, system, assistant, MODEL, JSON_OBJECT,
66
+ TOOL, silent, GEMINI_EMBEDDING_M, INVALID_FILE, tokenSafeRatio,
67
+ GPT_QUERY_LIMIT, CONTENT_IS_REQUIRED, OPENAI_HI_RES_SIZE, k, kT, m, minute,
68
+ hour, gb, trimTailing, EBD, GEMINI_20_FLASH, IMAGE, JINA, JINA_DEEPSEARCH,
69
+ JINA_CLIP, VERTEX, GEMINI_25_PRO, SILICONFLOW, SF_DEEPSEEK_V3,
70
70
  ] = [
71
- 'OpenAI', 'Gemini', 'OPENAI_TRAINING', 'Ollama', 'gpt-4o', 'o1',
72
- 'o3-mini', 'gemini-2.0-flash', 'nova', 'deepseek-r1', '```',
73
- 'text-embedding-3-small', 'text-embedding-3-large',
71
+ 'OpenAI', 'Gemini', 'OPENAI_TRAINING', 'Ollama', 'gpt-4o', 'o3',
72
+ 'gemini-2.5-flash-preview-04-17', 'nova', 'deepseek-r1',
73
+ '```', 'text-embedding-3-small', 'text-embedding-3-large',
74
74
  'claude-3-7-sonnet@20250219', 'audio', 'wav', '[ATTACHMENTS]', 'CHAT',
75
75
  'OPENAI_VOICE', 'medium', 'low', 'high', 'medium', 'think', '<think>',
76
76
  '</think>', 'AZURE', '<tools>', '</tools>', 'tools', 'text', 'thinking',
77
- 'OK', 'function', 'gpt-4.5-preview', 'redacted_thinking',
78
- 'gemma-3-27b-it', 'Azure Openai', 'Anthropic', 'Vertex Anthropic',
79
- 'gemma3:27b', 7680 * 4320, [], 10, { log: true }, 'Alan', 'user',
80
- 'system', 'assistant', 'model', 'json_object', 'tool', true,
81
- 'gemini-embedding-exp-03-07', 'Invalid file data.', 1.1, 100,
82
- 'Content is required.', 2000 * 768, x => 1024 * x, x => 1000 * x,
83
- x => 1024 * 1024 * x, x => 60 * x, x => 60 * 60 * x,
84
- x => 1024 * 1024 * 1024 * x, x => x.replace(/[\.\s]*$/, ''),
85
- { embedding: true }, 'gemini-2.0-flash-exp', 'image', 'Jina',
86
- 'jina-deepsearch-v1', 'jina-clip-v2', 'Vertex',
87
- 'gemini-2.5-pro-exp-03-25', 'SiliconFlow',
77
+ 'OK', 'function', 'gpt-4.1', 'redacted_thinking', 'gemma3:27b',
78
+ 'Azure Openai', 'Anthropic', 'Vertex Anthropic', 7680 * 4320, [], 10,
79
+ { log: true }, 'Alan', 'user', 'system', 'assistant', 'model',
80
+ 'json_object', 'tool', true, 'gemini-embedding-exp-03-07',
81
+ 'Invalid file data.', 1.1, 100, 'Content is required.', 2000 * 768,
82
+ x => 1024 * x, x => 1000 * x, x => 1024 * 1024 * x, x => 60 * x,
83
+ x => 60 * 60 * x, x => 1024 * 1024 * 1024 * x,
84
+ x => x.replace(/[\.\s]*$/, ''), { embedding: true },
85
+ 'gemini-2.0-flash-exp', 'image', 'Jina', 'jina-deepsearch-v1',
86
+ 'jina-clip-v2', 'Vertex', 'gemini-2.5-pro-exp-03-25', 'SiliconFlow',
88
87
  'Pro/deepseek-ai/DeepSeek-V3',
89
88
  ];
90
89
 
@@ -119,6 +118,7 @@ const OPENAI_RULES = {
119
118
  };
120
119
 
121
120
  const GEMINI_RULES = {
121
+ contextWindow: m(1), json: true,
122
122
  audioCostTokens: 1000 * 1000 * 1, // 8.4 hours => 1 million tokens
123
123
  imageCostTokens: ~~(v8k / (768 * 768) * 258), maxAudioLength: hour(8.4),
124
124
  maxAudioPerPrompt: 1, maxFileSize: m(20), maxImagePerPrompt: 3000,
@@ -132,26 +132,27 @@ const GEMINI_RULES = {
132
132
  // https://platform.openai.com/docs/models
133
133
  // https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models
134
134
  const MODELS = {
135
- [GPT_4O]: { ...OPENAI_RULES, ...OPENAI_S1 },
136
- [GPT_45]: { ...OPENAI_RULES, ...OPENAI_S1 },
137
- [GPT_O1]: { ...OPENAI_RULES, ...OPENAI_S2, reasoning: true },
138
- [GPT_O3_MINI]: {
139
- ...OPENAI_RULES, ...OPENAI_S2,
140
- fast: true, reasoning: true, vision: GPT_O1,
141
- },
135
+ [GPT_4O]: { ...OPENAI_RULES, ...OPENAI_S1, defaultProvider: null },
136
+ [GPT_41]: { ...OPENAI_RULES, ...OPENAI_S1, fast: true, finetune: true },
137
+ [GPT_O3]: { ...OPENAI_RULES, ...OPENAI_S2, reasoning: true },
142
138
  [GEMINI_20_FLASH]: {
143
- ...GEMINI_RULES, contextWindow: m(1), maxOutputTokens: k(8),
144
- fast: true, json: true, tools: true,
139
+ ...GEMINI_RULES, maxOutputTokens: k(8),
140
+ fast: true, image: true, tools: false,
141
+ },
142
+ [GEMINI_25_FLASH]: {
143
+ ...GEMINI_RULES, maxOutputTokens: k(64),
144
+ fast: true, reasoning: true, tools: true,
145
145
  },
146
146
  [GEMINI_25_PRO]: {
147
- ...GEMINI_RULES, contextWindow: m(1), maxOutputTokens: k(64),
148
- json: true, reasoning: true, tools: true,
147
+ ...GEMINI_RULES, maxOutputTokens: k(64),
148
+ reasoning: true, tools: true,
149
149
  },
150
150
  [GEMMA_3_27B]: {
151
151
  contextWindow: kT(128), maxOutputTokens: k(8),
152
152
  imageCostTokens: 256, maxImageSize: 896 * 896,
153
153
  supportedMimeTypes: [png, jpeg, gif],
154
- fast: true, json: true, vision: true, defaultProvider: GEMINI,
154
+ fast: true, json: true, vision: true,
155
+ defaultProvider: OLLAMA,
155
156
  },
156
157
  [JINA_DEEPSEARCH]: {
157
158
  contextWindow: Infinity, maxInputTokens: Infinity,
@@ -201,27 +202,18 @@ for (const n in MODELS) {
201
202
  }
202
203
  }
203
204
 
204
- MODELS[GEMINI_20_FLASH].image = GEMINI_20_FLASH_EXP;
205
- MODELS[GEMINI_20_FLASH_EXP] = {
206
- ...MODELS[GEMINI_20_FLASH],
207
- name: GEMINI_20_FLASH_EXP, image: true, tools: false,
208
- };
209
- MODELS[GEMMA327B] = { // Ollama Alias
210
- ...MODELS[GEMMA_3_27B], name: GEMMA327B, defaultProvider: OLLAMA
211
- };
212
-
213
205
  // Default models for each provider
214
206
  const DEFAULT_MODELS = {
215
- [OPENAI]: GPT_4O,
207
+ [OPENAI]: GPT_41,
216
208
  [AZURE_OPENAI]: GPT_4O,
217
209
  [SILICONFLOW]: SF_DEEPSEEK_V3,
218
- [GEMINI]: GEMINI_20_FLASH,
210
+ [GEMINI]: GEMINI_25_FLASH,
219
211
  [ANTHROPIC]: CLOUD_37_SONNET,
220
212
  [VERTEX_ANTHROPIC]: CLOUD_37_SONNET,
221
213
  [JINA]: JINA_DEEPSEARCH,
222
- [OLLAMA]: GEMMA327B,
214
+ [OLLAMA]: GEMMA_3_27B,
223
215
  [OPENAI_VOICE]: NOVA,
224
- [OPENAI_TRAINING]: GPT_4O, // https://platform.openai.com/docs/guides/fine-tuning
216
+ [OPENAI_TRAINING]: GPT_41, // https://platform.openai.com/docs/guides/fine-tuning
225
217
  };
226
218
 
227
219
  const DEFAULT_EMBEDDING = {
@@ -237,7 +229,7 @@ const PROVIDER_ICONS = {
237
229
  };
238
230
 
239
231
  const FEATURE_ICONS = {
240
- audio: '📣', deepsearch: '🔍', fast: '⚡️', image: '🎨',
232
+ audio: '📣', deepsearch: '🔍', fast: '⚡️', finetune: '🔧', image: '🎨',
241
233
  json: '📊', reasoning: '🧠', tools: '🧰', vision: '👁️',
242
234
  };
243
235
 
@@ -814,7 +806,7 @@ const buildPrompts = async (model, input, options = {}) => {
814
806
  break;
815
807
  case GEMINI:
816
808
  const _role = {
817
- role: [GEMINI_20_FLASH_EXP, GEMMA_3_27B].includes(options.model)
809
+ role: [GEMINI_20_FLASH].includes(options.model)
818
810
  ? user : system
819
811
  };
820
812
  systemPrompt = buildGeminiHistory(options.systemPrompt, _role);
@@ -858,7 +850,6 @@ const buildPrompts = async (model, input, options = {}) => {
858
850
  break;
859
851
  case GEMINI:
860
852
  history.push(
861
- ...options.model === GEMMA_3_27B ? [systemPrompt] : [],
862
853
  ...options.toolsResult?.length ? [
863
854
  buildGeminiHistory(content, { ...options, role: user }),
864
855
  ...options.toolsResult.slice(0, options.toolsResult.length - 1)
@@ -877,7 +868,7 @@ const buildPrompts = async (model, input, options = {}) => {
877
868
  } // @todo: audioCostTokens (needs to calculate the audio length):
878
869
  }, model.maxInputTokens - options.attachments?.length * model.imageCostTokens);
879
870
  if ([OPENAI].includes(options.flavor)
880
- || [GEMINI_20_FLASH_EXP, GEMMA_3_27B].includes(options.model)) {
871
+ || [GEMINI_20_FLASH].includes(options.model)) {
881
872
  systemPrompt = null;
882
873
  }
883
874
  return { systemPrompt, history, prompt };
@@ -1185,7 +1176,7 @@ const promptGemini = async (aiId, content, options = {}) => {
1185
1176
  systemInstruction, responseModalities: options.modalities || (
1186
1177
  options.imageMode ? [TEXT, IMAGE] : undefined
1187
1178
  ), ...options?.config || {}, ...model?.tools && !options.jsonMode
1188
- && options.model !== GEMINI_20_FLASH_EXP ? (options.tools ?? {
1179
+ && options.model !== GEMINI_20_FLASH ? (options.tools ?? {
1189
1180
  tools: [
1190
1181
  // @todo: Gemini will failed when using these tools together.
1191
1182
  // https://ai.google.dev/gemini-api/docs/function-calling
@@ -1537,10 +1528,10 @@ export {
1537
1528
  FEATURE_ICONS,
1538
1529
  FUNCTION,
1539
1530
  GEMINI_20_FLASH,
1540
- GPT_45,
1531
+ GEMINI_25_FLASH,
1532
+ GPT_41,
1541
1533
  GPT_4O,
1542
- GPT_O1,
1543
- GPT_O3_MINI,
1534
+ GPT_O3,
1544
1535
  INSTRUCTIONS,
1545
1536
  MODELS,
1546
1537
  OPENAI_VOICE,
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1999.1.50",
4
+ "version": "1999.1.52",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
@@ -20,7 +20,7 @@ const manifest = {
20
20
  },
21
21
  "dependencies": {
22
22
  "file-type": "^20.4.1",
23
- "mathjs": "^14.3.1",
23
+ "mathjs": "^14.4.0",
24
24
  "uuid": "^11.1.0"
25
25
  },
26
26
  "devDependencies": {
@@ -28,47 +28,47 @@ const manifest = {
28
28
  "@anthropic-ai/vertex-sdk": "^0.7.0",
29
29
  "@ffmpeg-installer/ffmpeg": "^1.1.0",
30
30
  "@ffprobe-installer/ffprobe": "^2.1.2",
31
- "@google-cloud/speech": "^7.0.0",
32
- "@google-cloud/storage": "^7.15.2",
33
- "@google-cloud/text-to-speech": "^6.0.0",
34
- "@google-cloud/vision": "^5.0.0",
35
- "@google/genai": "^0.4.0",
31
+ "@google-cloud/speech": "^7.0.1",
32
+ "@google-cloud/storage": "^7.16.0",
33
+ "@google-cloud/text-to-speech": "^6.0.1",
34
+ "@google-cloud/vision": "^5.1.0",
35
+ "@google/genai": "^0.9.0",
36
36
  "@mozilla/readability": "github:mozilla/readability",
37
- "@sentry/node": "^9.6.0",
38
- "@sentry/profiling-node": "^9.6.0",
37
+ "@sentry/node": "^9.13.0",
38
+ "@sentry/profiling-node": "^9.13.0",
39
39
  "acme-client": "^5.4.0",
40
40
  "browserify-fs": "^1.0.0",
41
41
  "buffer": "^6.0.3",
42
42
  "fast-geoip": "^1.1.88",
43
43
  "fluent-ffmpeg": "^2.1.3",
44
44
  "form-data": "^4.0.2",
45
- "ioredis": "^5.6.0",
45
+ "ioredis": "^5.6.1",
46
46
  "js-tiktoken": "^1.0.19",
47
- "jsdom": "^26.0.0",
47
+ "jsdom": "^26.1.0",
48
48
  "lorem-ipsum": "^2.0.8",
49
49
  "mailgun.js": "^12.0.1",
50
50
  "mailparser": "^3.7.2",
51
- "mime": "^4.0.6",
52
- "mysql2": "^3.13.0",
51
+ "mime": "^4.0.7",
52
+ "mysql2": "^3.14.0",
53
53
  "node-mailjet": "^6.0.8",
54
54
  "node-polyfill-webpack-plugin": "^4.1.0",
55
55
  "office-text-extractor": "^3.0.3",
56
- "openai": "^4.87.4",
57
- "pdfjs-dist": "^5.0.375",
56
+ "openai": "^4.95.0",
57
+ "pdfjs-dist": "^5.1.91",
58
58
  "pg": "^8.14.1",
59
59
  "pgvector": "^0.2.0",
60
60
  "ping": "^0.4.4",
61
61
  "process": "^0.11.10",
62
- "puppeteer": "^24.4.0",
62
+ "puppeteer": "^24.6.1",
63
63
  "say": "^0.16.0",
64
64
  "telegraf": "^4.16.3",
65
65
  "telesignsdk": "^3.0.2",
66
- "tesseract.js": "^6.0.0",
67
- "twilio": "^5.5.0",
66
+ "tesseract.js": "^6.0.1",
67
+ "twilio": "^5.5.2",
68
68
  "url": "github:Leask/node-url",
69
69
  "webpack-cli": "^6.0.1",
70
70
  "whisper-node": "^1.1.1",
71
- "wrangler": "^4.1.0",
71
+ "wrangler": "^4.12.0",
72
72
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz",
73
73
  "youtube-transcript": "^1.2.1"
74
74
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1999.1.50",
4
+ "version": "1999.1.52",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "file-type": "^20.4.1",
34
- "mathjs": "^14.3.1",
34
+ "mathjs": "^14.4.0",
35
35
  "uuid": "^11.1.0"
36
36
  },
37
37
  "devDependencies": {
@@ -39,47 +39,47 @@
39
39
  "@anthropic-ai/vertex-sdk": "^0.7.0",
40
40
  "@ffmpeg-installer/ffmpeg": "^1.1.0",
41
41
  "@ffprobe-installer/ffprobe": "^2.1.2",
42
- "@google-cloud/speech": "^7.0.0",
43
- "@google-cloud/storage": "^7.15.2",
44
- "@google-cloud/text-to-speech": "^6.0.0",
45
- "@google-cloud/vision": "^5.0.0",
46
- "@google/genai": "^0.4.0",
42
+ "@google-cloud/speech": "^7.0.1",
43
+ "@google-cloud/storage": "^7.16.0",
44
+ "@google-cloud/text-to-speech": "^6.0.1",
45
+ "@google-cloud/vision": "^5.1.0",
46
+ "@google/genai": "^0.9.0",
47
47
  "@mozilla/readability": "github:mozilla/readability",
48
- "@sentry/node": "^9.6.0",
49
- "@sentry/profiling-node": "^9.6.0",
48
+ "@sentry/node": "^9.13.0",
49
+ "@sentry/profiling-node": "^9.13.0",
50
50
  "acme-client": "^5.4.0",
51
51
  "browserify-fs": "^1.0.0",
52
52
  "buffer": "^6.0.3",
53
53
  "fast-geoip": "^1.1.88",
54
54
  "fluent-ffmpeg": "^2.1.3",
55
55
  "form-data": "^4.0.2",
56
- "ioredis": "^5.6.0",
56
+ "ioredis": "^5.6.1",
57
57
  "js-tiktoken": "^1.0.19",
58
- "jsdom": "^26.0.0",
58
+ "jsdom": "^26.1.0",
59
59
  "lorem-ipsum": "^2.0.8",
60
60
  "mailgun.js": "^12.0.1",
61
61
  "mailparser": "^3.7.2",
62
- "mime": "^4.0.6",
63
- "mysql2": "^3.13.0",
62
+ "mime": "^4.0.7",
63
+ "mysql2": "^3.14.0",
64
64
  "node-mailjet": "^6.0.8",
65
65
  "node-polyfill-webpack-plugin": "^4.1.0",
66
66
  "office-text-extractor": "^3.0.3",
67
- "openai": "^4.87.4",
68
- "pdfjs-dist": "^5.0.375",
67
+ "openai": "^4.95.0",
68
+ "pdfjs-dist": "^5.1.91",
69
69
  "pg": "^8.14.1",
70
70
  "pgvector": "^0.2.0",
71
71
  "ping": "^0.4.4",
72
72
  "process": "^0.11.10",
73
- "puppeteer": "^24.4.0",
73
+ "puppeteer": "^24.6.1",
74
74
  "say": "^0.16.0",
75
75
  "telegraf": "^4.16.3",
76
76
  "telesignsdk": "^3.0.2",
77
- "tesseract.js": "^6.0.0",
78
- "twilio": "^5.5.0",
77
+ "tesseract.js": "^6.0.1",
78
+ "twilio": "^5.5.2",
79
79
  "url": "github:Leask/node-url",
80
80
  "webpack-cli": "^6.0.1",
81
81
  "whisper-node": "^1.1.1",
82
- "wrangler": "^4.1.0",
82
+ "wrangler": "^4.12.0",
83
83
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz",
84
84
  "youtube-transcript": "^1.2.1"
85
85
  }