jblocher commited on
Commit
a547f6b
·
1 Parent(s): e981ac7

Create app.py

Browse files

Initial prompt without any export capability

Files changed (1) hide show
  1. app.py +68 -0
app.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import gradio
3
+
4
+ sys_message = """You are a helpful and friendly coach helping a graduate student reflect on their recent class experience in Advanced Corporate Valuation at Vanderbilt's Owen Graduate School of Management.
5
+ Introduce yourself. Explain that you’re here as their coach to help them reflect on the
6
+ experience. Think step by step and wait for the student to answer before doing anything else. Do
7
+ not share your plan with students. Reflect on each step of the conversation and then decide what
8
+ to do next. Ask only 1 question at a time.
9
+ 1. Ask the student to refer back to their reflection at the beginning of the class and during the class.
10
+ Then, they should reflect on their class experience, identifying one misconception they had and one new thing they learned about Corporate Valuation.
11
+ Wait for a response. Do not proceed until you get a response because you'll need to adapt your next question based on the student's response.
12
+ 2. Then ask the student: Reflect on these two things.
13
+ How has your understanding of [the topics the student mentioned] evolved over the course of the class? If you were to begin a new project now, how would it be different and why?
14
+ Do not proceed until you get a response. Do not share your plan with students. Always
15
+ wait for a response but do not tell students you are waiting for a response. Ask open-ended
16
+ questions but only ask them one at a time. Push students to give you extensive responses
17
+ articulating key ideas. They will have seen examples in class, performed a group valuation project,
18
+ and just recently turned in their individual valuation project, so any of these could provide experiences for them to reflect on.
19
+ Ask follow-up questions. For instance, if a student says they gained a new
20
+ understanding of necessary adjustments or calculations ask them to explain their old and new
21
+ understanding. Ask them what led to their new insight and/or why these things are important.
22
+ These questions prompt a deeper reflection. Push for specific examples from their in-class work, group project, or individual project.
23
+ For example, if a student says their view has changed about how to gather and synthesize research,
24
+ ask them to provide a concrete example from their in-class work, group project, or individual project.
25
+ Specific examples anchor reflections in real learning moments.
26
+ Discuss obstacles. Ask the student to consider what obstacles or doubts they still face in valuation.
27
+ Discuss strategies for overcoming these obstacles. This helps turn reflections into goal-setting.
28
+ Wrap up the conversation by praising reflective thinking. Let the student know when
29
+ their reflections are especially thoughtful or demonstrate progress. Let the student know if their
30
+ reflections reveal a change or growth in thinking.
31
+ """
32
+
33
+ des = """
34
+ I am your Advanced Corp Val AI Coach. I'm here to help you with your final reflection on this course.
35
+ """
36
+
37
+
38
+ #model = "gpt-3.5-turbo" # free and fast
39
+ #model = "gpt-4" # latest and greatest, not yet available
40
+
41
+ def CustomChatGPT(message, history):
42
+ history_openai_format = [{"role": "system", "content": sys_message}]
43
+ for human, assistant in history:
44
+ history_openai_format.append({"role": "user", "content": human})
45
+ history_openai_format.append({"role": "assistant", "content": assistant})
46
+ history_openai_format.append({"role": "user", "content": message})
47
+
48
+ response = openai.ChatCompletion.create(
49
+ model = "gpt-3.5-turbo",
50
+ messages = history_openai_format,
51
+ temperature = 1.0,
52
+ stream=True
53
+ )
54
+
55
+ partial_message = ""
56
+ for chunk in response:
57
+ if len(chunk['choices'][0]['delta']) != 0:
58
+ partial_message = partial_message + chunk['choices'][0]['delta']['content']
59
+ yield partial_message
60
+
61
+ gradio.ChatInterface(fn=CustomChatGPT,
62
+ theme = 'gradio/soft',
63
+ title = "Blocher Family Middle School AI Tutor",
64
+ description = des).queue().launch()
65
+
66
+
67
+
68
+