Owen Wang commited on
Commit
6b2d71e
·
1 Parent(s): 4b2c4ed

improved prompts

Browse files
Files changed (1) hide show
  1. app.py +23 -6
app.py CHANGED
@@ -71,8 +71,7 @@ def query_openai(prompt):
71
  max_tokens=MAX_TOKENS,
72
  n=1,
73
  stop=None,
74
- temperature=0.7,
75
- frequency_penalty=2
76
  )
77
  conversation.append(response.choices[0].message)
78
  return response.choices[0].message.content.strip()
@@ -103,18 +102,36 @@ def extract_arrays(s):
103
  return None
104
 
105
  def generate_curriculum(skills):
106
- prompt = f"You are a world-class middle and high school educator who develops project-based entrepreneurship curriculum catered to student interests. Create a curriculum of up to 5 lessons for a course based on the student's target skills to learn. Output the curriculum as a javascript array of strings, where each string is a description of the lesson. The output should just be the array and nothing else. Student's target skills: {skills}"
 
 
 
 
 
 
107
  response = query_openai(prompt)
108
  return extract_arrays(response)
109
 
110
  def generate_ideas(metadatas, interests):
111
- summary = ".".join([f"Lesson {i} - title: {metadata['title']}, description: {metadata['description']}, learning outcome: {metadata['outcome']}" for i, metadata in enumerate(metadatas)])
112
- prompt = f"We've created a curriculum for the student: {summary}. The student has an interest in \"{interests}\". What are some ambitious projects the student could do from what they'd learn from the curriculum?"
 
 
 
 
 
113
  response = query_openai(prompt)
114
  print(response)
115
 
116
  def generate_application(metadata, interests):
117
- prompt = f"For the lesson titled \"{metadata['title']}\" about \"{metadata['description']}\", first describe the lesson and its outcome in one sentence objectively. Next, explore possible personal growth outcomes that combine their interest in \"{interests}\" with this lesson in one concise sentence. Implicitly draw poetic connections between the interests and the lesson. Help them to feel inspired to connect with the lesson. Try to communicate this without using the words \"{interests}\". Instead, tie in one of the previously described ambitious projects. Don't repeat an example of a project if you've used it for a previous lesson. Help them to see how the knowledge they gain in this lesson will allow them to thrive in their interests."
 
 
 
 
 
 
 
118
  response = query_openai(prompt)
119
  return response
120
 
 
71
  max_tokens=MAX_TOKENS,
72
  n=1,
73
  stop=None,
74
+ temperature=0.7
 
75
  )
76
  conversation.append(response.choices[0].message)
77
  return response.choices[0].message.content.strip()
 
102
  return None
103
 
104
  def generate_curriculum(skills):
105
+ prompt = f"""
106
+ You are a world-class middle and high school educator who develops project-based entrepreneurship curriculum catered to student interests.
107
+ Create a curriculum of up to 5 lessons for a course based on the student's target skills to learn.
108
+ Output the curriculum as a javascript array of strings, where each string is a description of the lesson.
109
+ The output should just be the array and nothing else.
110
+ Student's target skills: {skills}
111
+ """
112
  response = query_openai(prompt)
113
  return extract_arrays(response)
114
 
115
  def generate_ideas(metadatas, interests):
116
+ summary = "\n".join([f"- Lesson {i + 1}: {metadata['title']}. The description of the lesson is \"{metadata['description']}\". The learning outcomes are \"{metadata['outcome']}\"" for i, metadata in enumerate(metadatas)])
117
+ prompt = f"""
118
+ We've created a curriculum for the student:
119
+ {summary}
120
+ The student has an interest in \"{interests}\".
121
+ What are 5 ambitious projects the student could do after they've learned the skills from this curriculum?
122
+ """
123
  response = query_openai(prompt)
124
  print(response)
125
 
126
  def generate_application(metadata, interests):
127
+ prompt = f"""
128
+ For the lesson titled \"{metadata['title']}\", describe the lesson and its outcome in one sentence objectively.
129
+ Next, in one concise sentence, explore possible personal growth outcomes that combine their interest in \"{interests}\" with this lesson.
130
+ The sentence should implicitly draw poetic connections between the interests and the lesson and help them to feel inspired to connect with the lesson.
131
+ It should not explicitly use the words \"{interests}\" and instead provide as an example one of the previously described ambitious projects.
132
+ Don't repeat an example of a project if you've used it for a previous lesson.
133
+ Sound like you're naturally explaining the lesson in person. Don't start with a header, etc.
134
+ """
135
  response = query_openai(prompt)
136
  return response
137