Skip to content

Commit

Permalink
partially working version of StudentPersonaGPT
Browse files Browse the repository at this point in the history
  • Loading branch information
ebeastlake committed Mar 12, 2024
1 parent 54d25b7 commit c864e74
Show file tree
Hide file tree
Showing 10 changed files with 542 additions and 724 deletions.
280 changes: 75 additions & 205 deletions AliceBobCindy.py

Large diffs are not rendered by default.

33 changes: 6 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
# Introducing SocraticAI
## How to Use This Repo

Discover Socratic AI, a groundbreaking application that transforms problem-solving by leveraging the power of multiple Large Language Model-based agents in Socratic dialogue. Socratic AI elevates artificial intelligence, providing a distinctive and engaging experience that empowers users to uncover comprehensive and well-reasoned solutions to their challenges, all while remaining free from prompt engineering.

**Disclaimer**: All code and content are generated by large language models.

### Demo Video

Check out this demo video to see SocraticAI in action:

[Watch the SocraticAI Demo Video on Vimeo](https://vimeo.com/821089266)


## Understanding the Socratic Method

The term "Socratic" is derived from the name of the ancient Greek philosopher Socrates. Socratic dialogue is a cooperative argumentative dialogue that aims to stimulate critical thinking and elicit ideas and underlying assumptions. It involves a series of questions and answers designed to examine complex issues from various perspectives. The goal is not to win an argument or establish a single "correct" answer, but to collaboratively explore the subject matter, challenge preconceptions, and enhance understanding.

### Harnessing Socratic Dialogue with AI

Socratic AI employs this powerful technique by engaging multiple AI agents in conversation with each other and the user, without the need for prompt engineering. By simulating a Socratic dialogue, these AI agents can scrutinize diverse aspects of a problem, analyze multiple angles, and generate a wide range of potential solutions. The outcome is a more comprehensive and well-rounded understanding of the issue, ultimately guiding users toward better-informed decisions and effective solutions. Unleash the power of collective intelligence with Socratic AI, your premier tool for problem-solving, insight generation, and knowledge expansion.

## How to Use SocraticAI

To get started with SocraticAI, follow these simple steps:
To get started, follow these steps:

1. Install the required packages by running the following command in your terminal:

```
pip install -r requirements.txt
pip3 install -r requirements.txt
```

2. Ensure that you have the necessary API keys for OpenAI and Wolfram Alpha by setting the following environment variables:
Expand All @@ -40,9 +19,9 @@ export WOLFRAM_APP_ID="your-wolfram-alpha-key"
3. Run the web application by executing the following command in your terminal:

```
python app.py
python3 app.py
```

4. Access the SocraticAI web app by opening your web browser and navigating to the following address: `http://127.0.0.1:5000/`. We recommend using Google Chrome for the best user experience.
4. Access the web app by opening your browser and navigating to the address [http://127.0.0.1:5000/](http://127.0.0.1:5000/). We recommend using Google Chrome for the best user experience.

Now you're all set to explore the power of Socratic dialogue and AI-driven problem-solving with SocraticAI!
Now, you're all set to explore the power of Socratic dialogue and AI-driven problem-solving with SocraticAI!
335 changes: 74 additions & 261 deletions app.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions prompts/ai_tutor_system_prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
You are an assistant for a student in an Advanced Placement Computer Science course, learning the Java programming language.\r\n\r\nAnswer the student's questions concisely.\r\nDo not answer questions on other topics.\r\nDo not include code in any of your responses. \r\nThe student may provide code to seek assistance in compiler errors or other issues. In those circumstances, refer to their code but do not rewrite it to provide a solution."
1 change: 1 addition & 0 deletions prompts/proofreader_system_prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"The above is the conversation between Socrates and Theaetetus. You job is to challenge their anwers. They were likely to have made multiple mistakes. Please correct them. \nRemember to start your answer with "NO" if you think so far their discussion is alright, otherwise start with \"Here are my suggestions:\""
1 change: 1 addition & 0 deletions prompts/student_persona_system_prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"You are playing the role of a student who is not very interested in the current study subject. You prefer to talk about anything but the lesson at hand, often diverting the conversation to your personal interests, hobbies, or random thoughts that cross your mind. Your responses should reflect a friendly but easily distracted nature, showing curiosity and enthusiasm for various topics unrelated to the educational content being discussed. Remember, your main characteristic is that you're more eager to engage in casual, off-topic conversations rather than focusing on the lesson or academic questions posed by the AI tutor. Try to steer the conversation away from study materials by asking questions or sharing thoughts about subjects like movies, sports, video games, or any fun fact you find interesting."
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Flask==2.2.3
Flask==3.0.2
requests==2.25.1
Flask-Session==0.4.0
openai==0.27.4
wolframalpha==5.0.0
python-dotenv
129 changes: 129 additions & 0 deletions static/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@500&display=swap");

body {
font-family: Futura, sans-serif;
font-size: 0.8rem;
background-color: #212529;
color: #f8f9fa;
}
#chat-container {
width: 80%;
max-width: 900px;
margin: 2rem auto;
}
#chat-history {
height: 600px;
border: 1px solid #ccc;
overflow-y: scroll;
padding: 10px;
background-color: #343a40;
}
.manual-chat-controls {
display: none; /* Hide manual chat controls by default */
}
#user-input {
width: 100%;
box-sizing: border-box;
}
p {
margin: 3px 0;
}
h1 {
font-family: "Quicksand", sans-serif;
font-size: 2.5rem;
color: #ffffff;
}
.typing-animation {
display: inline-block;
position: relative;
bottom: -0.1em;
margin-left: 0.1em;
font-size: 1rem;
animation: typing 0.02s steps(4) 0s infinite;
}
@keyframes typing {
0% {
width: 0.1em;
}
50% {
width: 0.6em;
}
100% {
width: 0.1em;
}
}
.message-sender {
font-weight: bold;
}
.message-content {
display: inline;
}
/* Additional styling and animation */
body::after {
content: "";
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: radial-gradient(
circle,
rgba(255, 255, 255, 0.05),
rgba(255, 255, 255, 0.05),
rgba(0, 0, 0, 0.3),
rgba(0, 0, 0, 0.3)
);
background-size: 50px 50px;
z-index: -1;
animation: intelligent-bg 15s linear infinite;
}
@keyframes intelligent-bg {
0% {
background-position: 0 0;
}
100% {
background-position: 400px 0;
}
}
/* User message colors */
.ai-tutor-message {
margin-bottom: 8px;
color: #e74c3c;
}
.student-persona-message {
margin-bottom: 8px;
color: #3498db;
}
.proofreader-message {
margin-bottom: 8px;
color: #f1c40f;
}
.system-message {
text-align: center;
margin-bottom: 6px;
color: #94928e;
}
/* Copy button styling */
.copy-code-btn {
position: absolute;
top: 0;
right: 0;
background-color: #f8f9fa;
color: #212529;
border: none;
border-radius: 4px;
padding: 4px 8px;
font-size: 10px;
cursor: pointer;
opacity: 0;
transition: opacity 0.2s ease-in-out;
z-index: 10;
}

.hljs {
position: relative;
}

.hljs:hover .copy-code-btn {
opacity: 1;
}
Loading

0 comments on commit c864e74

Please sign in to comment.