diff --git a/.env b/.env new file mode 100644 index 0000000..e69de29 diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..3237c3f --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,8 @@ +module.exports = { + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir: __dirname, + sourceType: 'module', + }, + // ... rest +}; diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d4c0149 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# Recommended files to ignore +*.log +*.tmp +*.bak +*.swp +*.swo +*.DS_Store +Thumbs.db + +# Node.js dependencies +node_modules/ + + +# Environment variables +.env.* + +# Build files +dist/ \ No newline at end of file diff --git a/index.ts b/index.ts index 2e63457..1320c46 100644 --- a/index.ts +++ b/index.ts @@ -1,8 +1,10 @@ +import { GoogleGenerativeAI } from "@google/generative-ai"; +import 'dotenv/config'; export async function geminiClient() { - const { GoogleGenerativeAI } = require("@google/generative-ai"); - const genAI = new GoogleGenerativeAI("AIzaSyA1DNV0vjqUW9A-RogrP9Xj7o1UW4n9w6g"); + const genAI = new GoogleGenerativeAI(process.env.API_KEY as string); + const model = genAI.getGenerativeModel({ model: "gemini-1.5-pro" }); const prompt = `Analyze and summarize the following separation agreement. @@ -578,7 +580,11 @@ Grand Total 115 19 `; const result = await model.generateContent(prompt); - console.log(result.response.text()); -} -await geminiClient(); \ No newline at end of file + console.log("meep") + + const modelResponse = result.response.text(); + return modelResponse; +} +const query = await geminiClient() +console.log(query); \ No newline at end of file diff --git a/node_modules/.pnpm/lock.yaml b/node_modules/.pnpm/lock.yaml index e860544..1e6dd77 100644 --- a/node_modules/.pnpm/lock.yaml +++ b/node_modules/.pnpm/lock.yaml @@ -11,6 +11,9 @@ importers: '@google/generative-ai': specifier: ^0.21.0 version: 0.21.0 + dotenv: + specifier: ^16.4.5 + version: 16.4.5 devDependencies: '@types/node': specifier: ^22.10.1 @@ -31,6 +34,10 @@ packages: '@types/node@22.10.1': resolution: {integrity: sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==} + dotenv@16.4.5: + resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} + engines: {node: '>=12'} + i@0.3.7: resolution: {integrity: sha512-FYz4wlXgkQwIPqhzC5TdNMLSE5+GS1IIDJZY/1ZiEPCT2S3COUVZeT5OW4BmW4r5LHLQuOosSwsvnroG9GR59Q==} engines: {node: '>=0.4'} @@ -51,6 +58,8 @@ snapshots: dependencies: undici-types: 6.20.0 + dotenv@16.4.5: {} + i@0.3.7: {} typescript@5.7.2: {} diff --git a/package.json b/package.json index fb77571..dbf11ba 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,12 @@ }, "packageManager": "pnpm@9.2.0+sha1.886364ebd6dae009284bebc56ed4296bb6dd557a", "dependencies": { - "@google/generative-ai": "^0.21.0" + "@google/generative-ai": "^0.21.0", + "dotenv": "^16.4.5" + }, + "type": "module", + "scripts": { + "start": "tsc", + "build": "tsc --build && node dist/index.js" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e860544..1e6dd77 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@google/generative-ai': specifier: ^0.21.0 version: 0.21.0 + dotenv: + specifier: ^16.4.5 + version: 16.4.5 devDependencies: '@types/node': specifier: ^22.10.1 @@ -31,6 +34,10 @@ packages: '@types/node@22.10.1': resolution: {integrity: sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==} + dotenv@16.4.5: + resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} + engines: {node: '>=12'} + i@0.3.7: resolution: {integrity: sha512-FYz4wlXgkQwIPqhzC5TdNMLSE5+GS1IIDJZY/1ZiEPCT2S3COUVZeT5OW4BmW4r5LHLQuOosSwsvnroG9GR59Q==} engines: {node: '>=0.4'} @@ -51,6 +58,8 @@ snapshots: dependencies: undici-types: 6.20.0 + dotenv@16.4.5: {} + i@0.3.7: {} typescript@5.7.2: {} diff --git a/tsconfig.json b/tsconfig.json index a32c8b3..08f4009 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,10 +1,28 @@ { + // https://www.typescriptlang.org/tsconfig#compilerOptions "compilerOptions": { - "target": "es2017", - "module": "esnext", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true - } - } \ No newline at end of file + "noFallthroughCasesInSwitch": true, + "allowUnreachableCode": false, + "alwaysStrict": true, + "esModuleInterop": true, + "lib": [ + "es2022" + ], + "module": "ES2022", + "preserveConstEnums": true, + "moduleResolution": "bundler", + "strict": true, + "sourceMap": true, + "target": "es2022", + "types": [ + "node" + ], + "outDir": "dist" + }, + "exclude": [ + "node_modules" + ], + "files": [ + "./index.ts" + ], +} \ No newline at end of file