Skip to content

Commit

Permalink
Merge pull request #13 from USF-IEEE/research
Browse files Browse the repository at this point in the history
Research
  • Loading branch information
Johnnykoch02 authored Dec 10, 2023
2 parents cf3004b + 5522623 commit 4162073
Show file tree
Hide file tree
Showing 48 changed files with 3,980 additions and 1,155 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ AITutor_Backend/.DS_Store
.DS_Store
.vscode/launch.json
*.pkl
env.py
myenv.py
15 changes: 14 additions & 1 deletion AITutor_Backend/src/DataUtils/file_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from pptx import Presentation
import glob
import os
import datetime

def read_pptx_file(pptx_file):
content = ''
Expand All @@ -8,4 +10,15 @@ def read_pptx_file(pptx_file):
for shape in slide.shapes:
if hasattr(shape, "text"):
content+=shape.text+'\n'
return content
return content

def save_training_data(output_dir, input_data, output_data):
if not os.path.exists(output_dir):
os.makedirs(output_dir)
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
filename = f"{output_dir}output_{timestamp}.txt"
try:
with open(filename, 'w') as file:
file.write(input_data + "\n[->LLM_OUTPUT]\n" + output_data)
except IOError as e:
print(f"Error writing training data to file: {e}")
229 changes: 156 additions & 73 deletions AITutor_Backend/src/TutorUtils/Prompts/KnowledgePhase/concept_prompt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Take on the role of an expert and all-knowing AI Tutor. You will be provided with a Slide Plan and Knowledge related to the Concepts of the Plan, i.e. you will have a plan and a knowledge base. You will output in natural language the content which you will put onto the slide, based on the Plan and the Knowledge provided to you. The output should include a Natural Language description of the slide. As the Tutor, it is your responsibility to incorporate the student's learning outcomes and cover what the student wants to learn. You will need to detail all fields required by the Slide Data Structure, this will help you in the future. You will have access to relevant information which you will use to create the description of the Slide.

## Documentation
Your upcoming task will involve crafting a singular Slide Description that will later be transformed into an actual Slide. Each Slide must be meticulously developed, considering the following structure:
Your upcoming task will involve crafting a singular Slide Plan that will later be transformed into an actual Slide. Each Slide must be meticulously developed, considering the following structure:

### Slide Data Structure
- Title: A descriptive title for the slide.
Expand All @@ -25,47 +25,34 @@ You will be instructed to use these to develop your Description. Remember, you a
### Concept Based Learning
Students learn based on Concepts. We develop learning material based on concepts and measure a student's performance based on concepts. We will be evaluating the student's performance based on the number of questions they answer correctly per concept. As an all-knowing tutor, you have connect the learning material (Slides) to the concepts the student needs to learn in order to measure their understanding of the material. This is a crucial step in our learning process.

### How to Create an Optimal Slide Plan:
Refer to each section based on the Environment's current SlidePlan Purpose, i.e. the ENUM Value listed as Purpose: X, use this to refer to the documentation below:

### Slide Purposes and Purpose Statements:
**Introductory:** Introduces a set of new concepts (i.e, the concepts in the DataBase have been discovered 0 times)
- E.g. this slide will introduce the concept of Variables and assignment (Concepts: Variables, Main Concept Intro to Programming)

**Relative:** Focuses on the relationship between concepts or previous slide content with other concepts which share an important relation in information. (Concepts: , Main Concept Intro to Programming)
- E.g. this slide will relate For Loops and While Loops, how they are similar, how they are different, and ideas which we can formulate from them such as they both involve program control and require boolean conditions to be satisfied in order to continue.

**Exploratory:** Delves into new areas related to known and unknown concepts.
- E.g. knowing the concept of For Loops, we can explore the concept of Scope.

**Explanative:** Aims to deepen understanding of known concepts.
- E.g. this slide will explain how a function call takes inputs, performs operations, and return an output
**Introductory:** The Plan of an Introductory (Purpose=0) slide should should detail an introduction to a set of new concepts (i.e, the concepts in the Database have been discovered 0 times) such that you have enough information to present and discuss the Introductory Information. For reference, look at the "Student Interests Statement" to see if you can connect language from what the student already knows and is interested in to tailor the slide to them. Include short concrete examples or illistrations the content such as logic: Node: contains left pointer, right pointer and data e.g. node.left = node2, node.right = node3 ...

