forked from run-llama/chat-llamaindex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.data.ts
114 lines (110 loc) · 2.86 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
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.`;
const DEMO_BOTS: Omit<Bot, "id" | "session">[] = [
{
avatar: "1f916",
name: "My Documents",
botHello: "Hello! How can I assist you today?",
context: [],
modelConfig: {
model: "gpt-3.5-turbo-16k",
temperature: 0.5,
maxTokens: 8000,
sendMemory: true,
},
readOnly: true,
hideContext: false,
},
{
avatar: "1f5a5-fe0f",
name: "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-3.5-turbo-16k",
temperature: 0.1,
maxTokens: 8000,
sendMemory: true,
},
readOnly: true,
datasource: "inkasso",
hideContext: false,
},
{
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-3.5-turbo-16k",
temperature: 0.1,
maxTokens: 8000,
sendMemory: true,
},
readOnly: true,
datasource: "watchos",
hideContext: false,
},
{
avatar: "1f4da",
name: "Norwegian Basic Law Expert",
botHello: "Hello! How can I assist you today?",
context: [
{
role: "system",
content: TEMPLATE("Lawyer specialized in the basic law of Norway"),
},
],
modelConfig: {
model: "gpt-3.5-turbo-16k",
temperature: 0.1,
maxTokens: 8000,
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.id = nanoid();
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-3.5-turbo-16k" as ModelType,
temperature: 0.5,
maxTokens: 6000,
sendMemory: true,
},
readOnly: false,
createdAt: Date.now(),
botHello: Locale.Store.BotHello,
hideContext: false,
session: createEmptySession(),
});