Merge pull request #1 from tools4ds/retargeting
Browse files- .bandit +2 -0
- .github/workflows/deploy_to_hf.yml +21 -0
- .gitignore +6 -3
- Dockerfile +31 -0
- README.md +88 -5
- apps/ai_tutor/.chainlit/config.toml +3 -3
- apps/ai_tutor/.env.example +11 -0
- apps/ai_tutor/__pycache__/app.cpython-311.pyc +0 -0
- apps/ai_tutor/__pycache__/chainlit_app.cpython-311.pyc +0 -0
- apps/ai_tutor/__pycache__/helpers.cpython-311.pyc +0 -0
- apps/ai_tutor/app.py +9 -2
- apps/ai_tutor/chainlit_app.py +7 -7
- apps/ai_tutor/config/__pycache__/config_manager.cpython-311.pyc +0 -0
- apps/ai_tutor/config/__pycache__/constants.cpython-311.pyc +0 -0
- apps/ai_tutor/config/__pycache__/prompts.cpython-311.pyc +0 -0
- apps/ai_tutor/config/config.yml +3 -3
- apps/ai_tutor/config/prompts.py +8 -8
- apps/ai_tutor/public/assets/images/avatars/ai-tutor.png +0 -0
- apps/ai_tutor/public/assets/images/avatars/ai_tutor.png +0 -0
- apps/ai_tutor/public/favicon.ico +0 -0
- apps/ai_tutor/public/files/test.css +23 -22
- apps/ai_tutor/public/logo_dark.png +0 -0
- apps/ai_tutor/public/logo_light.png +0 -0
- apps/ai_tutor/storage/data/urls.txt +2 -1
.bandit
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
[bandit]
|
2 |
+
skips = B104
|
.github/workflows/deploy_to_hf.yml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Push Production to HuggingFace
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches: [main, retargeting]
|
6 |
+
|
7 |
+
# run this workflow manualy from the Actions tab
|
8 |
+
workflow_dispatch:
|
9 |
+
|
10 |
+
jobs:
|
11 |
+
sync-to-hub:
|
12 |
+
runs-on: ubuntu-latest
|
13 |
+
steps:
|
14 |
+
- uses: actions/checkout@v4
|
15 |
+
with:
|
16 |
+
fetch-depth: 0
|
17 |
+
lfs: true
|
18 |
+
- name: Deploy Production (main) to HuggingFace
|
19 |
+
env:
|
20 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
21 |
+
run: git push --force https://faridkarimli:[email protected]/spaces/tools4ds/ai_tutor
|
.gitignore
CHANGED
@@ -1,12 +1,15 @@
|
|
1 |
**/vectorstores/*
|
2 |
**/private/students.json
|
3 |
.ragatouille/*
|
4 |
-
|
5 |
**/.chainlit/translations/*
|
6 |
-
storage/logs/*
|
7 |
-
vectorstores/*
|
8 |
**/apps/*/storage/logs/*
|
9 |
**/apps/*/private/*
|
10 |
*.log
|
11 |
**/.files/*
|
12 |
.env
|
|
|
|
|
|
|
|
1 |
**/vectorstores/*
|
2 |
**/private/students.json
|
3 |
.ragatouille/*
|
4 |
+
**/__pycache__/*
|
5 |
**/.chainlit/translations/*
|
6 |
+
**/storage/logs/*
|
7 |
+
**/vectorstores/*
|
8 |
**/apps/*/storage/logs/*
|
9 |
**/apps/*/private/*
|
10 |
*.log
|
11 |
**/.files/*
|
12 |
.env
|
13 |
+
*.pyc
|
14 |
+
venv/
|
15 |
+
apps
|
Dockerfile
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.11
|
2 |
+
|
3 |
+
# Change permissions to allow writing to the directory
|
4 |
+
RUN chmod -R 777 /apps/ai_tutor
|
5 |
+
|
6 |
+
WORKDIR /apps/ai_tutor
|
7 |
+
|
8 |
+
RUN pip install --upgrade pip
|
9 |
+
RUN pip install edubotics-core
|
10 |
+
|
11 |
+
# Create a logs directory and set permissions
|
12 |
+
RUN mkdir logs && chmod 777 logs
|
13 |
+
|
14 |
+
# Create a cache directory within the application's working directory
|
15 |
+
RUN mkdir /.cache && chmod -R 777 /.cache
|
16 |
+
|
17 |
+
# Expose the port the app runs on
|
18 |
+
EXPOSE 7860
|
19 |
+
|
20 |
+
RUN --mount=type=secret,id=HUGGINGFACEHUB_API_TOKEN,mode=0444,required=true
|
21 |
+
RUN --mount=type=secret,id=OPENAI_API_KEY,mode=0444,required=true
|
22 |
+
RUN --mount=type=secret,id=CHAINLIT_URL,mode=0444,required=true
|
23 |
+
RUN --mount=type=secret,id=LITERAL_API_URL,mode=0444,required=true
|
24 |
+
RUN --mount=type=secret,id=LLAMA_CLOUD_API_KEY,mode=0444,required=true
|
25 |
+
RUN --mount=type=secret,id=OAUTH_GOOGLE_CLIENT_ID,mode=0444,required=true
|
26 |
+
RUN --mount=type=secret,id=OAUTH_GOOGLE_CLIENT_SECRET,mode=0444,required=true
|
27 |
+
RUN --mount=type=secret,id=LITERAL_API_KEY_LOGGING,mode=0444,required=true
|
28 |
+
RUN --mount=type=secret,id=CHAINLIT_AUTH_SECRET,mode=0444,required=true
|
29 |
+
|
30 |
+
# Default command to run the application
|
31 |
+
CMD vectorstore_creator --config_file config/config.yml --project_config_file config/project_config.yml && python app.py --host 0.0.0.0 --port 7860
|
README.md
CHANGED
@@ -1,7 +1,90 @@
|
|
1 |
-
|
2 |
|
3 |
-
|
4 |
-
pip install edubotics-core
|
5 |
-
```
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# DS701: Tools for Data Science - Education Chatbot
|
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](https://tools4ds.github.io/DS701-Course-Notes/).
|
8 |
+
|
9 |
+
## Features
|
10 |
+
|
11 |
+
- 24/7 availability for student queries
|
12 |
+
- Explanations of key data science concepts
|
13 |
+
- Guidance on using data science tools and libraries
|
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. Set up environment variables. See `apps/ai_tutor/.env.example` for reference.
|
50 |
+
|
51 |
+
5. Run the chatbot
|
52 |
+
|
53 |
+
```python
|
54 |
+
cd apps/ai-tutor
|
55 |
+
python app.py
|
56 |
+
```
|
57 |
+
|
58 |
+
and navigate to localhost:8000 in your browser.
|
59 |
+
|
60 |
+
## Usage
|
61 |
+
|
62 |
+
Students can interact with the chatbot through the web interface.
|
63 |
+
|
64 |
+
Example queries:
|
65 |
+
|
66 |
+
- "Explain the concept of data normalization"
|
67 |
+
- "How do I use pandas for data manipulation?"
|
68 |
+
- "What's the difference between supervised and unsupervised learning?"
|
69 |
+
|
70 |
+
## Contributing
|
71 |
+
|
72 |
+
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:
|
73 |
+
|
74 |
+
1. Fork the repository and create your feature branch.
|
75 |
+
2. Make your changes, ensuring they align with the project's goals.
|
76 |
+
3. Submit a pull request with a clear description of your improvements.
|
77 |
+
|
78 |
+
For more detailed information on the contribution process, please refer to our `CONTRIBUTING.md` file (unavailable yet).
|
79 |
+
|
80 |
+
## Privacy and Data Handling
|
81 |
+
|
82 |
+
This chatbot is designed with student privacy in mind. No personal information is stored, and all interactions are anonymized. For more details, please refer to our `PRIVACY_POLICY.md`.
|
83 |
+
|
84 |
+
## Support
|
85 |
+
|
86 |
+
If you encounter any issues or have suggestions for improvement, please open an issue in this repository or contact the course instructor.
|
87 |
+
|
88 |
+
## License
|
89 |
+
|
90 |
+
This project is licensed under the MIT License - see the `LICENSE.md` file for details.
|
apps/ai_tutor/.chainlit/config.toml
CHANGED
@@ -53,10 +53,10 @@ edit_message = true
|
|
53 |
|
54 |
[UI]
|
55 |
# Name of the assistant.
|
56 |
-
name = "AI Tutor"
|
57 |
|
58 |
# Description of the assistant. This is used for HTML tags.
|
59 |
-
|
60 |
|
61 |
# Large size content are by default collapsed for a cleaner ui
|
62 |
default_collapse_content = true
|
@@ -65,7 +65,7 @@ default_collapse_content = true
|
|
65 |
cot = "hidden"
|
66 |
|
67 |
# Link to your github repo. This will add a github button in the UI's header.
|
68 |
-
github = "https://github.com/
|
69 |
|
70 |
# Specify a CSS file that can be used to customize the user interface.
|
71 |
# The CSS file can be served from the public directory or via an external link.
|
|
|
53 |
|
54 |
[UI]
|
55 |
# Name of the assistant.
|
56 |
+
name = "DS701 AI Tutor"
|
57 |
|
58 |
# Description of the assistant. This is used for HTML tags.
|
59 |
+
description = "Your AI tutor for DS701: Tools for Data Science. Here to assist you with course content, answer questions, and provide guidance on data science concepts."
|
60 |
|
61 |
# Large size content are by default collapsed for a cleaner ui
|
62 |
default_collapse_content = true
|
|
|
65 |
cot = "hidden"
|
66 |
|
67 |
# Link to your github repo. This will add a github button in the UI's header.
|
68 |
+
github = "https://github.com/tools4ds/ds701-tutor"
|
69 |
|
70 |
# Specify a CSS file that can be used to customize the user interface.
|
71 |
# The CSS file can be served from the public directory or via an external link.
|
apps/ai_tutor/.env.example
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
LLAMA_CLOUD_API_KEY=
|
2 |
+
OPENAI_API_KEY=
|
3 |
+
HF_TOKEN=
|
4 |
+
HUGGING_FACE_TOKEN=
|
5 |
+
LITERAL_API_KEY_LOGGING=
|
6 |
+
LITERAL_API_URL=https://cloud.getliteral.ai
|
7 |
+
CHAINLIT_AUTH_SECRET=
|
8 |
+
CHAINLIT_URL=http://localhost:8000
|
9 |
+
OAUTH_GOOGLE_CLIENT_ID=
|
10 |
+
OAUTH_GOOGLE_CLIENT_SECRET=
|
11 |
+
EMAIL_ENCRYPTION_KEY=
|
apps/ai_tutor/__pycache__/app.cpython-311.pyc
DELETED
Binary file (17.9 kB)
|
|
apps/ai_tutor/__pycache__/chainlit_app.cpython-311.pyc
DELETED
Binary file (25.3 kB)
|
|
apps/ai_tutor/__pycache__/helpers.cpython-311.pyc
DELETED
Binary file (3.96 kB)
|
|
apps/ai_tutor/app.py
CHANGED
@@ -25,6 +25,9 @@ from edubotics_core.chat_processor.helpers import get_user_details, update_user_
|
|
25 |
from config.config_manager import config_manager
|
26 |
import hashlib
|
27 |
|
|
|
|
|
|
|
28 |
# set config
|
29 |
config = config_manager.get_config().dict()
|
30 |
|
@@ -385,6 +388,10 @@ async def get_tokens_left(request: Request):
|
|
385 |
mount_chainlit(app=app, target="chainlit_app.py", path=CHAINLIT_PATH)
|
386 |
|
387 |
if __name__ == "__main__":
|
388 |
-
|
|
|
|
|
|
|
|
|
389 |
|
390 |
-
uvicorn.run(app, host=
|
|
|
25 |
from config.config_manager import config_manager
|
26 |
import hashlib
|
27 |
|
28 |
+
import uvicorn
|
29 |
+
import argparse
|
30 |
+
|
31 |
# set config
|
32 |
config = config_manager.get_config().dict()
|
33 |
|
|
|
388 |
mount_chainlit(app=app, target="chainlit_app.py", path=CHAINLIT_PATH)
|
389 |
|
390 |
if __name__ == "__main__":
|
391 |
+
parser = argparse.ArgumentParser(description="Run the AI Tutor application")
|
392 |
+
parser.add_argument("--host", default="0.0.0.0", help="Host to run the server on")
|
393 |
+
parser.add_argument("--port", type=int, default=7860,
|
394 |
+
help="Port to run the server on")
|
395 |
+
args = parser.parse_args()
|
396 |
|
397 |
+
uvicorn.run(app, host=args.host, port=args.port)
|
apps/ai_tutor/chainlit_app.py
CHANGED
@@ -239,23 +239,23 @@ class Chatbot:
|
|
239 |
print(e)
|
240 |
return [
|
241 |
cl.Starter(
|
242 |
-
label="
|
243 |
-
message="
|
244 |
icon="/public/assets/images/starter_icons/adv-screen-recorder-svgrepo-com.svg",
|
245 |
),
|
246 |
cl.Starter(
|
247 |
-
label="
|
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="
|
253 |
-
message="When
|
254 |
icon="/public/assets/images/starter_icons/calendar-samsung-17-svgrepo-com.svg",
|
255 |
),
|
256 |
cl.Starter(
|
257 |
-
label="Explain
|
258 |
-
message="I didn't understand the math behind
|
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/__pycache__/config_manager.cpython-311.pyc
DELETED
Binary file (11.7 kB)
|
|
apps/ai_tutor/config/__pycache__/constants.cpython-311.pyc
DELETED
Binary file (1.33 kB)
|
|
apps/ai_tutor/config/__pycache__/prompts.cpython-311.pyc
DELETED
Binary file (6.98 kB)
|
|
apps/ai_tutor/config/config.yml
CHANGED
@@ -3,12 +3,12 @@ log_chunk_dir: 'storage/logs/chunks' # str
|
|
3 |
device: 'cpu' # str [cuda, cpu]
|
4 |
|
5 |
vectorstore:
|
6 |
-
load_from_HF:
|
7 |
reparse_files: True # bool
|
8 |
data_path: 'storage/data' # str
|
9 |
url_file_path: 'storage/data/urls.txt' # str
|
10 |
expand_urls: True # bool
|
11 |
-
db_option : '
|
12 |
db_path : 'vectorstores' # str
|
13 |
model : 'sentence-transformers/all-MiniLM-L6-v2' # str [sentence-transformers/all-MiniLM-L6-v2, text-embedding-ada-002']
|
14 |
search_top_k : 3 # int
|
@@ -39,7 +39,7 @@ llm_params:
|
|
39 |
filename: 'tinyllama-1.1b-chat-v1.0.Q5_0.gguf' # Specific name of gguf file in the repo
|
40 |
model_path: 'storage/models/tinyllama-1.1b-chat-v1.0.Q5_0.gguf' # Path to the model file
|
41 |
stream: False # bool
|
42 |
-
pdf_reader: '
|
43 |
|
44 |
chat_logging:
|
45 |
log_chat: True # bool
|
|
|
3 |
device: 'cpu' # str [cuda, cpu]
|
4 |
|
5 |
vectorstore:
|
6 |
+
load_from_HF: False # bool
|
7 |
reparse_files: True # bool
|
8 |
data_path: 'storage/data' # str
|
9 |
url_file_path: 'storage/data/urls.txt' # str
|
10 |
expand_urls: True # bool
|
11 |
+
db_option : 'FAISS' # str [FAISS, Chroma, RAGatouille, RAPTOR]
|
12 |
db_path : 'vectorstores' # str
|
13 |
model : 'sentence-transformers/all-MiniLM-L6-v2' # str [sentence-transformers/all-MiniLM-L6-v2, text-embedding-ada-002']
|
14 |
search_top_k : 3 # int
|
|
|
39 |
filename: 'tinyllama-1.1b-chat-v1.0.Q5_0.gguf' # Specific name of gguf file in the repo
|
40 |
model_path: 'storage/models/tinyllama-1.1b-chat-v1.0.Q5_0.gguf' # Path to the model file
|
41 |
stream: False # bool
|
42 |
+
pdf_reader: 'pymupdf' # str [llama, pymupdf, gpt]
|
43 |
|
44 |
chat_logging:
|
45 |
log_chat: True # bool
|
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
|
9 |
-
"Example: Do not rephrase if the user is asking something specific like 'cool, suggest a project with
|
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
|
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
|
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
|
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
|
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
|
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
|
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/public/assets/images/avatars/ai-tutor.png
DELETED
Binary file (169 kB)
|
|
apps/ai_tutor/public/assets/images/avatars/ai_tutor.png
DELETED
Binary file (169 kB)
|
|
apps/ai_tutor/public/favicon.ico
ADDED
|
apps/ai_tutor/public/files/test.css
CHANGED
@@ -1,32 +1,33 @@
|
|
1 |
-
a[href*='https://github.com/Chainlit/chainlit']
|
2 |
-
|
|
|
3 |
}
|
4 |
|
5 |
-
/* Hide the default avatar image */
|
6 |
.MuiAvatar-root img.MuiAvatar-img {
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
/* Target the container of the image and set a custom background image */
|
11 |
.MuiAvatar-root.MuiAvatar-circular.css-m2icte {
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
}
|
19 |
.MuiAvatar-root.MuiAvatar-circular.css-v72an7 {
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
}
|
27 |
|
28 |
.MuiStack-root.css-14k6mw7 img {
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
}
|
|
|
1 |
+
a[href*='https://github.com/Chainlit/chainlit']
|
2 |
+
{
|
3 |
+
visibility: hidden;
|
4 |
}
|
5 |
|
6 |
+
/* Hide the default avatar image */
|
7 |
.MuiAvatar-root img.MuiAvatar-img {
|
8 |
+
display: none;
|
9 |
+
}
|
10 |
+
|
11 |
/* Target the container of the image and set a custom background image */
|
12 |
.MuiAvatar-root.MuiAvatar-circular.css-m2icte {
|
13 |
+
background-image: url("/public/assets/images/avatars/logo.png"); /* Replace with your custom image URL */
|
14 |
+
background-size: cover; /* Ensure the image covers the entire container */
|
15 |
+
background-position: center; /* Center the image */
|
16 |
+
width: 100px; /* Ensure the dimensions match the original */
|
17 |
+
height: 100px; /* Ensure the dimensions match the original */
|
18 |
+
border-radius: 50%; /* Maintain circular shape */
|
19 |
}
|
20 |
.MuiAvatar-root.MuiAvatar-circular.css-v72an7 {
|
21 |
+
background-image: url("/public/assets/images/avatars/logo.png"); /* Replace with your custom image URL */
|
22 |
+
background-size: cover; /* Ensure the image covers the entire container */
|
23 |
+
background-position: center; /* Center the image */
|
24 |
+
width: 40px; /* Ensure the dimensions match the original */
|
25 |
+
height: 40px; /* Ensure the dimensions match the original */
|
26 |
+
border-radius: 50%; /* Maintain circular shape */
|
27 |
}
|
28 |
|
29 |
.MuiStack-root.css-14k6mw7 img {
|
30 |
+
content: url("/public/assets/images/avatars/logo.png"); /* Replace with the path to your custom image */
|
31 |
+
max-height: 45px; /* Ensure the height remains consistent */
|
32 |
+
max-width: 45px; /* Ensure the width remains consistent */
|
33 |
+
}
|
apps/ai_tutor/public/logo_dark.png
CHANGED
![]() |
![]() |
apps/ai_tutor/public/logo_light.png
CHANGED
![]() |
![]() |
apps/ai_tutor/storage/data/urls.txt
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
https://
|
|
|
|
1 |
+
https://tools4ds.github.io/fa2024/
|
2 |
+
https://tools4ds.github.io/DS701-Course-Notes/
|