Archived
comitting working prototype for Google Gemini queries. Only possible issue is making .env.local work.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
tsconfigRootDir: __dirname,
|
||||
sourceType: 'module',
|
||||
},
|
||||
// ... rest
|
||||
};
|
||||
+18
@@ -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/
|
||||
@@ -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();
|
||||
console.log("meep")
|
||||
|
||||
const modelResponse = result.response.text();
|
||||
return modelResponse;
|
||||
}
|
||||
const query = await geminiClient()
|
||||
console.log(query);
|
||||
+9
@@ -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: {}
|
||||
|
||||
+7
-1
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+9
@@ -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: {}
|
||||
|
||||
+24
-6
@@ -1,10 +1,28 @@
|
||||
{
|
||||
// https://www.typescriptlang.org/tsconfig#compilerOptions
|
||||
"compilerOptions": {
|
||||
"target": "es2017",
|
||||
"module": "esnext",
|
||||
"strict": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"allowUnreachableCode": false,
|
||||
"alwaysStrict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": 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"
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user