forked from wladpaiva/aibitat
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbeginner-chat.ts
45 lines (41 loc) · 1003 Bytes
/
beginner-chat.ts
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
37
38
39
40
41
42
43
44
45
import * as cheerio from 'cheerio'
import {AIbitat} from '../src'
import {cli} from '../src/plugins'
enum Agent {
HUMAN = '🧑',
AI = '🤖',
}
export const aibitat = new AIbitat({
provider: 'openai',
model: 'gpt-3.5-turbo',
})
.use(cli())
.function({
name: 'aibitat-documentations',
description: 'The documentation about aibitat AI project.',
parameters: {
type: 'object',
properties: {},
},
handler: async () => {
const response = await fetch(
'https://raw.githubusercontent.com/wladiston/aibitat/main/README.md',
)
const html = await response.text()
return cheerio.load(html).text()
},
})
.agent(Agent.HUMAN, {
interrupt: 'ALWAYS',
role: 'You are a human assistant.',
})
.agent(Agent.AI, {
functions: ['aibitat-documentations'],
})
if (import.meta.main) {
await aibitat.start({
from: Agent.HUMAN,
to: Agent.AI,
content: `Please, talk about the documentation of AIbitat.`,
})
}