Spaces:
Build error
Build error
Update config.py
Browse files
config.py
CHANGED
|
@@ -1,80 +1,182 @@
|
|
| 1 |
# config.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
#
|
|
|
|
| 4 |
|
| 5 |
-
############################################################################################################
|
| 6 |
|
| 7 |
-
#
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
# The
|
|
|
|
| 10 |
ai_model = "gpt-4.1"
|
| 11 |
|
| 12 |
-
#
|
|
|
|
|
|
|
| 13 |
temperature = 0.1
|
| 14 |
|
| 15 |
-
#
|
|
|
|
| 16 |
max_tokens = 1000
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
#
|
|
|
|
| 22 |
presence_penalty = 0.7
|
| 23 |
|
| 24 |
-
# Below is all the text you can customize for the app. Don't remove the quotations around the text. Don't change the variable names.
|
| 25 |
-
|
| 26 |
-
############################################################################################################
|
| 27 |
-
|
| 28 |
-
# Below is the name for your default csv terms file. You can change this to any csv file you want to use as your default terms file. It must be in the same folder as the main app.py file.
|
| 29 |
-
|
| 30 |
-
default_terms_csv = "all_terms.csv"
|
| 31 |
-
|
| 32 |
-
############################################################################################################
|
| 33 |
-
|
| 34 |
-
# Below is all the text you can customize for the app. Don't remove the quotations around the text. Don't change the variable names.
|
| 35 |
-
|
| 36 |
-
# The title of the app
|
| 37 |
-
app_title = "Schema Study - BILD 5 Version"
|
| 38 |
|
| 39 |
-
#
|
| 40 |
-
|
|
|
|
| 41 |
|
| 42 |
-
#
|
| 43 |
-
intro_para = "An AI-enhanced study app for biology students."
|
| 44 |
-
|
| 45 |
-
# The user's instructions for the app
|
| 46 |
instructions = '''
|
| 47 |
The goal of this app is to help you learn and and assess your knowledge of core course concepts and examples.
|
| 48 |
1. Choose a course term/phrase from the drop down menu.
|
| 49 |
2. *Pause and think for 30 seconds.* What is everything you associate with this term/phrase? What is a simple definition or example?
|
| 50 |
3. Write as little or as much as you'd like about it. Try to include anything you might need to know for an exam.
|
| 51 |
4. Please follow-up with questions. If you don't know something, just ask. It is perfectly ok to write: "I have no idea what this term means." **Have a conversation!**
|
| 52 |
-
---
|
| 53 |
-
**WANT TO LEVEL UP?**
|
| 54 |
-
- Ask the chatbot: 'I want to test my ability to connect this term to others in the term list. First, give me an example of how to connect the terms 'bats' and 'nitrogen' in a hypothetical real-life scenario. Second, prompt me to similarly create a logical applied scenario between the displayed term and one other you MUST CHOOSE RANDOMLY from the course term list. Your role is to provide feedback whether the scenario I create logically and accurately links the two terms.'
|
| 55 |
-
- Ask the chatbot" 'I want you to provide me with R code to create and print a ggplot object that has a common syntax error and challenge me to fix the bug.'
|
| 56 |
-
- Ask the chatbot: 'Create a scenario where I have to solve a quantitative problem using this term. Make the problem challenging.'
|
| 57 |
-
- Ask the chatbot: 'Please tell me two truths and a lie about this term. I need to choose the lie and explain my reasoning. Make the lies subtle and highlight common misconceptions.'
|
| 58 |
-
- **Get creative! Play around and see what happens! Remember, deep learning occurs the more we scrimmage with the information**
|
| 59 |
'''
|
| 60 |
|
| 61 |
-
app_creation_message = "This app, its corresponding manuscript, and all documentation was authored, edited, and tested by Keefe Reuther, [Liam O Mueller](https://biology.ucsd.edu/research/faculty/lomueller), and the members of the Reuther Lab - [https://reutherlab.biosci.ucsd.edu/](https://reutherlab.netlify.app/)"
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
app_repo_license_message = "It can be found at [https://huggingface.co/spaces/keefereuther/Schema_Study_BILD5](https://huggingface.co/spaces/keefereuther/Schema_Study_BILD5) and is distributed under the GNU GPL-3 License. If you are interested in creating your own version of this application for use in your classroom, please email kdreuther@ucsd.edu for more information."
|
| 64 |
|
| 65 |
-
warning_message = "**ChatGPT can make errors and does not replace verified and reputable online and classroom resources. Do NOT enter any private, confidential, or personally identifiable information.**"
|
| 66 |
|
| 67 |
-
#
|
| 68 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
# DO NOT REMOVE/EDIT anything outside of the triple quotations. The text shown below must remain unedited within the code:
|
| 71 |
-
# def term_prompt(selected_term, selected_context, term_list):
|
| 72 |
-
# return f"""
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
# DO NOT REMOVE/EDIT anything inside the curly braces = '{selected_term}', '{selected_context}', '{term_list}'
|
|
|
|
| 75 |
|
| 76 |
def term_prompt(selected_term, selected_context, term_list):
|
| 77 |
-
return f"""You are Pliny 😊, a friendly and knowledgeable AI biology tutor for university students. Your mission is to help students build a robust understanding of these course-relevant biology terms and concepts: '{term_list}' This includes clarifying definitions, providing examples, addressing misconceptions, exploring applications, and encouraging connections between terms. You NEVER directly answer a question without first trying to get the student to answer it themselves EXCEPT if it a term related to the course syllabus, If it is related to the syllabus or course logistics, give a complete and accurate
|
| 78 |
|
| 79 |
**Guidelines:**
|
| 80 |
|
|
@@ -130,43 +232,3 @@ Assume the student is using R and the tidyverse and has little to no command lin
|
|
| 130 |
By following these instructions, you will provide clear and relevant guidance, helping students learn effectively while maintaining the course's academic integrity.
|
| 131 |
"""
|
| 132 |
|
| 133 |
-
############################################################################################################
|
| 134 |
-
|
| 135 |
-
### RESOURCES
|
| 136 |
-
|
| 137 |
-
# Resources: In this section, you can add links for the student to access and potentially learn more about the topic or verify information.
|
| 138 |
-
# You can add the title of the resource, the URL/file path, and a brief description. To delete or add more resources, follow the same format.
|
| 139 |
-
resources = [
|
| 140 |
-
{
|
| 141 |
-
"title": "Course Syllabus",
|
| 142 |
-
"file_path": "BILD_5_Syllabus_Reuther_SP25.pdf",
|
| 143 |
-
"description": "Download the course syllabus. **Instructor Note:** You must place the file itself within the same folder as the main app.py file in your GitHub repository."
|
| 144 |
-
},
|
| 145 |
-
# In this next line you can add a URLs to the resources section. Just edit the current URL and description. If you need more lines, just copy and paste to add an additional resource. Be wary of deleting or moving any of the commas or braces since this is necessary formatting.
|
| 146 |
-
{
|
| 147 |
-
"title": "OpenAI Prompt engineering guide",
|
| 148 |
-
"url": "https://platform.openai.com/docs/guides/prompt-engineering/six-strategies-for-getting-better-results",
|
| 149 |
-
"description": "A guide to help you craft effective prompts for the OpenAI chatbot. It includes best practices and examples to improve the quality of responses."
|
| 150 |
-
},
|
| 151 |
-
{
|
| 152 |
-
"title": "UC Berkeley Library Guide to Detecting Fake News",
|
| 153 |
-
"url": "https://guides.lib.berkeley.edu/fake-news",
|
| 154 |
-
"description": "This UC Berkeley Library guide offers comprehensive strategies and resources for identifying fake news, understanding its impact, and evaluating the credibility of various news sources, including lists of known fake news sites and tips for detecting misinformation."
|
| 155 |
-
},
|
| 156 |
-
{
|
| 157 |
-
"title": "Is it cheating to use ChatGPT?",
|
| 158 |
-
"url": "https://guides.lib.berkeley.edu/fake-news",
|
| 159 |
-
"description": "The UC San Diego Academic Integrity Office provides guidance on the appropriate use of generative AI tools in educational settings, emphasizing the importance of adhering to instructor guidelines and the potential consequences of misuse, including integrity violations and academic penalties."
|
| 160 |
-
},
|
| 161 |
-
{
|
| 162 |
-
"title": "OpenStax - Biology",
|
| 163 |
-
"url": "https://openstax.org/details/books/biology",
|
| 164 |
-
"description": "Provides free, peer-reviewed, openly licensed textbooks for introductory college and AP-level biology courses."
|
| 165 |
-
},
|
| 166 |
-
{
|
| 167 |
-
"title": "Scitable by Nature Education",
|
| 168 |
-
"url": "https://www.nature.com/scitable",
|
| 169 |
-
"description": "A free science library and personal learning tool focusing on genetics, cell biology, and related topics. It offers articles, eBooks, and educational resources from experts and is part of Nature Education."
|
| 170 |
-
}
|
| 171 |
-
]
|
| 172 |
-
|
|
|
|
| 1 |
# config.py
|
| 2 |
+
#
|
| 3 |
+
# ======================================================================
|
| 4 |
+
# SETTINGS FOR THE SCHEMA STUDY APP
|
| 5 |
+
# ======================================================================
|
| 6 |
+
#
|
| 7 |
+
# This file contains all the customizable settings for your app.
|
| 8 |
+
# If you're not familiar with programming, don't worry! Just follow
|
| 9 |
+
# the instructions next to each setting and edit the values between
|
| 10 |
+
# the quotation marks or after the equals sign.
|
| 11 |
+
#
|
| 12 |
+
# IMPORTANT:
|
| 13 |
+
# - DO NOT remove any quotation marks or equals signs
|
| 14 |
+
# - DO NOT change any variable names (the words before the equals sign)
|
| 15 |
+
# - DO NOT delete any lines or sections
|
| 16 |
+
# - Keep your file in the same folder as app.py
|
| 17 |
+
#
|
| 18 |
+
# ======================================================================
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# ==============================================
|
| 22 |
+
# 1. BASIC APP SETTINGS
|
| 23 |
+
# ==============================================
|
| 24 |
+
|
| 25 |
+
# The title shown at the top of your app
|
| 26 |
+
app_title = "Schema Study - BILD 5"
|
| 27 |
+
|
| 28 |
+
# The file containing your terms and their definitions
|
| 29 |
+
# This must be a CSV file in the same folder as app.py
|
| 30 |
+
# The CSV file should have two columns: first column for terms, second column for context
|
| 31 |
+
default_terms_csv = "all_terms.csv"
|
| 32 |
|
| 33 |
+
# Warning message shown at the bottom of the chat window
|
| 34 |
+
warning_message = "**ChatGPT can make errors and does not replace verified and reputable online and classroom resources. Do NOT enter any private, confidential, or personally identifiable information.**"
|
| 35 |
|
|
|
|
| 36 |
|
| 37 |
+
# ==============================================
|
| 38 |
+
# 2. AI MODEL SETTINGS
|
| 39 |
+
# ==============================================
|
| 40 |
|
| 41 |
+
# The OpenAI model used by the app
|
| 42 |
+
# Current recommended options: "gpt-4.1" or "gpt-4o"
|
| 43 |
ai_model = "gpt-4.1"
|
| 44 |
|
| 45 |
+
# Controls randomness/creativity (0-1)
|
| 46 |
+
# Lower values (0.1-0.3) = more focused, precise responses
|
| 47 |
+
# Higher values (0.7-1.0) = more creative, varied responses
|
| 48 |
temperature = 0.1
|
| 49 |
|
| 50 |
+
# Maximum length of AI responses (measured in tokens)
|
| 51 |
+
# Higher values allow for longer responses (1000-2000 is usually sufficient)
|
| 52 |
max_tokens = 1000
|
| 53 |
|
| 54 |
+
# Controls repetition in responses (0-2)
|
| 55 |
+
# Higher values reduce repetition of phrases
|
| 56 |
+
frequency_penalty = 0.9
|
| 57 |
|
| 58 |
+
# Controls topic diversity (0-2)
|
| 59 |
+
# Higher values encourage the AI to explore new topics
|
| 60 |
presence_penalty = 0.7
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
# ==============================================
|
| 64 |
+
# 3. STUDENT INSTRUCTIONS
|
| 65 |
+
# ==============================================
|
| 66 |
|
| 67 |
+
# Instructions displayed to students when they click the instructions expander
|
|
|
|
|
|
|
|
|
|
| 68 |
instructions = '''
|
| 69 |
The goal of this app is to help you learn and and assess your knowledge of core course concepts and examples.
|
| 70 |
1. Choose a course term/phrase from the drop down menu.
|
| 71 |
2. *Pause and think for 30 seconds.* What is everything you associate with this term/phrase? What is a simple definition or example?
|
| 72 |
3. Write as little or as much as you'd like about it. Try to include anything you might need to know for an exam.
|
| 73 |
4. Please follow-up with questions. If you don't know something, just ask. It is perfectly ok to write: "I have no idea what this term means." **Have a conversation!**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
'''
|
| 75 |
|
|
|
|
| 76 |
|
| 77 |
+
# ==============================================
|
| 78 |
+
# 4. PROMPT TEMPLATE BUTTONS
|
| 79 |
+
# ==============================================
|
| 80 |
+
|
| 81 |
+
# These templates appear as buttons students can click to start different types of activities
|
| 82 |
+
# Each template has a "name" (shown on the button) and a "template" (the text sent when clicked)
|
| 83 |
+
# You can edit the existing templates or add new ones following the same format
|
| 84 |
+
# The {term} will be replaced with the selected term from the dropdown
|
| 85 |
+
# The {term_list} will be replaced with the list of all terms
|
| 86 |
+
|
| 87 |
+
prompt_templates = [
|
| 88 |
+
{
|
| 89 |
+
"name": "Misconception Check",
|
| 90 |
+
"template": "What are some common misconceptions about {term}? Help me identify and correct them by asking me multiple choice questions."
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"name": "Two Truths & a Lie",
|
| 94 |
+
"template": "Tell me two truths and one lie about {term}. I'll try to identify the lie and explain my reasoning."
|
| 95 |
+
},
|
| 96 |
+
{
|
| 97 |
+
"name": "Connect Terms",
|
| 98 |
+
"template": "I want to test my ability to connect {term} to others in the term list. First, give me an example of how to connect the terms 'bats' and 'nitrogen' in a hypothetical real-life scenario. Second, prompt me to similarly create a logical applied scenario between the displayed term and one other you MUST CHOOSE from the course term list one term that is directly related to {term}. When you first display the terms, do NOT give me any additional information about either term. Your role is to provide feedback whether the scenario I create logically and accurately links the two terms."
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"name": "Schema Map",
|
| 102 |
+
"template": "What are all the direct connections between {term} and the other terms among {term_list}? Help me create a concept map for {term}."
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"name": "Create a Study Plan",
|
| 106 |
+
"template": "Please ask me about what assessments I have coming up. You will then ask me simple questions about what I need to know to do well on the assessment and surmise my study preferences. You will then help me create a scaffolded, spaced-repetition study plan to gain the mastery needed to do well on the assessment at all levels of Bloom's taxonomy."
|
| 107 |
+
}
|
| 108 |
+
]
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
# ==============================================
|
| 112 |
+
# 5. ATTRIBUTION AND LICENSE
|
| 113 |
+
# ==============================================
|
| 114 |
+
|
| 115 |
+
# Information about who created the app (appears in the sidebar)
|
| 116 |
+
app_creation_message = "This app, its corresponding manuscript, and all documentation was authored, edited, and tested by Keefe Reuther, [Liam O Mueller](https://biology.ucsd.edu/research/faculty/lomueller), and the members of the Reuther Lab - [https://keefereuther.com](https://keefereuther.com)"
|
| 117 |
+
|
| 118 |
+
# License and repository information (appears in the sidebar)
|
| 119 |
app_repo_license_message = "It can be found at [https://huggingface.co/spaces/keefereuther/Schema_Study_BILD5](https://huggingface.co/spaces/keefereuther/Schema_Study_BILD5) and is distributed under the GNU GPL-3 License. If you are interested in creating your own version of this application for use in your classroom, please email kdreuther@ucsd.edu for more information."
|
| 120 |
|
|
|
|
| 121 |
|
| 122 |
+
# ==============================================
|
| 123 |
+
# 6. RESOURCES LIST
|
| 124 |
+
# ==============================================
|
| 125 |
+
|
| 126 |
+
# Resources shown in the sidebar that students can access
|
| 127 |
+
# You can add/remove/edit resources
|
| 128 |
+
# Each resource can have:
|
| 129 |
+
# - "title": The name of the resource shown in the sidebar
|
| 130 |
+
# - "url": Link to an external website (optional)
|
| 131 |
+
# - "file_path": Path to a downloadable file in your app folder (optional)
|
| 132 |
+
# - "description": Text explaining the resource
|
| 133 |
+
|
| 134 |
+
resources = [
|
| 135 |
+
{
|
| 136 |
+
"title": "Course Syllabus",
|
| 137 |
+
"file_path": "BILD_5_Syllabus_Reuther_SP25.pdf",
|
| 138 |
+
"description": "Download the course syllabus. **Instructor Note:** You must place the file itself within the same folder as the main app.py file in your GitHub repository."
|
| 139 |
+
},
|
| 140 |
+
{
|
| 141 |
+
"title": "OpenAI Prompt engineering guide",
|
| 142 |
+
"url": "https://platform.openai.com/docs/guides/prompt-engineering/six-strategies-for-getting-better-results",
|
| 143 |
+
"description": "A guide to help you craft effective prompts for the OpenAI chatbot. It includes best practices and examples to improve the quality of responses."
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"title": "UC Berkeley Library Guide to Detecting Fake News",
|
| 147 |
+
"url": "https://guides.lib.berkeley.edu/fake-news",
|
| 148 |
+
"description": "This UC Berkeley Library guide offers comprehensive strategies and resources for identifying fake news, understanding its impact, and evaluating the credibility of various news sources, including lists of known fake news sites and tips for detecting misinformation."
|
| 149 |
+
},
|
| 150 |
+
{
|
| 151 |
+
"title": "Is it cheating to use ChatGPT?",
|
| 152 |
+
"url": "https://academicintegrity.ucsd.edu/excel-integrity/gen-ai/ai-in-education.html",
|
| 153 |
+
"description": "The UC San Diego Academic Integrity Office provides guidance on the appropriate use of generative AI tools in educational settings, emphasizing the importance of adhering to instructor guidelines and the potential consequences of misuse, including integrity violations and academic penalties."
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
"title": "OpenStax - Biology",
|
| 157 |
+
"url": "https://openstax.org/details/books/biology",
|
| 158 |
+
"description": "Provides free, peer-reviewed, openly licensed textbooks for introductory college and AP-level biology courses."
|
| 159 |
+
},
|
| 160 |
+
{
|
| 161 |
+
"title": "Scitable by Nature Education",
|
| 162 |
+
"url": "https://www.nature.com/scitable",
|
| 163 |
+
"description": "A free science library and personal learning tool focusing on genetics, cell biology, and related topics. It offers articles, eBooks, and educational resources from experts and is part of Nature Education."
|
| 164 |
+
}
|
| 165 |
+
]
|
| 166 |
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
+
# ==============================================
|
| 169 |
+
# 7. AI SYSTEM PROMPT (ADVANCED)
|
| 170 |
+
# ==============================================
|
| 171 |
+
#
|
| 172 |
+
# THIS SECTION CONTROLS HOW THE AI ASSISTANT BEHAVES
|
| 173 |
+
# Only edit this if you know what you're doing!
|
| 174 |
+
#
|
| 175 |
# DO NOT REMOVE/EDIT anything inside the curly braces = '{selected_term}', '{selected_context}', '{term_list}'
|
| 176 |
+
# These are placeholder variables that get filled in automatically by the app
|
| 177 |
|
| 178 |
def term_prompt(selected_term, selected_context, term_list):
|
| 179 |
+
return f"""You are Pliny 😊, a friendly and knowledgeable AI biology tutor for university students. Your mission is to help students build a robust understanding of these course-relevant biology terms and concepts: '{term_list}' This includes clarifying definitions, providing examples, addressing misconceptions, exploring applications, and encouraging connections between terms. You NEVER directly answer a question without first trying to get the student to answer it themselves EXCEPT if it a term related to the course syllabus, If it is related to the syllabus or course logistics, give a complete and accurate immediate answer.
|
| 180 |
|
| 181 |
**Guidelines:**
|
| 182 |
|
|
|
|
| 232 |
By following these instructions, you will provide clear and relevant guidance, helping students learn effectively while maintaining the course's academic integrity.
|
| 233 |
"""
|
| 234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|