forked from PongNJ/V-RoAst
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (23 loc) · 1006 Bytes
/
index.js
File metadata and controls
27 lines (23 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Load environment variables from the google_key.env file
require('dotenv').config({ path: 'google_key.env' });
// Access the keys
const apiKey1 = process.env.GOOGLE_API_KEY_1;
const apiKey2 = process.env.GOOGLE_API_KEY_2;
const apiKey3 = process.env.GOOGLE_API_KEY_3;
const apiKey4 = process.env.GOOGLE_API_KEY_4;
// Function to choose an API key (this can be based on any logic you prefer)
function chooseApiKey() {
// Example: Randomly choose one of the API keys
const apiKeys = [apiKey1, apiKey2, apiKey3, apiKey4];
const randomIndex = Math.floor(Math.random() * apiKeys.length);
return apiKeys[randomIndex];
}
// Use the chosen API key
const selectedApiKey = chooseApiKey();
console.log('Selected API Key:', selectedApiKey);
// Example of using the selected API key with your existing configuration
generation_config = {
"max_output_tokens": 8192,
"response_mime_type": "application/json",
"api_key": selectedApiKey // Add the selected API key to the configuration
};