utilitas 1998.2.43 → 1998.2.45

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
@@ -54,7 +54,7 @@ const [
54
54
  CLAUDE_35_HAIKU, CLOUD_37_SONNET, AUDIO, WAV, CHATGPT_MINI, ATTACHMENTS,
55
55
  CHAT, OPENAI_VOICE, MEDIUM, LOW, HIGH, GPT_REASONING_EFFORT, THINK,
56
56
  THINK_STR, THINK_END, AZURE, TOOLS_STR, TOOLS_END, TOOLS, TEXT, THINKING,
57
- OK, FUNC,
57
+ OK, FUNC, GPT_45,
58
58
  ] = [
59
59
  'OPENAI', 'GEMINI', 'CHATGPT', 'OPENAI_EMBEDDING', 'GEMINI_EMEDDING',
60
60
  'OPENAI_TRAINING', 'OLLAMA', 'CLAUDE', 'gpt-4o-mini', 'gpt-4o', 'o1',
@@ -67,6 +67,7 @@ const [
67
67
  '[ATTACHMENTS]', 'CHAT', 'OPENAI_VOICE', 'medium', 'low', 'high',
68
68
  'medium', 'think', '<think>', '</think>', 'AZURE', '<tools>',
69
69
  '</tools>', 'tools', 'text', 'thinking', 'OK', 'function',
70
+ 'gpt-4.5-preview',
70
71
  ];
71
72
 
72
73
  const [
@@ -147,9 +148,9 @@ const MODELS = {
147
148
  contextWindow: 128000,
148
149
  imageCostTokens: 1105,
149
150
  maxOutputTokens: 16384,
150
- requestLimitsRPM: 5000,
151
- tokenLimitsTPD: 40000000,
152
- tokenLimitsTPM: 4000000,
151
+ requestLimitsRPM: 10000,
152
+ tokenLimitsTPD: 1000000000,
153
+ tokenLimitsTPM: 10000000,
153
154
  trainingData: 'Oct 2023',
154
155
  json: true,
155
156
  vision: true,
@@ -166,9 +167,9 @@ const MODELS = {
166
167
  contextWindow: 128000,
167
168
  imageCostTokens: 1105,
168
169
  maxOutputTokens: 16384,
169
- requestLimitsRPM: 5000,
170
- tokenLimitsTPD: 100000000,
171
- tokenLimitsTPM: 800000,
170
+ requestLimitsRPM: 10000,
171
+ tokenLimitsTPD: 20000000,
172
+ tokenLimitsTPM: 2000000,
172
173
  trainingData: 'Oct 2023',
173
174
  json: true,
174
175
  vision: true,
@@ -185,9 +186,9 @@ const MODELS = {
185
186
  contextWindow: 200000,
186
187
  imageCostTokens: 1105,
187
188
  maxOutputTokens: 100000,
188
- requestLimitsRPM: 500,
189
- tokenLimitsTPD: 100000000,
190
- tokenLimitsTPM: 800000,
189
+ requestLimitsRPM: 10000,
190
+ tokenLimitsTPD: 200000000,
191
+ tokenLimitsTPM: 2000000,
191
192
  trainingData: 'Oct 2023',
192
193
  json: true,
193
194
  reasoning: true,
@@ -205,9 +206,9 @@ const MODELS = {
205
206
  contextWindow: 200000,
206
207
  imageCostTokens: 1105,
207
208
  maxOutputTokens: 100000,
208
- requestLimitsRPM: 5000,
209
- tokenLimitsTPD: 40000000,
210
- tokenLimitsTPM: 4000000,
209
+ requestLimitsRPM: 10000,
210
+ tokenLimitsTPD: 1000000000,
211
+ tokenLimitsTPM: 10000000,
211
212
  trainingData: 'Oct 2023',
212
213
  json: true,
213
214
  reasoning: true,
@@ -221,6 +222,21 @@ const MODELS = {
221
222
  // wav,
222
223
  // ],
223
224
  },
225
+ [GPT_45]: {
226
+ contextWindow: 128000,
227
+ imageCostTokens: 1105,
228
+ maxOutputTokens: 16384,
229
+ requestLimitsRPM: 10000,
230
+ tokenLimitsTPD: 100000000,
231
+ tokenLimitsTPM: 1000000,
232
+ json: true,
233
+ vision: true,
234
+ tools: true,
235
+ supportedMimeTypes: [
236
+ png, jpeg, gif, webp,
237
+ ],
238
+ trainingData: 'Oct 2023',
239
+ },
224
240
  [GEMINI_20_FLASH]: {
225
241
  // https://ai.google.dev/gemini-api/docs/models/gemini
226
242
  // https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/send-multimodal-prompts?hl=en#gemini-send-multimodal-samples-pdf-nodejs
@@ -661,6 +677,7 @@ const getInfoEnd = text => Math.max(...[THINK_END, TOOLS_END].map(x => {
661
677
  return keyEnd >= 0 ? (keyEnd + x.length) : 0;
662
678
  }));
663
679
 
680
+ // @todo: escape ``` in think and tools
664
681
  const packResp = async (resp, options) => {
665
682
  if (options?.raw) { return resp; }
666
683
  let [txt, audio, references, simpleText, referencesMarkdown, end, json] = [
@@ -769,7 +786,7 @@ const buildPrompts = async (model, input, options = {}) => {
769
786
  prompt = buildGptMessage(content, options);
770
787
  break;
771
788
  case CLAUDE:
772
- systemPrompt = buildClaudeMessage(options.systemPrompt, _system);
789
+ systemPrompt = options.systemPrompt;
773
790
  prompt = buildClaudeMessage(content, options)
774
791
  break;
775
792
  case OLLAMA:
@@ -807,9 +824,11 @@ const buildPrompts = async (model, input, options = {}) => {
807
824
  });
808
825
  switch (options.flavor) {
809
826
  case CHATGPT: case CLAUDE: case OLLAMA:
810
- history.push(prompt, ...options.toolsResult?.length
811
- ? options.toolsResult : []);
812
- history = messages(history);
827
+ history = messages([
828
+ ...options.flavor === CLAUDE ? [] : [systemPrompt],
829
+ ...history, prompt,
830
+ ...options.toolsResult?.length ? options.toolsResult : []
831
+ ]);
813
832
  break;
814
833
  case GEMINI:
815
834
  history.push(
@@ -1028,11 +1047,11 @@ const promptClaude = async (content, options = {}) => {
1028
1047
  [], false
1029
1048
  ];
1030
1049
  const { client } = await getClaudeClient(options);
1031
- const { history }
1050
+ const { systemPrompt: system, history }
1032
1051
  = await buildPrompts(_MODEL, content, { ...options, flavor: CLAUDE });
1033
1052
  const resp = await client.beta.messages.create({
1034
1053
  model: options.model, max_tokens: _MODEL.maxOutputTokens, ...history,
1035
- stream: true, ...options.reasoning ?? _MODEL?.reasoning ? {
1054
+ system, stream: true, ...options.reasoning ?? _MODEL?.reasoning ? {
1036
1055
  thinking: options.thinking || { type: 'enabled', budget_tokens: 1024 },
1037
1056
  } : {}, ..._MODEL?.tools ? { // https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking
1038
1057
  tools: options.tools ?? toolsClaude.map(x => x.def),
@@ -1518,9 +1537,8 @@ export {
1518
1537
  ATTACHMENT_TOKEN_COST, CLOUD_37_SONNET, CODE_INTERPRETER, DEEPSEEK_R1,
1519
1538
  DEEPSEEK_R1_32B, DEEPSEEK_R1_70B, DEFAULT_MODELS,
1520
1539
  EMBEDDING_001,
1521
- FUNCTION, GEMINI_20_FLASH, GEMINI_20_FLASH_THINKING, GPT_4O, GPT_4O_MINI, GPT_O1, GPT_O3_MINI, INSTRUCTIONS, MODELS,
1522
- OPENAI_VOICE,
1523
- RETRIEVAL,
1540
+ FUNCTION, GEMINI_20_FLASH, GEMINI_20_FLASH_THINKING, GPT_45, GPT_4O, GPT_4O_MINI, GPT_O1, GPT_O3_MINI, INSTRUCTIONS, MODELS,
1541
+ OPENAI_VOICE, RETRIEVAL,
1524
1542
  TEXT_EMBEDDING_3_SMALL, _NEED, analyzeSessions,
1525
1543
  buildGptTrainingCase,
1526
1544
  buildGptTrainingCases,
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": "1998.2.43",
4
+ "version": "1998.2.45",
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.0",
23
- "mathjs": "^14.3.0",
23
+ "mathjs": "^14.3.1",
24
24
  "uuid": "^11.1.0"
25
25
  },
26
26
  "devDependencies": {
@@ -32,36 +32,36 @@ const manifest = {
32
32
  "@google-cloud/storage": "^7.15.2",
33
33
  "@google-cloud/text-to-speech": "^5.8.1",
34
34
  "@google-cloud/vision": "^4.3.3",
35
- "@google/generative-ai": "^0.22.0",
35
+ "@google/generative-ai": "^0.24.0",
36
36
  "@mozilla/readability": "github:mozilla/readability",
37
37
  "@ngrok/ngrok": "^1.4.1",
38
- "@sentry/node": "^9.3.0",
39
- "@sentry/profiling-node": "^9.3.0",
38
+ "@sentry/node": "^9.5.0",
39
+ "@sentry/profiling-node": "^9.5.0",
40
40
  "acme-client": "^5.4.0",
41
41
  "browserify-fs": "^1.0.0",
42
42
  "buffer": "^6.0.3",
43
43
  "fast-geoip": "^1.1.88",
44
44
  "fluent-ffmpeg": "^2.1.3",
45
45
  "form-data": "^4.0.2",
46
- "ioredis": "^5.5.0",
46
+ "ioredis": "^5.6.0",
47
47
  "js-tiktoken": "^1.0.19",
48
48
  "jsdom": "^26.0.0",
49
49
  "lorem-ipsum": "^2.0.8",
50
- "mailgun.js": "^12.0.0",
50
+ "mailgun.js": "^12.0.1",
51
51
  "mailparser": "^3.7.2",
52
52
  "mime": "^4.0.6",
53
- "mysql2": "^3.12.0",
54
- "node-mailjet": "^6.0.6",
53
+ "mysql2": "^3.13.0",
54
+ "node-mailjet": "^6.0.7",
55
55
  "node-polyfill-webpack-plugin": "^4.1.0",
56
56
  "office-text-extractor": "^3.0.3",
57
57
  "ollama": "^0.5.14",
58
- "openai": "^4.86.1",
58
+ "openai": "^4.86.2",
59
59
  "pdfjs-dist": "^4.10.38",
60
60
  "pg": "^8.13.3",
61
61
  "pgvector": "^0.2.0",
62
62
  "ping": "^0.4.4",
63
63
  "process": "^0.11.10",
64
- "puppeteer": "^24.3.0",
64
+ "puppeteer": "^24.4.0",
65
65
  "say": "^0.16.0",
66
66
  "telegraf": "^4.16.3",
67
67
  "telesignsdk": "^3.0.2",
@@ -70,7 +70,7 @@ const manifest = {
70
70
  "url": "github:Leask/node-url",
71
71
  "webpack-cli": "^6.0.1",
72
72
  "whisper-node": "^1.1.1",
73
- "wrangler": "^3.111.0",
73
+ "wrangler": "^3.114.0",
74
74
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz",
75
75
  "youtube-transcript": "^1.2.1"
76
76
  }
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": "1998.2.43",
4
+ "version": "1998.2.45",
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.0",
34
- "mathjs": "^14.3.0",
34
+ "mathjs": "^14.3.1",
35
35
  "uuid": "^11.1.0"
36
36
  },
37
37
  "devDependencies": {
@@ -43,36 +43,36 @@
43
43
  "@google-cloud/storage": "^7.15.2",
44
44
  "@google-cloud/text-to-speech": "^5.8.1",
45
45
  "@google-cloud/vision": "^4.3.3",
46
- "@google/generative-ai": "^0.22.0",
46
+ "@google/generative-ai": "^0.24.0",
47
47
  "@mozilla/readability": "github:mozilla/readability",
48
48
  "@ngrok/ngrok": "^1.4.1",
49
- "@sentry/node": "^9.3.0",
50
- "@sentry/profiling-node": "^9.3.0",
49
+ "@sentry/node": "^9.5.0",
50
+ "@sentry/profiling-node": "^9.5.0",
51
51
  "acme-client": "^5.4.0",
52
52
  "browserify-fs": "^1.0.0",
53
53
  "buffer": "^6.0.3",
54
54
  "fast-geoip": "^1.1.88",
55
55
  "fluent-ffmpeg": "^2.1.3",
56
56
  "form-data": "^4.0.2",
57
- "ioredis": "^5.5.0",
57
+ "ioredis": "^5.6.0",
58
58
  "js-tiktoken": "^1.0.19",
59
59
  "jsdom": "^26.0.0",
60
60
  "lorem-ipsum": "^2.0.8",
61
- "mailgun.js": "^12.0.0",
61
+ "mailgun.js": "^12.0.1",
62
62
  "mailparser": "^3.7.2",
63
63
  "mime": "^4.0.6",
64
- "mysql2": "^3.12.0",
65
- "node-mailjet": "^6.0.6",
64
+ "mysql2": "^3.13.0",
65
+ "node-mailjet": "^6.0.7",
66
66
  "node-polyfill-webpack-plugin": "^4.1.0",
67
67
  "office-text-extractor": "^3.0.3",
68
68
  "ollama": "^0.5.14",
69
- "openai": "^4.86.1",
69
+ "openai": "^4.86.2",
70
70
  "pdfjs-dist": "^4.10.38",
71
71
  "pg": "^8.13.3",
72
72
  "pgvector": "^0.2.0",
73
73
  "ping": "^0.4.4",
74
74
  "process": "^0.11.10",
75
- "puppeteer": "^24.3.0",
75
+ "puppeteer": "^24.4.0",
76
76
  "say": "^0.16.0",
77
77
  "telegraf": "^4.16.3",
78
78
  "telesignsdk": "^3.0.2",
@@ -81,7 +81,7 @@
81
81
  "url": "github:Leask/node-url",
82
82
  "webpack-cli": "^6.0.1",
83
83
  "whisper-node": "^1.1.1",
84
- "wrangler": "^3.111.0",
84
+ "wrangler": "^3.114.0",
85
85
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz",
86
86
  "youtube-transcript": "^1.2.1"
87
87
  }