@olane/o-intelligence 0.7.60 → 0.7.61

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.
@@ -3,9 +3,9 @@ import { ToolResult } from '@olane/o-tool';
3
3
  import { oLaneTool } from '@olane/o-lane';
4
4
  import { oNodeToolConfig, oStreamRequest } from '@olane/o-node';
5
5
  export declare class GeminiIntelligenceTool extends oLaneTool {
6
- private apiKey;
7
- private baseUrl;
8
- private defaultModel;
6
+ protected apiKey: string;
7
+ protected baseUrl: string;
8
+ protected defaultModel: string;
9
9
  constructor(config: oNodeToolConfig);
10
10
  /**
11
11
  * Chat completion with Gemini
@@ -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;AAiJvB,qBAAa,sBAAuB,SAAQ,SAAS;IACnD,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,YAAY,CAAU;gBAElB,MAAM,EAAE,eAAe;IAUnC;;OAEG;IACG,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IA6FpE;;OAEG;YACY,iBAAiB;IA8HhC;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IA8FlE;;OAEG;YACY,eAAe;IA+H9B;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IA0C/D;;OAEG;IACG,gBAAgB,CAAC,OAAO,EAAE,Q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CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAgC1D;;OAEG;IACG,oBAAoB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAgHlE;;OAEG;IACG,gBAAgB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IA0J9D;;OAEG;YACW,mBAAmB;CA0BlC"}
@@ -13,6 +13,8 @@ export class GeminiIntelligenceTool extends oLaneTool {
13
13
  dependencies: [],
14
14
  });
15
15
  this.apiKey = process.env.GEMINI_API_KEY || '';
16
+ this.baseUrl = 'https://generativelanguage.googleapis.com/v1beta';
17
+ this.defaultModel = 'gemini-3-pro-preview';
16
18
  }
17
19
  /**
18
20
  * Chat completion with Gemini
@@ -54,10 +56,11 @@ export class GeminiIntelligenceTool extends oLaneTool {
54
56
  },
55
57
  safetySettings: options.safetySettings,
56
58
  };
57
- const response = await fetch(`${this.baseUrl}/models/${model}:generateContent?key=${this.apiKey}`, {
59
+ const response = await fetch(`${this.baseUrl}/models/${model}:generateContent`, {
58
60
  method: 'POST',
59
61
  headers: {
60
62
  'Content-Type': 'application/json',
63
+ 'x-goog-api-key': this.apiKey,
61
64
  },
62
65
  body: JSON.stringify(chatRequest),
63
66
  });
@@ -76,8 +79,7 @@ export class GeminiIntelligenceTool extends oLaneTool {
76
79
  };
77
80
  }
78
81
  return {
79
- success: true,
80
- response: result.candidates[0].content.parts[0]?.text || '',
82
+ message: result.candidates[0].content.parts[0]?.text || '',
81
83
  model: model,
82
84
  usage: result.usageMetadata,
83
85
  finish_reason: result.candidates[0].finishReason,
@@ -128,10 +130,11 @@ export class GeminiIntelligenceTool extends oLaneTool {
128
130
  },
129
131
  safetySettings: options.safetySettings,
130
132
  };
131
- const response = await fetch(`${this.baseUrl}/models/${model}:streamGenerateContent?key=${this.apiKey}&alt=sse`, {
133
+ const response = await fetch(`${this.baseUrl}/models/${model}:streamGenerateContent?alt=sse`, {
132
134
  method: 'POST',
133
135
  headers: {
134
136
  'Content-Type': 'application/json',
137
+ 'x-goog-api-key': this.apiKey,
135
138
  },
136
139
  body: JSON.stringify(chatRequest),
137
140
  });
@@ -242,10 +245,11 @@ export class GeminiIntelligenceTool extends oLaneTool {
242
245
  },
243
246
  safetySettings: options.safetySettings,
244
247
  };
245
- const response = await fetch(`${this.baseUrl}/models/${model}:generateContent?key=${this.apiKey}`, {
248
+ const response = await fetch(`${this.baseUrl}/models/${model}:generateContent`, {
246
249
  method: 'POST',
247
250
  headers: {
248
251
  'Content-Type': 'application/json',
252
+ 'x-goog-api-key': this.apiKey,
249
253
  },
250
254
  body: JSON.stringify(generateRequest),
251
255
  });
@@ -264,8 +268,7 @@ export class GeminiIntelligenceTool extends oLaneTool {
264
268
  };
265
269
  }
266
270
  return {
267
- success: true,
268
- response: result.candidates[0].content.parts[0]?.text || '',
271
+ message: result.candidates[0].content.parts[0]?.text || '',
269
272
  model: model,
270
273
  usage: result.usageMetadata,
271
274
  finish_reason: result.candidates[0].finishReason,
@@ -317,10 +320,11 @@ export class GeminiIntelligenceTool extends oLaneTool {
317
320
  },
318
321
  safetySettings: options.safetySettings,
319
322
  };
320
- const response = await fetch(`${this.baseUrl}/models/${model}:streamGenerateContent?key=${this.apiKey}&alt=sse`, {
323
+ const response = await fetch(`${this.baseUrl}/models/${model}:streamGenerateContent?alt=sse`, {
321
324
  method: 'POST',
322
325
  headers: {
323
326
  'Content-Type': 'application/json',
327
+ 'x-goog-api-key': this.apiKey,
324
328
  },
325
329
  body: JSON.stringify(generateRequest),
326
330
  });
@@ -401,10 +405,11 @@ export class GeminiIntelligenceTool extends oLaneTool {
401
405
  error: 'Gemini API key is required',
402
406
  };
403
407
  }
404
- const response = await fetch(`${this.baseUrl}/models?key=${this.apiKey}`, {
408
+ const response = await fetch(`${this.baseUrl}/models`, {
405
409
  method: 'GET',
406
410
  headers: {
407
411
  'Content-Type': 'application/json',
412
+ 'x-goog-api-key': this.apiKey,
408
413
  },
409
414
  });
410
415
  if (!response.ok) {
@@ -440,10 +445,11 @@ export class GeminiIntelligenceTool extends oLaneTool {
440
445
  error: 'Gemini API key is required',
441
446
  };
442
447
  }
443
- const response = await fetch(`${this.baseUrl}/models/${model}?key=${this.apiKey}`, {
448
+ const response = await fetch(`${this.baseUrl}/models/${model}`, {
444
449
  method: 'GET',
445
450
  headers: {
446
451
  'Content-Type': 'application/json',
452
+ 'x-goog-api-key': this.apiKey,
447
453
  },
448
454
  });
449
455
  if (!response.ok) {
@@ -478,10 +484,11 @@ export class GeminiIntelligenceTool extends oLaneTool {
478
484
  error: 'Gemini API key is required',
479
485
  };
480
486
  }
481
- const response = await fetch(`${this.baseUrl}/models?key=${this.apiKey}`, {
487
+ const response = await fetch(`${this.baseUrl}/models`, {
482
488
  method: 'GET',
483
489
  headers: {
484
490
  'Content-Type': 'application/json',
491
+ 'x-goog-api-key': this.apiKey,
485
492
  },
486
493
  });
487
494
  return {
@@ -535,10 +542,11 @@ export class GeminiIntelligenceTool extends oLaneTool {
535
542
  },
536
543
  },
537
544
  };
538
- const response = await fetch(`${this.baseUrl}/models/${model}:generateContent?key=${this.apiKey}`, {
545
+ const response = await fetch(`${this.baseUrl}/models/${model}:generateContent`, {
539
546
  method: 'POST',
540
547
  headers: {
541
548
  'Content-Type': 'application/json',
549
+ 'x-goog-api-key': this.apiKey,
542
550
  },
543
551
  body: JSON.stringify(imageRequest),
544
552
  });
@@ -672,10 +680,11 @@ export class GeminiIntelligenceTool extends oLaneTool {
672
680
  },
673
681
  },
674
682
  };
675
- const response = await fetch(`${this.baseUrl}/models/${model}:generateContent?key=${this.apiKey}`, {
683
+ const response = await fetch(`${this.baseUrl}/models/${model}:generateContent`, {
676
684
  method: 'POST',
677
685
  headers: {
678
686
  'Content-Type': 'application/json',
687
+ 'x-goog-api-key': this.apiKey,
679
688
  },
680
689
  body: JSON.stringify(imageRequest),
681
690
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-intelligence",
3
- "version": "0.7.60",
3
+ "version": "0.7.61",
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.7.60",
58
- "@olane/o-core": "0.7.60",
59
- "@olane/o-lane": "0.7.60",
60
- "@olane/o-protocol": "0.7.60",
61
- "@olane/o-tool": "0.7.60",
57
+ "@olane/o-config": "0.7.61",
58
+ "@olane/o-core": "0.7.61",
59
+ "@olane/o-lane": "0.7.61",
60
+ "@olane/o-protocol": "0.7.61",
61
+ "@olane/o-tool": "0.7.61",
62
62
  "debug": "^4.4.1",
63
63
  "dotenv": "^16.5.0"
64
64
  },
65
- "gitHead": "bb32050f35a1735644be8e1ea5765ca148391b07"
65
+ "gitHead": "a2ef16871175a628ec00a61e5ff3b8f434760118"
66
66
  }