@olane/o-intelligence 0.8.9 → 0.8.11
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/dist/src/enums/llm-providers.enum.d.ts +1 -0
- package/dist/src/enums/llm-providers.enum.d.ts.map +1 -1
- package/dist/src/enums/llm-providers.enum.js +1 -0
- package/dist/src/gemini-intelligence.tool.d.ts.map +1 -1
- package/dist/src/gemini-intelligence.tool.js +40 -24
- package/dist/src/methods/llm.methods.d.ts.map +1 -1
- package/dist/src/methods/llm.methods.js +10 -3
- package/dist/src/o-intelligence.tool.d.ts.map +1 -1
- package/dist/src/o-intelligence.tool.js +7 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm-providers.enum.d.ts","sourceRoot":"","sources":["../../../src/enums/llm-providers.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB"}
|
|
1
|
+
{"version":3,"file":"llm-providers.enum.d.ts","sourceRoot":"","sources":["../../../src/enums/llm-providers.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB"}
|
|
@@ -2,6 +2,7 @@ export var LLMProviders;
|
|
|
2
2
|
(function (LLMProviders) {
|
|
3
3
|
LLMProviders["ANTHROPIC"] = "anthropic";
|
|
4
4
|
LLMProviders["OPENAI"] = "openai";
|
|
5
|
+
LLMProviders["GEMINI"] = "gemini";
|
|
5
6
|
LLMProviders["OLLAMA"] = "ollama";
|
|
6
7
|
LLMProviders["PERPLEXITY"] = "perplexity";
|
|
7
8
|
LLMProviders["GROK"] = "grok";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-intelligence.tool.d.ts","sourceRoot":"","sources":["../../src/gemini-intelligence.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAEL,eAAe,EACf,cAAc,EAEf,MAAM,eAAe,CAAC;AA2JvB,qBAAa,sBAAuB,SAAQ,SAAS;IACnD,SAAS,CAAC,MAAM,EAAE,MAAM,CAAoC;IAC5D,SAAS,CAAC,OAAO,EAAE,MAAM,CAC4B;IACrD,SAAS,CAAC,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"gemini-intelligence.tool.d.ts","sourceRoot":"","sources":["../../src/gemini-intelligence.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAEL,eAAe,EACf,cAAc,EAEf,MAAM,eAAe,CAAC;AA2JvB,qBAAa,sBAAuB,SAAQ,SAAS;IACnD,SAAS,CAAC,MAAM,EAAE,MAAM,CAAoC;IAC5D,SAAS,CAAC,OAAO,EAAE,MAAM,CAC4B;IACrD,SAAS,CAAC,YAAY,EAAE,MAAM,CAAsB;gBAExC,MAAM,EAAE,eAAe;IAUnC;;OAEG;IACG,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAoGpE;;OAEG;YACY,iBAAiB;IAsIhC;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAsGlE;;OAEG;YACY,eAAe;IAwI9B;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAwC/D;;OAEG;IACG,gBAAgB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IA0C9D;;OAEG;IACG,YAAY,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAgC1D;;OAEG;IACG,oBAAoB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IA8HlE;;OAEG;IACG,gBAAgB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IA0J9D;;OAEG;YACW,mBAAmB;CA0BlC"}
|
|
@@ -14,7 +14,7 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
14
14
|
});
|
|
15
15
|
this.apiKey = process.env.GEMINI_API_KEY || '';
|
|
16
16
|
this.baseUrl = 'https://generativelanguage.googleapis.com/v1beta';
|
|
17
|
-
this.defaultModel = 'gemini-
|
|
17
|
+
this.defaultModel = 'gemini-2.5-flash';
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Chat completion with Gemini
|
|
@@ -27,8 +27,8 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
27
27
|
return StreamUtils.processGenerator(request, this._streamCompletion(request), request.stream);
|
|
28
28
|
}
|
|
29
29
|
try {
|
|
30
|
-
const { model = this.defaultModel, messages, ...options } = params;
|
|
31
|
-
if (!
|
|
30
|
+
const { model = this.defaultModel, messages, apiKey = this.apiKey, ...options } = params;
|
|
31
|
+
if (!apiKey) {
|
|
32
32
|
return {
|
|
33
33
|
success: false,
|
|
34
34
|
error: 'Gemini API key is required',
|
|
@@ -62,7 +62,7 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
62
62
|
method: 'POST',
|
|
63
63
|
headers: {
|
|
64
64
|
'Content-Type': 'application/json',
|
|
65
|
-
'x-goog-api-key':
|
|
65
|
+
'x-goog-api-key': apiKey,
|
|
66
66
|
},
|
|
67
67
|
body: JSON.stringify(chatRequest),
|
|
68
68
|
});
|
|
@@ -101,8 +101,8 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
101
101
|
async *_streamCompletion(request) {
|
|
102
102
|
try {
|
|
103
103
|
const params = request.params;
|
|
104
|
-
const { model = this.defaultModel, messages, ...options } = params;
|
|
105
|
-
if (!
|
|
104
|
+
const { model = this.defaultModel, messages, apiKey = this.apiKey, ...options } = params;
|
|
105
|
+
if (!apiKey) {
|
|
106
106
|
yield {
|
|
107
107
|
success: false,
|
|
108
108
|
error: 'Gemini API key is required',
|
|
@@ -138,7 +138,7 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
138
138
|
method: 'POST',
|
|
139
139
|
headers: {
|
|
140
140
|
'Content-Type': 'application/json',
|
|
141
|
-
'x-goog-api-key':
|
|
141
|
+
'x-goog-api-key': apiKey,
|
|
142
142
|
},
|
|
143
143
|
body: JSON.stringify(chatRequest),
|
|
144
144
|
});
|
|
@@ -219,8 +219,8 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
219
219
|
return StreamUtils.processGenerator(request, this._streamGenerate(request), request.stream);
|
|
220
220
|
}
|
|
221
221
|
try {
|
|
222
|
-
const { model = this.defaultModel, prompt, system, ...options } = params;
|
|
223
|
-
if (!
|
|
222
|
+
const { model = this.defaultModel, prompt, system, apiKey = this.apiKey, ...options } = params;
|
|
223
|
+
if (!apiKey) {
|
|
224
224
|
return {
|
|
225
225
|
success: false,
|
|
226
226
|
error: 'Gemini API key is required',
|
|
@@ -255,7 +255,7 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
255
255
|
method: 'POST',
|
|
256
256
|
headers: {
|
|
257
257
|
'Content-Type': 'application/json',
|
|
258
|
-
'x-goog-api-key':
|
|
258
|
+
'x-goog-api-key': apiKey,
|
|
259
259
|
},
|
|
260
260
|
body: JSON.stringify(generateRequest),
|
|
261
261
|
});
|
|
@@ -294,8 +294,8 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
294
294
|
async *_streamGenerate(request) {
|
|
295
295
|
try {
|
|
296
296
|
const params = request.params;
|
|
297
|
-
const { model = this.defaultModel, prompt, system, ...options } = params;
|
|
298
|
-
if (!
|
|
297
|
+
const { model = this.defaultModel, prompt, system, apiKey = this.apiKey, ...options } = params;
|
|
298
|
+
if (!apiKey) {
|
|
299
299
|
yield {
|
|
300
300
|
success: false,
|
|
301
301
|
error: 'Gemini API key is required',
|
|
@@ -332,7 +332,7 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
332
332
|
method: 'POST',
|
|
333
333
|
headers: {
|
|
334
334
|
'Content-Type': 'application/json',
|
|
335
|
-
'x-goog-api-key':
|
|
335
|
+
'x-goog-api-key': apiKey,
|
|
336
336
|
},
|
|
337
337
|
body: JSON.stringify(generateRequest),
|
|
338
338
|
});
|
|
@@ -519,7 +519,7 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
519
519
|
async _tool_generate_image(request) {
|
|
520
520
|
try {
|
|
521
521
|
const params = request.params;
|
|
522
|
-
const { model = 'gemini-
|
|
522
|
+
const { model = 'gemini-3-pro-image-preview', prompt, aspectRatio = '1:1', imageSize = '2K', negativePrompt, images, } = params;
|
|
523
523
|
if (!this.apiKey) {
|
|
524
524
|
return {
|
|
525
525
|
success: false,
|
|
@@ -536,19 +536,36 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
536
536
|
const fullPrompt = negativePrompt
|
|
537
537
|
? `${prompt}\n\nAvoid: ${negativePrompt}`
|
|
538
538
|
: prompt;
|
|
539
|
+
// Build request parts array with text prompt and optional reference images
|
|
540
|
+
const requestParts = [
|
|
541
|
+
{ text: fullPrompt },
|
|
542
|
+
];
|
|
543
|
+
if (images && Array.isArray(images)) {
|
|
544
|
+
for (const imageDataUri of images) {
|
|
545
|
+
const matches = imageDataUri.match(/^data:([^;]+);base64,(.+)$/);
|
|
546
|
+
if (matches) {
|
|
547
|
+
requestParts.push({
|
|
548
|
+
inline_data: {
|
|
549
|
+
mime_type: matches[1],
|
|
550
|
+
data: matches[2],
|
|
551
|
+
},
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
539
556
|
const imageRequest = {
|
|
540
557
|
contents: [
|
|
541
558
|
{
|
|
542
|
-
parts:
|
|
559
|
+
parts: requestParts,
|
|
543
560
|
},
|
|
544
561
|
],
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
562
|
+
generationConfig: {
|
|
563
|
+
responseModalities: ['TEXT', 'IMAGE'],
|
|
564
|
+
imageConfig: {
|
|
565
|
+
aspectRatio: aspectRatio,
|
|
566
|
+
imageSize: imageSize,
|
|
567
|
+
},
|
|
568
|
+
},
|
|
552
569
|
};
|
|
553
570
|
const response = await fetch(`${this.baseUrl}/models/${model}:generateContent`, {
|
|
554
571
|
method: 'POST',
|
|
@@ -574,7 +591,6 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
574
591
|
let imageData;
|
|
575
592
|
let description;
|
|
576
593
|
for (const part of parts) {
|
|
577
|
-
console.log('part:', part);
|
|
578
594
|
if (part.inlineData) {
|
|
579
595
|
imageData = part.inlineData.data;
|
|
580
596
|
}
|
|
@@ -608,7 +624,7 @@ export class GeminiIntelligenceTool extends oLaneTool {
|
|
|
608
624
|
async _tool_edit_image(request) {
|
|
609
625
|
try {
|
|
610
626
|
const params = request.params;
|
|
611
|
-
const { model = 'gemini-
|
|
627
|
+
const { model = 'gemini-3-pro-image-preview', prompt, image, aspectRatio, imageSize = '2K', } = params;
|
|
612
628
|
if (!this.apiKey) {
|
|
613
629
|
return {
|
|
614
630
|
success: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.methods.d.ts","sourceRoot":"","sources":["../../../src/methods/llm.methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"llm.methods.d.ts","sourceRoot":"","sources":["../../../src/methods/llm.methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAkRhD,CAAC"}
|
|
@@ -182,7 +182,7 @@ export const LLM_PARAMS = {
|
|
|
182
182
|
},
|
|
183
183
|
generate_image: {
|
|
184
184
|
name: 'generate_image',
|
|
185
|
-
description: 'Generate images using Gemini nano-banana models. Creates images from text prompts using gemini-
|
|
185
|
+
description: 'Generate images using Gemini nano-banana models. Creates images from text prompts using gemini-3-pro-image-preview (Nano Banana Pro).',
|
|
186
186
|
dependencies: [],
|
|
187
187
|
parameters: [
|
|
188
188
|
{
|
|
@@ -196,7 +196,7 @@ export const LLM_PARAMS = {
|
|
|
196
196
|
name: 'model',
|
|
197
197
|
type: 'string',
|
|
198
198
|
value: 'string',
|
|
199
|
-
description: 'The model to use for image generation.
|
|
199
|
+
description: 'The model to use for image generation. Default: "gemini-3-pro-image-preview" (Nano Banana Pro)',
|
|
200
200
|
required: false,
|
|
201
201
|
},
|
|
202
202
|
{
|
|
@@ -220,6 +220,13 @@ export const LLM_PARAMS = {
|
|
|
220
220
|
description: 'Optional description of what to avoid in the generated image.',
|
|
221
221
|
required: false,
|
|
222
222
|
},
|
|
223
|
+
{
|
|
224
|
+
name: 'images',
|
|
225
|
+
type: 'array',
|
|
226
|
+
value: 'string[]',
|
|
227
|
+
description: 'Optional array of reference images as data URIs (data:image/...;base64,...) for context-aware generation',
|
|
228
|
+
required: false,
|
|
229
|
+
},
|
|
223
230
|
],
|
|
224
231
|
},
|
|
225
232
|
edit_image: {
|
|
@@ -245,7 +252,7 @@ export const LLM_PARAMS = {
|
|
|
245
252
|
name: 'model',
|
|
246
253
|
type: 'string',
|
|
247
254
|
value: 'string',
|
|
248
|
-
description: 'The model to use for image editing.
|
|
255
|
+
description: 'The model to use for image editing. Default: "gemini-3-pro-image-preview" (Nano Banana Pro)',
|
|
249
256
|
required: false,
|
|
250
257
|
},
|
|
251
258
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-intelligence.tool.d.ts","sourceRoot":"","sources":["../../src/o-intelligence.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAa,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"o-intelligence.tool.d.ts","sourceRoot":"","sources":["../../src/o-intelligence.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAa,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAS3C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,OAAO,CAAC,eAAe,CAAK;gBAChB,MAAM,EAAE,eAAe;IAuB7B,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAmBnD,gBAAgB,IAAI,OAAO,CAAC;QAAE,QAAQ,EAAE,YAAY,CAAA;KAAE,CAAC;IA6DvD,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAsEtE,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAa7C,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;QACxD,MAAM,EAAE,QAAQ,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,GAAG,CAAC;QACb,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;KAC3B,CAAC;IA6BI,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAsD/D,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;IA0DzD,mBAAmB;IA2CnB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAIlC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CoreUtils, oAddress, oResponse } from '@olane/o-core';
|
|
2
2
|
import { AnthropicIntelligenceTool } from './anthropic-intelligence.tool.js';
|
|
3
3
|
import { OpenAIIntelligenceTool } from './openai-intelligence.tool.js';
|
|
4
|
+
import { GeminiIntelligenceTool } from './gemini-intelligence.tool.js';
|
|
4
5
|
import { OllamaIntelligenceTool } from './ollama-intelligence.tool.js';
|
|
5
6
|
import { PerplexityIntelligenceTool } from './perplexity-intelligence.tool.js';
|
|
6
7
|
import { GrokIntelligenceTool } from './grok-intelligence.tool.js';
|
|
@@ -75,7 +76,7 @@ export class IntelligenceTool extends oLaneTool {
|
|
|
75
76
|
const modelResponse = await this.use(new oAddress('o://human'), {
|
|
76
77
|
method: 'question',
|
|
77
78
|
params: {
|
|
78
|
-
question: 'Which AI model do you want to use? (anthropic, openai, ollama, perplexity, grok)',
|
|
79
|
+
question: 'Which AI model do you want to use? (anthropic, openai, gemini, ollama, perplexity, grok)',
|
|
79
80
|
},
|
|
80
81
|
});
|
|
81
82
|
// process the human response
|
|
@@ -303,6 +304,11 @@ export class IntelligenceTool extends oLaneTool {
|
|
|
303
304
|
parent: this.address,
|
|
304
305
|
leader: this.leader,
|
|
305
306
|
}),
|
|
307
|
+
new GeminiIntelligenceTool({
|
|
308
|
+
...config,
|
|
309
|
+
parent: this.address,
|
|
310
|
+
leader: this.leader,
|
|
311
|
+
}),
|
|
306
312
|
new OllamaIntelligenceTool({
|
|
307
313
|
...config,
|
|
308
314
|
parent: this.address,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-intelligence",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"typescript": "5.4.5"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@olane/o-config": "0.8.
|
|
58
|
-
"@olane/o-core": "0.8.
|
|
59
|
-
"@olane/o-lane": "0.8.
|
|
60
|
-
"@olane/o-protocol": "0.8.
|
|
61
|
-
"@olane/o-tool": "0.8.
|
|
57
|
+
"@olane/o-config": "0.8.11",
|
|
58
|
+
"@olane/o-core": "0.8.11",
|
|
59
|
+
"@olane/o-lane": "0.8.11",
|
|
60
|
+
"@olane/o-protocol": "0.8.11",
|
|
61
|
+
"@olane/o-tool": "0.8.11",
|
|
62
62
|
"debug": "^4.4.1",
|
|
63
63
|
"dotenv": "^16.5.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "d7f0105bfe79bd4fd873ae2bdae607545f46e1f5"
|
|
66
66
|
}
|