utilitas 2000.3.20 → 2000.3.22

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
@@ -45,18 +45,18 @@ You may be provided with some tools(functions) to help you gather information an
45
45
  const _NEED = ['js-tiktoken', 'OpenAI'];
46
46
 
47
47
  const [
48
- OPENAI, GEMINI, OLLAMA, NOVA, DEEPSEEK_R1, MD_CODE, CLOUD_OPUS_45, AUDIO,
48
+ OPENAI, GEMINI, OLLAMA, NOVA, DEEPSEEK_32, MD_CODE, CLOUD_OPUS_45, AUDIO,
49
49
  WAV, ATTACHMENTS, OPENAI_VOICE, GPT_REASONING_EFFORT, THINK, THINK_STR,
50
50
  THINK_END, TOOLS_STR, TOOLS_END, TOOLS, TEXT, OK, FUNC, GPT_51,
51
51
  GPT_51_CODEX, GPT_5_IMAGE, GEMMA_3_27B, ANTHROPIC, v8k, ais,
52
52
  MAX_TOOL_RECURSION, LOG, name, user, system, assistant, MODEL, JSON_OBJECT,
53
53
  tokenSafeRatio, CONTENT_IS_REQUIRED, OPENAI_HI_RES_SIZE, k, kT, m, minute,
54
54
  hour, gb, trimTailing, trimBeginning, GEMINI_30_PRO_IMAGE, IMAGE, JINA,
55
- JINA_DEEPSEARCH, SILICONFLOW, SF_DEEPSEEK_R1, MAX_TIRE, OPENROUTER_API,
55
+ JINA_DEEPSEARCH, SILICONFLOW, SF_DEEPSEEK_32, MAX_TIRE, OPENROUTER_API,
56
56
  OPENROUTER, AUTO, TOOL, S_OPENAI, S_GOOGLE, S_ANTHROPIC, ONLINE,
57
57
  GEMINI_30_PRO, GEMINI_25_FLASH,
58
58
  ] = [
59
- 'OpenAI', 'Gemini', 'Ollama', 'nova', 'deepseek-r1', '```',
59
+ 'OpenAI', 'Gemini', 'Ollama', 'nova', 'deepseek-3.2-speciale', '```',
60
60
  'claude-opus-4.5', 'audio', 'wav', '[ATTACHMENTS]', 'OPENAI_VOICE',
61
61
  'medium', 'think', '<think>', '</think>', '<tools>', '</tools>',
62
62
  'tools', 'text', 'OK', 'function', 'gpt-5.1', 'gpt-5.1-codex',
@@ -67,7 +67,7 @@ const [
67
67
  x => 1024 * 1024 * 1024 * x, x => x.replace(/[\.\s]*$/, ''),
68
68
  x => x.replace(/^[\.\s]*/, ''), 'gemini-3-pro-image-preview', 'image',
69
69
  'Jina', 'jina-deepsearch-v1', 'SiliconFlow',
70
- 'Pro/deepseek-ai/DeepSeek-R1', 768 * 768,
70
+ 'deepseek-ai/DeepSeek-V3.2-exp', 768 * 768,
71
71
  'https://openrouter.ai/api/v1', 'OpenRouter', 'openrouter/auto', 'tool',
72
72
  'openai', 'google', 'anthropic', ':online', 'gemini-3-pro-preview',
73
73
  'gemini-2.5-flash-preview-09-2025',
@@ -120,9 +120,9 @@ const GEMINI_RULES = {
120
120
  defaultProvider: OPENROUTER,
121
121
  };
122
122
 
123
- const DEEPSEEK_R1_RULES = {
124
- icon: '🐬', contextWindow: kT(128), maxOutputTokens: k(8),
125
- reasoning: true,
123
+ const DEEPSEEK_32_RULES = {
124
+ icon: '🐬', contextWindow: kT(163.8), maxOutputTokens: k(65.5),
125
+ json: true, tools: true, reasoning: true,
126
126
  };
127
127
 
128
128
  // https://platform.openai.com/docs/models
@@ -158,8 +158,8 @@ const MODELS = {
158
158
  reasoning: true, json: true, vision: true,
159
159
  deepsearch: true, defaultProvider: JINA,
160
160
  },
161
- [DEEPSEEK_R1]: DEEPSEEK_R1_RULES,
162
- [SF_DEEPSEEK_R1]: { ...DEEPSEEK_R1_RULES, defaultProvider: SILICONFLOW },
161
+ [DEEPSEEK_32]: DEEPSEEK_32_RULES,
162
+ [SF_DEEPSEEK_32]: { ...DEEPSEEK_32_RULES, defaultProvider: SILICONFLOW },
163
163
  [CLOUD_OPUS_45]: {
164
164
  source: S_ANTHROPIC, icon: '✳️',
165
165
  contextWindow: kT(200), maxOutputTokens: kT(64),
@@ -242,7 +242,7 @@ for (const n in MODELS) {
242
242
  // Default models for each provider
243
243
  const DEFAULT_MODELS = {
244
244
  [OPENROUTER]: GEMINI_25_FLASH,
245
- [SILICONFLOW]: SF_DEEPSEEK_R1,
245
+ [SILICONFLOW]: SF_DEEPSEEK_32,
246
246
  [JINA]: JINA_DEEPSEARCH,
247
247
  [OLLAMA]: GEMMA_3_27B,
248
248
  [OPENAI_VOICE]: NOVA,
@@ -314,7 +314,7 @@ const tools = [
314
314
  }
315
315
  },
316
316
  func: async args => (await distill(args?.url))?.summary,
317
- showReq: true, replaced: ONLINE,
317
+ showReq: true,
318
318
  },
319
319
  {
320
320
  def: {
@@ -338,16 +338,20 @@ const tools = [
338
338
  num: args?.num || 10, start: args?.start || 1,
339
339
  image: args?.image || false
340
340
  }),
341
- showReq: true, replaced: ONLINE, depend: checkSearch,
341
+ showReq: true, depend: checkSearch,
342
342
  },
343
343
  ];
344
344
 
345
345
  const packTools = async () => {
346
346
  const _tools = [];
347
347
  for (const t of tools) {
348
- (t.depend ? await t.depend() : true) ? _tools.push(t) : log(
349
- `Tool is not ready: ${t.def.function.name}`
350
- );
348
+ if (t.depend ? await t.depend() : true) {
349
+ _tools.push(t);
350
+ } else if (t.def.function.name === 'searchWeb') {
351
+ log(`Tool (${t.def.function.name}) is not ready, fallback to openrouter:online.`);
352
+ } else {
353
+ log(`Tool (${t.def.function.name}) is not ready.`);
354
+ }
351
355
  }
352
356
  return _tools;
353
357
  };
@@ -838,12 +842,11 @@ const promptOpenAI = async (aiId, content, options = {}) => {
838
842
  modalities = [TEXT, IMAGE];
839
843
  }
840
844
  const googleImageMode = source === S_GOOGLE && modalities?.includes?.(IMAGE);
841
- // pricy: https://openrouter.ai/docs/features/web-search
842
- const ext = ''; // options.jsonMode ? '' : ONLINE;
845
+ const packedTools = _tools.map(x => x.def);
846
+ const ext = provider === OPENROUTER && !packedTools?.find(
847
+ x => x.function.name === 'searchWeb'
848
+ ) && !options.jsonMode ? ONLINE : '';
843
849
  const targetModel = `${isOpenrouter(provider, model) ? `${source}/` : ''}${options.model}${ext}`;
844
- const packedTools = (targetModel.endsWith(ONLINE)
845
- ? _tools.filter(x => x?.replaced !== ONLINE)
846
- : _tools).map(x => x.def);
847
850
  if (source === S_GOOGLE) {
848
851
  packedTools.push(...[
849
852
  { googleSearch: {} }, { codeExecution: {} }, { urlContext: {} },
@@ -1152,7 +1155,7 @@ export {
1152
1155
  ATTACHMENTS,
1153
1156
  CLOUD_OPUS_45,
1154
1157
  CODE_INTERPRETER,
1155
- DEEPSEEK_R1,
1158
+ DEEPSEEK_32,
1156
1159
  DEFAULT_MODELS,
1157
1160
  FEATURE_ICONS,
1158
1161
  FUNCTION,
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": "2000.3.20",
4
+ "version": "2000.3.22",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
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": "2000.3.20",
4
+ "version": "2000.3.22",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",