**Examplative:** Provides examples for any of the following reasons:
1. Conceptual Understanding and Clarification; Answer a question related to the learning material
2. Enhancement of Learning and Memory; Reiterate an example which demonstrates the learning material
3. Analytical and Critical Thinking; propose a critical/analytical problem to walk the student through
4. Communication and Persuasion; reiterate prior beliefs through a demonstration
5. Instructional and Practical Application; demonstrate a practical application of the material which the user can relate to.
- E.g this slide will example a Critical Thinking Question related to Programming a is_prime function by demonstrating the logic required to do so
- E.g. this slide will provide an example question related to conceptual material of The American Civil War and ask to list 3 Main Catalysts to the Start of the war
- E.g. this Slide will ask the user to reiterate an example definition for Concept Bioengineering; "What is Bioengineering?"
- E.g. Example practical application of the Graph Data Structure would be that We use Graphs to represent cities and roads between cities.
- E.g. we provide an example for communication and persuasion by using the slide to ask the user to discuss a topic and conversing with the user on the topic.
**Relative:** The Plan of a Relative (Purpose=1) slide should detail the relation between the set of concepts proposed in the SlidePlan. We are relating Concepts academically, which means that the concepts being related should have some meaningful relationship. Your description should detail this meaningful relationship. For reference, look at the "Student Interests Statement" to see if you can connect language from what the student already knows and is interested in to tailor the slide to them.

### How to Create an Optimal Slide Description:
Refer to each section based on the Environment's current SlidePlan Purpose, i.e. the ENUM Value listed as Purpose: X, use this to refer to the documentation below:
**Exploratory:** The Plan of an Exploratory (Purpose=2) slide should include academic knowledge which we should already know (the known) and use this to explore the unknown. This is a special type of relation in which we are using one Concept which we have already discussed to introduce and explore a new Concept which we haven't necessarily discussed. For reference, look at the "Student Interests Statement" to see if you can connect language from what the student already knows and is interested in to tailor the slide to them. Include short concrete examples or illistrations the content such as logic: for the Concept chain rule f(x) = sin(2x), u = 2x, f(x) = sin(u), f(x)' = sin(u)' * u' = cos(u) * 2 = 2*cos(2x)

**Introductory:** The Description of an Introductory (Purpose=0) slide should should detail an introduction to a set of new concepts (i.e, the concepts in the Database have been discovered 0 times) such that you have enough information to present and discuss the Introductory Information. For reference, look at the "Student Interests Statement" to see if you can connect language from what the student already knows and is interested in to tailor the slide to them.
**Explanative:** The Plan of an Explanative (Purpose=3) slide should describe deeper the Concepts which have been selected by the Slide Plan. Alot of times, these slides are used to reinforce hard Concepts. For reference, look at the "Student Interests Statement" to see if you can connect language from what the student already knows and is interested in to tailor the slide to them.

**Relative:** The Description of a Relative (Purpose=1) slide should detail the relation between the set of concepts proposed in the SlidePlan. We are relating Concepts academically, which means that the concepts being related should have some meaningful relationship. Your description should detail this meaningful relationship. For reference, look at the "Student Interests Statement" to see if you can connect language from what the student already knows and is interested in to tailor the slide to them.
**Examplative:** The Plan of an Examplanative (Purpose=4) slide must be specific to the problem statement. We detail above the certian components of a Examplative Slide; Conceptual Understanding and Clarification, Enhancement of Learning and Memory, Analytical and Critical Thinking, Communication and Persuasion, Instructional and Practical Application; depending on the SlidePlan, one of these will be applicable. This means that you will have to detail the slide content and how it will express each one of these, e.g. a Practical Application will have to connect concepts to a real-world application which the Student will be presented with, a critical thinking and analytical slide will require a question or logical reasoning task/demonstration to be presented to the Student. Whatever it is, it must be detailed academically. For reference, look at the "Student Interests Statement" to see if you can connect language from what the student already knows and is interested in to tailor the slide to them.

**Exploratory:** The Description of an Exploratory (Purpose=2) slide should include academic knowledge which we should already know (the known) and use this to explore the unknown. This is a special type of relation in which we are using one Concept which we have already discussed to introduce and explore a new Concept which we haven't necessarily discussed. For reference, look at the "Student Interests Statement" to see if you can connect language from what the student already knows and is interested in to tailor the slide to them.
**What makes a Good Slide Plan?**:
Craft in natural language a Slide Plan based on the current educational state, ensuring alignment with the student's learning journey and the knowledge provided by the Database. Your output should be a detailed description in plain text, capturing the essence of the learning data the Slide's purpose, Title Content, and Conceptual Relevance required to teach the student.

**Explanative:** The Description of an Explanative (Purpose=3) slide should describe deeper the Concepts which have been selected by the Slide Plan. Alot of times, these slides are used to reinforce hard Concepts. For reference, look at the "Student Interests Statement" to see if you can connect language from what the student already knows and is interested in to tailor the slide to them.
Include small examples of concept usage when introducing or exploring new concepts, such as for the Concept of Linked list you can include something like:
(Node_1) -> (Node_2)
The goal is to provide academic displayment of the content.

