forked from run-llama/chat-llamaindex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.data.ts
134 lines (129 loc) · 3.24 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
126
127
128
129
130
131
132
133
134
import { Bot } from "@/app/store/bot";
import { nanoid } from "nanoid";
import Locale from "../locales";
import { ModelType } from "@/app/client/platforms/llm";
import { createEmptySession } from "../store";
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: "1",
avatar: "1f916",
name: "GPT-4 Vision Preview",
botHello: "Hello! How can I assist you today?",
context: [],
modelConfig: {
model: "gpt-4-vision-preview",
temperature: 0.3,
maxTokens: 4096,
sendMemory: false,
},
readOnly: true,
hideContext: false,
},
{
id: "2",
avatar: "1f916",
name: "My Documents",
botHello: "Hello! How can I assist you today?",
context: [],
modelConfig: {
model: "gpt-4-1106-preview",
temperature: 0.5,
maxTokens: 4096,
sendMemory: true,
},
readOnly: true,
hideContext: false,
},
{
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"),
},
],
modelConfig: {
model: "gpt-4-1106-preview",
temperature: 0.1,
maxTokens: 4096,
sendMemory: true,
},
readOnly: true,
datasource: "redhat",
hideContext: false,
},
{
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"),
},
],
modelConfig: {
model: "gpt-4-1106-preview",
temperature: 0.1,
maxTokens: 4096,
sendMemory: true,
},
readOnly: true,
datasource: "watchos",
hideContext: false,
},
{
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"),
},
],
modelConfig: {
model: "gpt-4-1106-preview",
temperature: 0.1,
maxTokens: 4096,
sendMemory: true,
},
readOnly: true,
datasource: "basic_law_germany",
hideContext: false,
},
];
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-4-1106-preview" as ModelType,
temperature: 0.5,
maxTokens: 4096,
sendMemory: true,
},
readOnly: false,
createdAt: Date.now(),
botHello: Locale.Store.BotHello,
hideContext: false,
session: createEmptySession(),
});