-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
36 lines (26 loc) · 1017 Bytes
/
index.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
33
34
35
36
import { config } from 'dotenv';
import { GoogleGenerativeAI } from "@google/generative-ai"
import readline from 'readline'
config();
// ACTIVITY 1
// Use readline to read data from a Readable stream
// Create a userinterface and specify the inputs and outputs
async function handleInput(input) {
try {
// ACTIVITY 2
// initialize the gemini model as "model" and use the model to generate Content
// Generate content based on the user's input
// save the model's response in the variable "response"
// print the model's reponse
// Activity 1
// re prompt the interface to get the next input from the user
// hint: you might want to use .prompt()
// hint 2: you will also have to prompt outside of this function to initialize chat
} catch (error) {
console.error('Error processing your input:', error);
}
}
// ACTIVITY 1
userInterface.on("line", (input) => {
// use the handle input function you wrote here
});