Created
May 22, 2025 19:42
-
-
Save yungwarlock/d510c3555f12cae261d7b793fac1d2c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To run this code you need to install the following dependencies: | |
// npm install @google/genai mime | |
// npm install -D @types/node | |
import { GoogleGenAI } from '@google/genai'; | |
async function callGemini(prompt, document) { | |
const ai = new GoogleGenAI({ | |
apiKey: process.env.GEMINI_API_KEY, | |
}); | |
const config = { | |
responseMimeType: 'text/plain', | |
}; | |
const model = 'gemini-1.5-pro'; | |
const contents = [ | |
{ | |
role: 'user', | |
parts: [ | |
{ text: prompt }, | |
{ text: document }, | |
], | |
}, | |
]; | |
const response = await ai.models.generateContent({ | |
model, | |
config, | |
contents, | |
}); | |
return response.text; | |
} | |
async function extractProjectGoal(document) { | |
const prompt = "" | |
return await callGemini(prompt, document); | |
} | |
// Convert speech to text | |
const stt = "" | |
const main = async (stt) => { | |
const res = { | |
"projectGoal": await extractProjectGoal(stt), | |
"targetPersona": "", | |
"": "" | |
} | |
return res | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment