-
Notifications
You must be signed in to change notification settings - Fork 55
/
app_demo1.py
169 lines (152 loc) · 5.32 KB
/
app_demo1.py
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
PUBLISHED = True
APP_URL = "https://microapp-demo1.streamlit.app"
APP_IMAGE = "demo1_flat.webp"
APP_TITLE = "MicroApp Demo App #1"
APP_INTRO = """This app demonstrates all the fields that are available to a micro-app. It can be used to understand what kinds of inputs a micro-app can ask for, and how to configure those fields.
"""
APP_HOW_IT_WORKS = """
"""
SHARED_ASSET = {
}
HTML_BUTTON = {
}
SYSTEM_PROMPT = """You provide brief 1-2 sentence answers to the instructions you are provided. You never ask questions in your responses. """
PHASES = {
"phase1": {
"name": "Text Input",
"fields": {
"name": {
"type": "text_input",
"label": """What is your first name?""",
"value": "John",
}
},
"phase_instructions": "The user will provide their name. Please welcome them by name. ",
"user_prompt": "{name}",
"allow_skip": True,
},
"phase2": {
"name": "Text Area",
"fields": {
"hobbies": {
"type": "text_area",
"height": 200,
"label": """What are your favorite hobbies?""",
"value": "Golf, Crossword Puzzles, Fantasy Football",
}
},
"phase_instructions": "The user will introduce their hobbies now, and I'll say what I like about one of those hobbies. ",
"user_prompt": "{hobbies}",
"allow_skip": True,
},
"phase3": {
"name": "Chat Area",
"fields": {
"chat": {
"type": "chat_input",
"max_messages": 3,
"placeholder": "What is your name?",
"initial_assistant_message": "Hello, I'm a chatbot with a name. You have to determine my name."
}
},
"allow_skip": True,
"ai_response": True,
"phase_instructions": "Your name is Bottina. You will tell the user your name if they ask.",
"user_prompt": "Please provide feedback on whether or not I discovered that the bot's name is Bottina in this chat: \n\n{chat}",
"scored_phase": True,
"rubric": """
1. Name:
2 points - The user determined that the bot's name is Bottina.
0 points - The user has NOT determined that the bot's name is Bottina.
""",
"minimum_score": 0,
"show_prompt": False,
},
"phase4": {
"name": "Radio Select",
"fields": {
"pluto": {
"type": "radio",
"options": ['Yes!', 'No', 'It is whatever NASA tells me it is.'],
"label": "Is Pluto a planet?",
}
},
"phase_instructions": "The user has been asked 'Is pluto a planet?' and will give their response. Comment on their response",
"user_prompt": "{pluto}",
"allow_skip": True,
},
"phase5": {
"name": "Dropdown Select",
"fields": {
"tech": {
"type": "selectbox",
"options": ['Mac', 'PC', 'Linux!', 'Stone Tablet'],
"label": "Mac or PC?",
}
},
"phase_instructions": "The user will tell you whether they prefer Mac, PC, Linux or provide a flippant answer about their choice of technology. Tell them a joke about whatever their choice is.",
"user_prompt": "{tech}",
"allow_skip": True,
},
"phase6": {
"name": "Checkbox",
"fields": {
"check_me": {
"type": "checkbox",
"label": "Check this box!",
}
},
"phase_instructions": "The user will tell you if they have pets or not. Comment on it.",
"ai_response": False,
"custom_response": "Thanks!",
"allow_skip": True,
},
"phase7": {
"name": "age",
"fields": {
"age": {
"type": "slider",
"min_value": 5,
"max_value": 100,
"label": "How old are you?",
}
},
"phase_instructions": "The user will provide their age. Say something encouraging about their age.",
"user_prompt": "{age}",
"allow_skip": True,
},
"phase8": {
"name": "mars",
"fields": {
"mars": {
"type": "number_input",
"step": 1,
"label": "In what year do you think the first human will reach step foot on Mars?",
}
},
"phase_instructions": "The user will predice what year the first person will step foot on Mars. React to their answer. If their answer is non-sensical, provide a sarcastic comment.",
"user_prompt": "{mars}",
"allow_skip": True,
}
}
PREFERRED_LLM = "gpt-4o-mini"
LLM_CONFIG_OVERRIDE = {
"max_tokens": 8000,
"temperature": 1.0
}
SCORING_DEBUG_MODE = True
DISPLAY_COST = True
COMPLETION_MESSAGE = "You've reached the end! I hope you learned something!"
COMPLETION_CELEBRATION = False
RAG_IMPLEMENTATION = False # make true only when document exists
SOURCE_DOCUMENT = "sample.pdf" # file uploaded in source_docs if only
PAGE_CONFIG = {
"page_title": "Demo 1",
"page_icon": "️🖥️",
"layout": "centered",
"initial_sidebar_state": "expanded"
}
SIDEBAR_HIDDEN = False
from core_logic.main import main
if __name__ == "__main__":
main(config=globals())