utilitas 2000.2.3 → 2000.2.4
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/README.md +3 -3
- package/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +15 -8
- package/lib/manifest.mjs +1 -1
- package/package.json +1 -1
package/lib/alan.mjs
CHANGED
|
@@ -51,7 +51,7 @@ const [
|
|
|
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
|
-
hour, gb, trimTailing,
|
|
54
|
+
hour, gb, trimTailing, GEMINI_30_PRO_IMAGE, IMAGE, JINA, JINA_DEEPSEARCH,
|
|
55
55
|
SILICONFLOW, SF_DEEPSEEK_R1, MAX_TIRE, OPENROUTER_API, OPENROUTER, AUTO,
|
|
56
56
|
TOOL, S_OPENAI, S_GOOGLE, S_ANTHROPIC, ONLINE, GEMINI_30_PRO,
|
|
57
57
|
GEMINI_25_FLASH,
|
|
@@ -65,7 +65,7 @@ const [
|
|
|
65
65
|
'json_object', 1.1, 'Content is required.', 2048 * 2048, x => 1024 * x,
|
|
66
66
|
x => 1000 * x, x => 1024 * 1024 * x, x => 60 * x, x => 60 * 60 * x,
|
|
67
67
|
x => 1024 * 1024 * 1024 * x, x => x.replace(/[\.\s]*$/, ''),
|
|
68
|
-
'gemini-
|
|
68
|
+
'gemini-3-pro-image-preview', 'image', 'Jina', 'jina-deepsearch-v1',
|
|
69
69
|
'SiliconFlow', 'Pro/deepseek-ai/DeepSeek-R1', 768 * 768,
|
|
70
70
|
'https://openrouter.ai/api/v1', 'OpenRouter', 'openrouter/auto', 'tool',
|
|
71
71
|
'openai', 'google', 'anthropic', ':online', 'gemini-3-pro-preview',
|
|
@@ -143,7 +143,7 @@ const MODELS = {
|
|
|
143
143
|
reasoning: true, tools: true,
|
|
144
144
|
},
|
|
145
145
|
// models with unique capabilities
|
|
146
|
-
[
|
|
146
|
+
[GEMINI_30_PRO_IMAGE]: {
|
|
147
147
|
...GEMINI_RULES, icon: '🍌', label: 'Nano Banana',
|
|
148
148
|
contextWindow: k(64), maxOutputTokens: k(32),
|
|
149
149
|
fast: true, image: true,
|
|
@@ -613,6 +613,9 @@ const packResp = async (resp, options) => {
|
|
|
613
613
|
input: BUFFER, expected: BUFFER, suffix: 'pcm.wav', ...options
|
|
614
614
|
}), mime: audioMimeType,
|
|
615
615
|
}));
|
|
616
|
+
// bug fix: Google Gemini returns duplicate first image: {
|
|
617
|
+
images && images.length > 1 && images.shift();
|
|
618
|
+
// }
|
|
616
619
|
images = await Promise.all(
|
|
617
620
|
images.map(async x => ({
|
|
618
621
|
data: await convert(x.buffer, {
|
|
@@ -814,7 +817,7 @@ const promptOpenAI = async (aiId, content, options = {}) => {
|
|
|
814
817
|
} else if (!modalities && model.image) {
|
|
815
818
|
modalities = [TEXT, IMAGE];
|
|
816
819
|
}
|
|
817
|
-
const googleImageMode = source === S_GOOGLE && modalities?.
|
|
820
|
+
const googleImageMode = source === S_GOOGLE && modalities?.includes?.(IMAGE);
|
|
818
821
|
// pricy: https://openrouter.ai/docs/features/web-search
|
|
819
822
|
const ext = ''; // options.jsonMode ? '' : ONLINE;
|
|
820
823
|
const targetModel = `${isOpenrouter(provider, model) ? `${source}/` : ''}${options.model}${ext}`;
|
|
@@ -828,10 +831,14 @@ const promptOpenAI = async (aiId, content, options = {}) => {
|
|
|
828
831
|
modalities, audio: options.audio || (
|
|
829
832
|
modalities?.find?.(x => x === AUDIO)
|
|
830
833
|
&& { voice: DEFAULT_MODELS[OPENAI_VOICE], format: 'pcm16' }
|
|
831
|
-
), ...model?.tools
|
|
834
|
+
), ...model?.tools ? {
|
|
832
835
|
tools: options.tools ?? packedTools, tool_choice: 'auto',
|
|
833
|
-
} : {}, store: true, stream: true,
|
|
834
|
-
|
|
836
|
+
} : {}, store: true, stream: true, ...googleImageMode ? {
|
|
837
|
+
// bug: image_size not working
|
|
838
|
+
// https://openrouter.ai/docs/features/multimodal/image-generation
|
|
839
|
+
// https://openrouter.ai/google/gemini-3-pro-image-preview/api
|
|
840
|
+
image_config: { aspect_ratio: '16:9', image_size: '4K' },
|
|
841
|
+
} : {}, reasoning: { effort: options.reasoning_effort },
|
|
835
842
|
});
|
|
836
843
|
for await (event of resp) {
|
|
837
844
|
// print(JSON.stringify(event, null, 2));
|
|
@@ -1124,7 +1131,7 @@ export {
|
|
|
1124
1131
|
FEATURE_ICONS,
|
|
1125
1132
|
FUNCTION,
|
|
1126
1133
|
GEMINI_25_FLASH,
|
|
1127
|
-
|
|
1134
|
+
GEMINI_30_PRO_IMAGE,
|
|
1128
1135
|
GPT_51,
|
|
1129
1136
|
INSTRUCTIONS,
|
|
1130
1137
|
MODELS,
|
package/lib/manifest.mjs
CHANGED