-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
32 lines (26 loc) · 995 Bytes
/
config.js
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
28
29
30
31
32
import {GoogleGenerativeAI} from "@google/generative-ai";
import pg from "pg";
import fs from 'fs';
import 'dotenv/config';
import pgPromise from "pg-promise";
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);
export const embeddingModel = genAI.getGenerativeModel({ model: "text-embedding-004"});
export const llmModel = genAI.getGenerativeModel({ model: "gemini-1.5-flash"});
// Connecting to cloud-based PostgreSQL using credentials and ca.pem
// Configuration settings are taken from .env
const config = {
user: process.env.ALLOY_DB_USER,
password: process.env.ALLOY_DB_PASSWORD,
host: process.env.ALLOY_DB_HOST,
port: process.env.ALLOY_DB_PORT,
database: "defaultdb",
ssl: {
rejectUnauthorized: true,
ca: fs.readFileSync('./ca.pem').toString(),
},
};
export const alloyDBClient = new pg.Client(config);
export const pgp = pgPromise({
capSQL: true // capitalize all generated SQL
});
export const pgpClient = pgp(config);