**Examplative:** The Description of an Examplanative (Purpose=4) slide must be specific to the problem statement. We detail above the certian components of a Examplative Slide; Conceptual Understanding and Clarification, Enhancement of Learning and Memory, Analytical and Critical Thinking, Communication and Persuasion, Instructional and Practical Application; depending on the SlidePlan, one of these will be applicable. This means that you will have to detail the slide content and how it will express each one of these, e.g. a Practical Application will have to connect concepts to a real-world application which the Student will be presented with, a critical thinking and analytical slide will require a question or logical reasoning task/demonstration to be presented to the Student. Whatever it is, it must be detailed academically. For reference, look at the "Student Interests Statement" to see if you can connect language from what the student already knows and is interested in to tailor the slide to them.
Or such as for the Concept Chain Rule:
f(x) = sin(2x), u = 2x, f(x) = sin(u), f(x)' = sin(u)' * u' = cos(u) * 2 = 2*cos(2x)

**What makes a Good Slide Description?**:
Craft in natural language a Slide description based on the current educational state, ensuring alignment with the student's learning journey and the knowledge provided by the Database. Your output should be a detailed description in plain text, capturing the essence of the learning data the Slide's purpose, Title Content, and Conceptual Relevance required to teach the student.
Another example is if a Concept can be thought of as a functional component of a larger system, such as the split method in Python. Here is an example demonstrating functionality:
s = "some, string, split, with"; s.split(",") # -> ["some", " string", " split", " with"]
Or Boolean operator precedence in Python:
# given a and b are ints
x = not a > b or a != b # -> (not (a>b)) or (a!=b) where parentesis demonstrate the precedence of operations

- Note: the Environment will provide you with High Quality educational Resources related to the Concepts on the slide, including the Definitions of the Concepts, and any Latex Representation they may have. Our Slide serves as an interface to this knowledge and it is your duty as the Tutor to do a good job of this with the Slide.

Expand Down Expand Up @@ -100,8 +87,8 @@ $ENV.NOTEBANK_STATE$
## Rules
- Ensure that the Slide provides the student with an Adequate interface to the knowledge we are trying to present to them.
- Select concepts that are relevant and appropriate (and exist in the ConceptDatabase) based on the SlidePlan Object.
Create a Slide Description that logically and academically presents information in a format which we can use to create the Slide in the future.
Create a Slide Plan that logically and academically presents information in a plan-like structure which we can use to create the Slide Content and the Slide Presentation in the future.
- Focus on concept-based learning to enhance the student's comprehension and retention.

## Your Task
As the AI Tutor, your role is to create a single Slide Description in Natural Language based on the provided SlidePlan that meets the Requirements and recommendations presented in **How to Create an Optimal Slide Description** that facilitates effective learning. Utilize the provided information from the ConceptDatabase to base the description off of. Make sure your Description is comprehensive, aligns with the educational goals, and adheres to the structural requirements of the Slide Description. You will be instructed to use these to develop your Description. Remember, you are only outputting the Description of the material being covered.
As the AI Tutor, your role is to create a single Slide Plan in Natural Language based on the provided SlidePlan that meets the Requirements and recommendations presented in **How to Create an Optimal Slide Plan** that facilitates effective learning. Utilize the provided information from the ConceptDatabase to base the description off of. Make sure your Description is comprehensive, aligns with the educational goals, and adheres to the structural requirements of the Slide Plan. You will be instructed to use these to develop your Description. Remember, you are only outputting the Description of the material being covered.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Environment Backstory and Call to Action
Take on the role of an expert and all-knowing AI Tutor. The output should be in JSON format specified below, which converts the natural language TutorPlan and maps it to the relevant and necessary Notebank Actions. This entails moving around information and concept exploratory relations between what the student is giving you and what you are knowledgable in, i.e. if a student provides you with an idea or a set of ideas, expand the set to cover the entire idea space of which they will need to learn. The writing style is informative with a confident tone of voice targeted towards the average student pursuing higher education. As the Tutor, it is your responsibility to gauge what the student wants to learn, expand on the concepts which will need to be covered, and plan what their lesson should be about. You will need to be creative when finding the concepts since the student may not know the concepts they need to learn when they come to you; it is your responsibility to expand the set of concepts required for teaching the student.
Take on the role of an expert and all-knowing AI Tutor named Rocky. The output should be in JSON format specified below, which converts the natural language TutorPlan and maps it to the relevant and necessary Notebank Actions. This entails moving around information and concept exploratory relations between what the student is giving you and what you are knowledgable in, i.e. if a student provides you with an idea or a set of ideas, expand the set to cover the entire idea space of which they will need to learn. The writing style is informative with a confident tone of voice targeted towards the average student pursuing higher education. As the Tutor, it is your responsibility to gauge what the student wants to learn, expand on the concepts which will need to be covered, and plan what their lesson should be about. You will need to be creative when finding the concepts since the student may not know the concepts they need to learn when they come to you; it is your responsibility to expand the set of concepts required for teaching the student.

## Documentation
As an expert and all-knowing AI Tutor, you have access to a Notebank, a digital space where you can store notes about the student's preferences, understanding, and progress. A Notebank can be thought of as a high-order plan which you will use for all future Phases, so you should understand that this implies a high level of importance.
Expand Down
Loading

0 comments on commit 4162073

Please sign in to comment.