ak-gemini 1.0.53 → 1.0.54

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.
Files changed (3) hide show
  1. package/index.cjs +3 -2
  2. package/index.js +3 -2
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -178,9 +178,10 @@ async function seedWithExamples(examples) {
178
178
  return;
179
179
  }
180
180
  }
181
- if (examples?.slice().pop()[this.systemInstructionsKey]) {
181
+ const instructionExample = examples.find((ex) => ex[this.systemInstructionsKey]);
182
+ if (instructionExample) {
182
183
  logger_default.debug(`Found system instructions in examples; reinitializing chat with new instructions.`);
183
- this.systemInstructions = examples.slice().pop()[this.systemInstructionsKey];
184
+ this.systemInstructions = instructionExample[this.systemInstructionsKey];
184
185
  this.chatConfig.systemInstruction = this.systemInstructions;
185
186
  await this.init(true);
186
187
  }
package/index.js CHANGED
@@ -224,9 +224,10 @@ async function seedWithExamples(examples) {
224
224
  }
225
225
  }
226
226
 
227
- if (examples?.slice().pop()[this.systemInstructionsKey]) {
227
+ const instructionExample = examples.find(ex => ex[this.systemInstructionsKey]);
228
+ if (instructionExample) {
228
229
  log.debug(`Found system instructions in examples; reinitializing chat with new instructions.`);
229
- this.systemInstructions = examples.slice().pop()[this.systemInstructionsKey];
230
+ this.systemInstructions = instructionExample[this.systemInstructionsKey];
230
231
  this.chatConfig.systemInstruction = this.systemInstructions;
231
232
  await this.init(true); // Reinitialize chat with new system instructions
232
233
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "ak-gemini",
3
3
  "author": "ak@mixpanel.com",
4
4
  "description": "AK's Generative AI Helper for doing... transforms",
5
- "version": "1.0.53",
5
+ "version": "1.0.54",
6
6
  "main": "index.js",
7
7
  "files": [
8
8
  "index.js",