-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
30 lines (26 loc) · 1.02 KB
/
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
import { readFile } from 'fs/promises'
import { roleplayer, respond, respondToImage, chat } from './api.js'
async function main() {
// ===========================
// === Casual Conversation ===
// ===========================
const promptCasual = 'Have you read any books recently?'
const responseCasual = await respond(promptCasual, roleplayer.jennyCasual)
console.log(responseCasual)
// ======================
// === Describe Image ===
// ======================
const image = await readFile('test.jpg')
const prompt = 'What do you see in this photo?'
const responseDescribe = await respondToImage(prompt, image, 'jpeg', roleplayer.jennyCasual)
console.log(responseDescribe)
// =============================
// === Remember Conversation ===
// =============================
const session = chat(roleplayer.jennyAssist)
const response1 = await session.message('Hello! Can you turn on the lights?')
console.log(response1)
const response2 = await session.message('Also, turn off the fan')
console.log(response2)
}
main()