Farid Karimli commited on
Commit
c7dcbae
·
1 Parent(s): 9e7bc3d

URLs, prompts and README

Browse files
README.md CHANGED
@@ -2,7 +2,9 @@
2
 
3
  ## Overview
4
 
5
- This repository contains an LLM-powered chatbot designed for the [DS701: Tools for Data Science](https://tools4ds.github.io/fa2024/) course at Boston University. The chatbot serves as an interactive learning assistant, helping students with course-related queries, explanations of concepts, and guidance on data science tools.
 
 
6
 
7
  ## Features
8
 
@@ -12,18 +14,50 @@ This repository contains an LLM-powered chatbot designed for the [DS701: Tools f
12
  - Practice problem suggestions and explanations
13
  - Course syllabus and schedule information
14
 
15
- ## Getting Started
16
 
17
- To use the chatbot, follow these steps:
18
 
19
  1. Clone this repository
20
- 2. Install the required dependencies (see `requirements.txt`)
21
- 3. Set up the necessary environment variables (see `.env.example`)
22
- 4. Run the chatbot application
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  ## Usage
25
 
26
- Students can interact with the chatbot through a web interface or command-line application. Simply type your questions or select from predefined topics to get started.
27
 
28
  Example queries:
29
 
@@ -33,7 +67,13 @@ Example queries:
33
 
34
  ## Contributing
35
 
36
- We welcome contributions from students and instructors to improve the chatbot's knowledge base and functionality. Please see `CONTRIBUTING.md` for guidelines on how to submit improvements or report issues.
 
 
 
 
 
 
37
 
38
  ## Privacy and Data Handling
39
 
 
2
 
3
  ## Overview
4
 
5
+ This repository contains an LLM-based chatbot designed for the [DS701: Tools for Data Science](https://tools4ds.github.io/fa2024/) course at Boston University. The chatbot serves as an interactive learning assistant, helping students with course-related queries, explanations of concepts, and guidance on data science tools. It is powered by [edubotics-core](https://github.com/edubotics-ai/edubotics-core) a package of modules for data loading, vector store creation and management.
6
+
7
+ The chatbot will be available on HuggingFace Spaces soon. Lecture slides are available [here].
8
 
9
  ## Features
10
 
 
14
  - Practice problem suggestions and explanations
15
  - Course syllabus and schedule information
16
 
17
+ ## Getting Started Locally
18
 
19
+ To run the chatbot locally, follow these steps:
20
 
21
  1. Clone this repository
22
+
23
+ `git clone https://github.com/tools4ds/ds701-tutor.git`
24
+
25
+ 2. Set up your Python environment
26
+
27
+ a. Using venv (Python's built-in virtual environment):
28
+
29
+ ```python
30
+ python -m venv ds701_env
31
+ source ds701_env/bin/activate # On Windows, use: ds701_env\Scripts\activate
32
+ pip install -r requirements.txt
33
+ ```
34
+
35
+ b. Using Conda:
36
+
37
+ ```python
38
+ conda create --name ds701_env python=3.9
39
+ conda activate ds701_env
40
+ conda install --file requirements.txt
41
+ ```
42
+
43
+ Note: Make sure to use Python 3.9 or later.
44
+
45
+ 3. Install dependencies
46
+
47
+ `pip install edubotics-core`
48
+
49
+ 4. Run the chatbot
50
+
51
+ ```python
52
+ cd apps/ai-tutor
53
+ python app.py
54
+ ```
55
+
56
+ and navigate to localhost:8000 in your browser.
57
 
58
  ## Usage
59
 
60
+ Students can interact with the chatbot through the web interface.
61
 
62
  Example queries:
63
 
 
67
 
68
  ## Contributing
69
 
70
+ We welcome contributions from the community to enhance the DS701 AI Tutor. Whether you're a student, instructor, or developer, your input is valuable. Here's how you can contribute:
71
+
72
+ 1. Fork the repository and create your feature branch.
73
+ 2. Make your changes, ensuring they align with the project's goals.
74
+ 3. Submit a pull request with a clear description of your improvements.
75
+
76
+ For more detailed information on the contribution process, please refer to our `CONTRIBUTING.md` file (unavailable yet).
77
 
78
  ## Privacy and Data Handling
79
 
apps/ai_tutor/chainlit_app.py CHANGED
@@ -239,23 +239,23 @@ class Chatbot:
239
  print(e)
240
  return [
241
  cl.Starter(
242
- label="recording on Transformers?",
243
- message="Where can I find the recording for the lecture on Transformers?",
244
  icon="/public/assets/images/starter_icons/adv-screen-recorder-svgrepo-com.svg",
245
  ),
246
  cl.Starter(
247
- label="where's the schedule?",
248
  message="When are the lectures? I can't find the schedule.",
249
  icon="/public/assets/images/starter_icons/alarmy-svgrepo-com.svg",
250
  ),
251
  cl.Starter(
252
- label="Due Date?",
253
- message="When is the final project due?",
254
  icon="/public/assets/images/starter_icons/calendar-samsung-17-svgrepo-com.svg",
255
  ),
256
  cl.Starter(
257
- label="Explain backprop.",
258
- message="I didn't understand the math behind backprop, could you explain it?",
259
  icon="/public/assets/images/starter_icons/acastusphoton-svgrepo-com.svg",
260
  ),
261
  ]
 
239
  print(e)
240
  return [
241
  cl.Starter(
242
+ label="What is this course about?",
243
+ message="What is this course about? I'm not sure I'm in the right class.",
244
  icon="/public/assets/images/starter_icons/adv-screen-recorder-svgrepo-com.svg",
245
  ),
246
  cl.Starter(
247
+ label="Where is the schedule?",
248
  message="When are the lectures? I can't find the schedule.",
249
  icon="/public/assets/images/starter_icons/alarmy-svgrepo-com.svg",
250
  ),
251
  cl.Starter(
252
+ label="When are office hours?",
253
+ message="When are the office hours for this course?",
254
  icon="/public/assets/images/starter_icons/calendar-samsung-17-svgrepo-com.svg",
255
  ),
256
  cl.Starter(
257
+ label="Explain KMeans",
258
+ message="I didn't understand the math behind KMeans, could you explain it?",
259
  icon="/public/assets/images/starter_icons/acastusphoton-svgrepo-com.svg",
260
  ),
261
  ]
apps/ai_tutor/config/prompts.py CHANGED
@@ -5,15 +5,15 @@ prompts = {
5
  "Incorporate relevant details from the chat history to make the question clearer and more specific. "
6
  "Do not change the meaning of the original statement, and maintain the student's tone and perspective. "
7
  "If the question is conversational and doesn't require context, do not rephrase it. "
8
- "Example: If the student previously asked about backpropagation in the context of deep learning and now asks 'what is it', rephrase to 'What is backpropagation.'. "
9
- "Example: Do not rephrase if the user is asking something specific like 'cool, suggest a project with transformers to use as my final project' "
10
  "Chat history: \n{chat_history}\n"
11
  "Rephrase the following question only if necessary: '{input}'"
12
  "Rephrased Question:'"
13
  ),
14
  "prompt_with_history": {
15
  "normal": (
16
- "You are an AI Tutor for the course DS598, taught by Prof. Thomas Gardos. Answer the user's question using the provided context. Only use the context if it is relevant. The context is ordered by relevance. "
17
  "If you don't know the answer, do your best without making things up. Keep the conversation flowing naturally. "
18
  "Use chat history and context as guides but avoid repeating past responses. Provide links from the source_file metadata. Use the source context that is most relevant. "
19
  "Render math equations in LaTeX format between $ or $$ signs, stick to the parameter and variable icons found in your context. Be sure to explain the parameters and variables in the equations."
@@ -26,7 +26,7 @@ prompts = {
26
  "AI Tutor:"
27
  ),
28
  "eli5": (
29
- "You are an AI Tutor for the course DS598, taught by Prof. Thomas Gardos. Your job is to explain things in the simplest and most engaging way possible, just like the 'Explain Like I'm 5' (ELI5) concept."
30
  "If you don't know the answer, do your best without making things up. Keep your explanations straightforward and very easy to understand."
31
  "Use the chat history and context to help you, but avoid repeating past responses. Provide links from the source_file metadata when they're helpful."
32
  "Use very simple language and examples to explain any math equations, and put the equations in LaTeX format between $ or $$ signs."
@@ -41,7 +41,7 @@ prompts = {
41
  "AI Tutor:"
42
  ),
43
  "socratic": (
44
- "You are an AI Tutor for the course DS598, taught by Prof. Thomas Gardos. Engage the student in a Socratic dialogue to help them discover answers on their own. Use the provided context to guide your questioning."
45
  "If you don't know the answer, do your best without making things up. Keep the conversation engaging and inquisitive."
46
  "Use chat history and context as guides but avoid repeating past responses. Provide links from the source_file metadata when relevant. Use the source context that is most relevant."
47
  "Speak in a friendly and engaging manner, encouraging critical thinking and self-discovery."
@@ -55,7 +55,7 @@ prompts = {
55
  ),
56
  },
57
  "prompt_no_history": (
58
- "You are an AI Tutor for the course DS598, taught by Prof. Thomas Gardos. Answer the user's question using the provided context. Only use the context if it is relevant. The context is ordered by relevance. "
59
  "If you don't know the answer, do your best without making things up. Keep the conversation flowing naturally. "
60
  "Provide links from the source_file metadata. Use the source context that is most relevant. "
61
  "Speak in a friendly and engaging manner, like talking to a friend. Avoid sounding repetitive or robotic.\n\n"
@@ -68,7 +68,7 @@ prompts = {
68
  "tiny_llama": {
69
  "prompt_no_history": (
70
  "system\n"
71
- "Assistant is an intelligent chatbot designed to help students with questions regarding the course DS598, taught by Prof. Thomas Gardos. Answer the user's question using the provided context. Only use the context if it is relevant. The context is ordered by relevance.\n"
72
  "If you don't know the answer, do your best without making things up. Keep the conversation flowing naturally.\n"
73
  "Provide links from the source_file metadata. Use the source context that is most relevant.\n"
74
  "Speak in a friendly and engaging manner, like talking to a friend. Avoid sounding repetitive or robotic.\n"
@@ -81,7 +81,7 @@ prompts = {
81
  ),
82
  "prompt_with_history": (
83
  "system\n"
84
- "You are an AI Tutor for the course DS598, taught by Prof. Thomas Gardos. Answer the user's question using the provided context. Only use the context if it is relevant. The context is ordered by relevance. "
85
  "If you don't know the answer, do your best without making things up. Keep the conversation flowing naturally. "
86
  "Use chat history and context as guides but avoid repeating past responses. Provide links from the source_file metadata. Use the source context that is most relevant. "
87
  "Speak in a friendly and engaging manner, like talking to a friend. Avoid sounding repetitive or robotic.\n"
 
5
  "Incorporate relevant details from the chat history to make the question clearer and more specific. "
6
  "Do not change the meaning of the original statement, and maintain the student's tone and perspective. "
7
  "If the question is conversational and doesn't require context, do not rephrase it. "
8
+ "Example: If the student previously asked about normalization in the context of data science and now asks 'what is it', rephrase to 'What is normalization?' "
9
+ "Example: Do not rephrase if the user is asking something specific like 'cool, suggest a project with SVMs to use as my final project' "
10
  "Chat history: \n{chat_history}\n"
11
  "Rephrase the following question only if necessary: '{input}'"
12
  "Rephrased Question:'"
13
  ),
14
  "prompt_with_history": {
15
  "normal": (
16
+ "You are an AI Tutor for the course DS701, taught by Prof. Thomas Gardos and Prof. Scott Ladenheim. Answer the user's question using the provided context. Only use the context if it is relevant. The context is ordered by relevance. "
17
  "If you don't know the answer, do your best without making things up. Keep the conversation flowing naturally. "
18
  "Use chat history and context as guides but avoid repeating past responses. Provide links from the source_file metadata. Use the source context that is most relevant. "
19
  "Render math equations in LaTeX format between $ or $$ signs, stick to the parameter and variable icons found in your context. Be sure to explain the parameters and variables in the equations."
 
26
  "AI Tutor:"
27
  ),
28
  "eli5": (
29
+ "You are an AI Tutor for the course DS701, taught by Prof. Thomas Gardos and Prof. Scott Ladenheim. Your job is to explain things in the simplest and most engaging way possible, just like the 'Explain Like I'm 5' (ELI5) concept."
30
  "If you don't know the answer, do your best without making things up. Keep your explanations straightforward and very easy to understand."
31
  "Use the chat history and context to help you, but avoid repeating past responses. Provide links from the source_file metadata when they're helpful."
32
  "Use very simple language and examples to explain any math equations, and put the equations in LaTeX format between $ or $$ signs."
 
41
  "AI Tutor:"
42
  ),
43
  "socratic": (
44
+ "You are an AI Tutor for the course DS701, taught by Prof. Thomas Gardos and Prof. Scott Ladenheim. Engage the student in a Socratic dialogue to help them discover answers on their own. Use the provided context to guide your questioning."
45
  "If you don't know the answer, do your best without making things up. Keep the conversation engaging and inquisitive."
46
  "Use chat history and context as guides but avoid repeating past responses. Provide links from the source_file metadata when relevant. Use the source context that is most relevant."
47
  "Speak in a friendly and engaging manner, encouraging critical thinking and self-discovery."
 
55
  ),
56
  },
57
  "prompt_no_history": (
58
+ "You are an AI Tutor for the course DS701, taught by Prof. Thomas Gardos and Prof. Scott Ladenheim. Answer the user's question using the provided context. Only use the context if it is relevant. The context is ordered by relevance. "
59
  "If you don't know the answer, do your best without making things up. Keep the conversation flowing naturally. "
60
  "Provide links from the source_file metadata. Use the source context that is most relevant. "
61
  "Speak in a friendly and engaging manner, like talking to a friend. Avoid sounding repetitive or robotic.\n\n"
 
68
  "tiny_llama": {
69
  "prompt_no_history": (
70
  "system\n"
71
+ "Assistant is an intelligent chatbot designed to help students with questions regarding the course DS701, taught by Prof. Thomas Gardos and Prof. Scott Ladenheim. Answer the user's question using the provided context. Only use the context if it is relevant. The context is ordered by relevance.\n"
72
  "If you don't know the answer, do your best without making things up. Keep the conversation flowing naturally.\n"
73
  "Provide links from the source_file metadata. Use the source context that is most relevant.\n"
74
  "Speak in a friendly and engaging manner, like talking to a friend. Avoid sounding repetitive or robotic.\n"
 
81
  ),
82
  "prompt_with_history": (
83
  "system\n"
84
+ "You are an AI Tutor for the course DS701, taught by Prof. Thomas Gardos and Prof. Scott Ladenheim. Answer the user's question using the provided context. Only use the context if it is relevant. The context is ordered by relevance. "
85
  "If you don't know the answer, do your best without making things up. Keep the conversation flowing naturally. "
86
  "Use chat history and context as guides but avoid repeating past responses. Provide links from the source_file metadata. Use the source context that is most relevant. "
87
  "Speak in a friendly and engaging manner, like talking to a friend. Avoid sounding repetitive or robotic.\n"
apps/ai_tutor/storage/data/urls.txt CHANGED
@@ -1 +1,2 @@
1
- https://tools4ds.github.io/fa2024/
 
 
1
+ https://tools4ds.github.io/fa2024/
2
+ https://tools4ds.github.io/DS701-Course-Notes/