Skip to content

Commit b5c9144

Browse files
🚀 feat: Add Gemini 2.0 Support, Update Packages and Deprecations (#4951)
* chore: Comment out deprecated MongoDB connection options in connectDb.js * replaced deprecrated MongoDB count() function with countDocuments() * npm audit fix (package-lock cleanup) * chore: Specify .env file in launch configuration * feat: gemini-2.0 * chore: bump express to 4.21.2 to address CVE-2024-52798 * chore: remove redundant comment for .env file specification in launch configuration --------- Co-authored-by: neturmel <[email protected]>
1 parent 4640e1b commit b5c9144

File tree

10 files changed

+29
-45
lines changed

10 files changed

+29
-45
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ GOOGLE_KEY=user_provided
141141
# GOOGLE_REVERSE_PROXY=
142142

143143
# Gemini API (AI Studio)
144-
# GOOGLE_MODELS=gemini-exp-1121,gemini-exp-1114,gemini-1.5-flash-latest,gemini-1.0-pro,gemini-1.0-pro-001,gemini-1.0-pro-latest,gemini-1.0-pro-vision-latest,gemini-1.5-pro-latest,gemini-pro,gemini-pro-vision
144+
# GOOGLE_MODELS=gemini-2.0-flash-exp,gemini-exp-1121,gemini-exp-1114,gemini-1.5-flash-latest,gemini-1.0-pro,gemini-1.0-pro-001,gemini-1.0-pro-latest,gemini-1.0-pro-vision-latest,gemini-1.5-pro-latest,gemini-pro,gemini-pro-vision
145145

146146
# Vertex AI
147147
# GOOGLE_MODELS=gemini-1.5-flash-preview-0514,gemini-1.5-pro-preview-0514,gemini-1.0-pro-vision-001,gemini-1.0-pro-002,gemini-1.0-pro-001,gemini-pro-vision,gemini-1.0-pro

.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"env": {
1111
"NODE_ENV": "production"
1212
},
13-
"console": "integratedTerminal"
13+
"console": "integratedTerminal",
14+
"envFile": "${workspaceFolder}/.env"
1415
}
1516
]
1617
}

api/lib/db/connectDb.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ async function connectDb() {
2525
const disconnected = cached.conn && cached.conn?._readyState !== 1;
2626
if (!cached.promise || disconnected) {
2727
const opts = {
28-
useNewUrlParser: true,
29-
useUnifiedTopology: true,
3028
bufferCommands: false,
29+
// useNewUrlParser: true,
30+
// useUnifiedTopology: true,
3131
// bufferMaxEntries: 0,
3232
// useFindAndModify: true,
3333
// useCreateIndex: true

api/models/tx.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const tokenValues = Object.assign(
7171
/* cohere doesn't have rates for the older command models,
7272
so this was from https://artificialanalysis.ai/models/command-light/providers */
7373
command: { prompt: 0.38, completion: 0.38 },
74+
'gemini-2.0': { prompt: 0, completion: 0 }, // https://ai.google.dev/pricing
7475
'gemini-1.5': { prompt: 7, completion: 21 }, // May 2nd, 2024 pricing
7576
gemini: { prompt: 0.5, completion: 1.5 }, // May 2nd, 2024 pricing
7677
},

api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"cors": "^2.8.5",
5757
"dedent": "^1.5.3",
5858
"dotenv": "^16.0.3",
59-
"express": "^4.21.1",
59+
"express": "^4.21.2",
6060
"express-mongo-sanitize": "^2.2.0",
6161
"express-rate-limit": "^7.4.1",
6262
"express-session": "^1.18.1",

api/utils/tokens.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ const googleModels = {
5050
gemini: 30720, // -2048 from max
5151
'gemini-pro-vision': 12288, // -4096 from max
5252
'gemini-exp': 8000,
53-
'gemini-1.5': 1048576, // -8192 from max
53+
'gemini-2.0': 1048576,
54+
'gemini-1.5': 1048576,
5455
'text-bison-32k': 32758, // -10 from max
5556
'chat-bison-32k': 32758, // -10 from max
5657
'code-bison-32k': 32758, // -10 from max

config/user-stats.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const connect = require('./connect');
1919
let users = await User.find({});
2020
let userData = [];
2121
for (const user of users) {
22-
let conversationsCount = (await Conversation.count({ user: user._id })) ?? 0;
23-
let messagesCount = (await Message.count({ user: user._id })) ?? 0;
22+
let conversationsCount = (await Conversation.countDocuments({ user: user._id })) ?? 0;
23+
let messagesCount = (await Message.countDocuments({ user: user._id })) ?? 0;
2424

2525
userData.push({
2626
User: user.name,

package-lock.json

Lines changed: 16 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/data-provider/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "librechat-data-provider",
3-
"version": "0.7.58",
3+
"version": "0.7.59",
44
"description": "data services for librechat apps",
55
"main": "dist/index.js",
66
"module": "dist/index.es.js",

packages/data-provider/src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,7 @@ export const visionModels = [
760760
'llava-13b',
761761
'gemini-pro-vision',
762762
'claude-3',
763+
'gemini-2.0',
763764
'gemini-1.5',
764765
'gemini-exp',
765766
'moondream',

0 commit comments

Comments
 (0)