NeonBohdan commited on
Commit
1a44895
1 Parent(s): 741d2e2

Added PersonaConverter call func

Browse files
Files changed (1) hide show
  1. utils.py +20 -1
utils.py CHANGED
@@ -9,6 +9,7 @@ def convert_history(history):
9
 
10
  class PersonaConverter:
11
  personas = {
 
12
  "UrbanLogic":
13
  (
14
  "You are an AI bot that specializes in smart city planning. "
@@ -42,4 +43,22 @@ class PersonaConverter:
42
 
43
  short = (
44
  "You're attempting to provide a concise response within a 40-word limit.\n"
45
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  class PersonaConverter:
11
  personas = {
12
+ "None": "",
13
  "UrbanLogic":
14
  (
15
  "You are an AI bot that specializes in smart city planning. "
 
43
 
44
  short = (
45
  "You're attempting to provide a concise response within a 40-word limit.\n"
46
+ )
47
+
48
+ def __call__(self, name: str, description: str, imaginary: bool, short: bool):
49
+ system_prompt_list = []
50
+ if (name != "None"):
51
+ system_prompt_list.append(self.personas[name])
52
+
53
+ if (len(description) != 0):
54
+ system_prompt_list.append(f"{description}\n")
55
+
56
+ if imaginary:
57
+ system_prompt_list.append(self.imaginary)
58
+
59
+ if short:
60
+ system_prompt_list.append(self.short)
61
+
62
+ system_prompt = "\n".join(system_prompt_list)
63
+
64
+ return system_prompt