myavana-bot-test-core 2.0.7 → 2.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myavana-bot-test-core",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "Shared bot functionality with enhanced features",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/ai.js CHANGED
@@ -1,13 +1,14 @@
1
1
  // ai.js
2
2
  const { genkit } = require('genkit');
3
- const { googleAI, gemini15Flash, gemini20FlashExp, gemini } = require('@genkit-ai/googleai');
3
+ const { googleAI } = require('@genkit-ai/googleai');
4
+
4
5
  const config = require('./config');
5
6
 
6
7
  const ai = genkit({
7
8
  plugins: [googleAI({
8
9
  apiKey: config.genkitApiKey,
9
10
  })],
10
- model: gemini('gemini-3-flash-preview'),
11
+ model: googleAI.model('gemini-3-flash-preview'),
11
12
  });
12
13
 
13
14
  module.exports = ai;
@@ -1,7 +1,7 @@
1
1
  // conversation.js
2
2
  const { pgClient, redisClient } = require('./database');
3
3
  const ai = require('./ai');
4
- const {gemini15Flash, gemini} = require("@genkit-ai/googleai");
4
+ import { googleAI } from '@genkit-ai/google-genai';
5
5
 
6
6
  const saveConversationSummary = async (conversationId, userId, summary) => {
7
7
  const query = `
@@ -28,7 +28,7 @@ const generateConversationSummary = async (chatHistory) => {
28
28
  }
29
29
  const summaryPrompt = `Summarize the following conversation, getting all important information, especially the user's hair details, name, and location: ${JSON.stringify(chatHistory)}`;
30
30
  const { text } = await ai.chat({
31
- model: gemini('gemini-2.5-flash'),
31
+ model: googleAI.model('gemini-2.5-flash'),
32
32
  system: summaryPrompt,
33
33
  });
34
34
  return text;
@@ -1,6 +1,6 @@
1
1
  // postResponseProcessing.js
2
2
  const ai = require("./ai");
3
- const {gemini15Flash, gemini} = require("@genkit-ai/googleai");
3
+ import { googleAI } from '@genkit-ai/google-genai';
4
4
  const DatabaseSessionStore = require("./session");
5
5
  const { pgClient, redisClient } = require('./database');
6
6
  const {generateAndSaveSummary, saveConversationSummary, saveConversation} = require("./conversation");
@@ -226,7 +226,7 @@ const postProcessConversation = async (chatHistory, message) => {
226
226
  //console.log('Extraction prompt: ', extractionPrompt);
227
227
  try {
228
228
  const chat = ai.chat({
229
- model: gemini('gemini-2.5-flash'),
229
+ model: googleAI.model('gemini-2.5-flash'),
230
230
  config: {
231
231
  temperature: 1.1,
232
232
  },
@@ -385,7 +385,7 @@ const postResponseProductCheck = async (chatHistory, message) => {
385
385
  // Try Gemini first
386
386
  try {
387
387
  const chat = ai.chat({
388
- model: gemini('gemini-2.5-flash'), // or gemini20FlashExp
388
+ model: googleAI.model('gemini-2.5-flash'),
389
389
  config: {
390
390
  temperature: 0.3, // Reduced temperature for more consistent JSON formatting
391
391
  },
@@ -1,6 +1,6 @@
1
1
  // unifiedChatHandler.js - Fixed version with proper model prioritization
2
2
  const { genkit, z } = require('genkit');
3
- const { gemini15Flash, gemini15Pro, gemini20FlashExp, gemini } = require('@genkit-ai/googleai');
3
+ import { googleAI } from '@genkit-ai/google-genai';
4
4
 
5
5
  class UnifiedChatHandler {
6
6
  constructor(config) {
@@ -17,9 +17,9 @@ class UnifiedChatHandler {
17
17
 
18
18
  // Initialize model priority list - GEMINI FIRST!
19
19
  this.modelPriority = [
20
- { name: 'gemini20FlashExp', model: gemini('gemini-3-flash-preview'), type: 'primary' },
21
- { name: 'gemini15Flash', model: gemini('gemini-2.5-flash'), type: 'primary' },
22
- { name: 'gemini15Pro', model: gemini('gemini-3-pro-preview'), type: 'backup' }
20
+ { name: 'gemini20FlashExp', model: googleAI.model('gemini-3-flash-preview'), type: 'primary' },
21
+ { name: 'gemini15Flash', model: googleAI.model('gemini-2.5-flash'), type: 'primary' },
22
+ { name: 'gemini15Pro', model: googleAI.model('gemini-3-pro-preview'), type: 'backup' }
23
23
  ];
24
24
 
25
25
  // Only initialize xAI as last resort if API key exists