-
Notifications
You must be signed in to change notification settings - Fork 266
/
bot.data.ts
125 lines (118 loc) · 3.09 KB
/
bot.data.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import { Bot, ChatSession } from "@/app/store/bot";
import { nanoid } from "nanoid";
import Locale from "../locales";
const toLlamaCloudDataSource = (pipeline: string) =>
JSON.stringify({ pipeline });
const TEMPLATE = (PERSONA: string) =>
`I want you to act as a ${PERSONA}. I will provide you with the context needed to solve my problem. Use intelligent, simple, and understandable language. Be concise. It is helpful to explain your thoughts step by step and with bullet points.`;
type DemoBot = Omit<Bot, "session">;
export const DEMO_BOTS: DemoBot[] = [
{
id: "2",
avatar: "1f916",
name: "My Documents",
botHello: "Hello! How can I assist you today?",
context: [],
modelConfig: {
model: "gpt-4o-mini",
temperature: 0.5,
maxTokens: 4096,
sendMemory: false,
},
readOnly: true,
datasource: toLlamaCloudDataSource("documents"),
},
{
id: "3",
avatar: "1f5a5-fe0f",
name: "Red Hat Linux Expert",
botHello: "Hello! How can I help you with Red Hat Linux?",
context: [
{
role: "system",
content: TEMPLATE("Red Hat Linux Expert"),
id: "demo-bot-3-system-message",
},
],
modelConfig: {
model: "gpt-4o-mini",
temperature: 0.1,
maxTokens: 4096,
sendMemory: false,
},
readOnly: true,
datasource: toLlamaCloudDataSource("redhat"),
},
{
id: "4",
avatar: "1f454",
name: "Apple Watch Genius",
botHello: "Hello! How can I help you with Apple Watches?",
context: [
{
role: "system",
content: TEMPLATE("Apple Genius specialized in Apple Watches"),
id: "demo-bot-4-system-message",
},
],
modelConfig: {
model: "gpt-4o-mini",
temperature: 0.1,
maxTokens: 4096,
sendMemory: false,
},
readOnly: true,
datasource: toLlamaCloudDataSource("watchos"),
},
{
id: "5",
avatar: "1f4da",
name: "German Basic Law Expert",
botHello: "Hello! How can I assist you today?",
context: [
{
role: "system",
content: TEMPLATE("Lawyer specialized in the basic law of Germany"),
id: "demo-bot-5-system-message",
},
],
modelConfig: {
model: "gpt-4o-mini",
temperature: 0.1,
maxTokens: 4096,
sendMemory: false,
},
readOnly: true,
datasource: toLlamaCloudDataSource("basic_law_germany"),
},
];
export const createDemoBots = (): Record<string, Bot> => {
const map: Record<string, Bot> = {};
DEMO_BOTS.forEach((demoBot) => {
const bot: Bot = JSON.parse(JSON.stringify(demoBot));
bot.session = createEmptySession();
map[bot.id] = bot;
});
return map;
};
export const createEmptyBot = (): Bot => ({
id: nanoid(),
avatar: "1f916",
name: Locale.Store.DefaultBotName,
context: [],
modelConfig: {
model: "gpt-4o-mini",
temperature: 0.5,
maxTokens: 4096,
sendMemory: false,
},
readOnly: false,
createdAt: Date.now(),
botHello: Locale.Store.BotHello,
session: createEmptySession(),
});
export function createEmptySession(): ChatSession {
return {
messages: [],
};
}