feat: adding gemini stuff

This commit is contained in:
devaine 2025-10-18 23:23:11 -05:00
commit 76cb0e0536
No known key found for this signature in database
GPG key ID: 4BA6E50E8768348F
4 changed files with 44 additions and 24 deletions

View file

@ -1,8 +1,7 @@
import { createPartFromUri, GoogleGenAI } from "@google/genai"
import 'dotenv/config'
import { GoogleGenAI } from "@google/genai"
import fs from "fs"
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY })
const ai = new GoogleGenAI({ apiKey: import.meta.env.GEMINI_API_KEY })
async function uploadLocalPDFs() {
var pdfList = fs.readdirSync("public/pdfs")
@ -45,21 +44,4 @@ async function uploadLocalPDFs() {
return file
}
})
}
async function main() {
const prompts = [
"If possible, using Gemini's Javascript API, how would you grab an image from a PDF sent to the API?"
]
const response = await ai.models.generateContent({
model: "gemini-2.5-flash",
contents: prompts
})
console.log(response.text)
}
uploadLocalPDFs()
main()
}