Spaces:
Build error
Build error
XThomasBU
commited on
Commit
Β·
d92c997
1
Parent(s):
a8421b2
initial commit
Browse filesThis view is limited to 50 files because it contains too many changes. Β
See raw diff
- .gitignore +7 -1
- {code β apps/ai_tutor}/.chainlit/config.toml +8 -8
- {code β apps/ai_tutor}/app.py +7 -0
- {code/modules β apps/ai_tutor}/config/config.yml +0 -0
- {code/modules β apps/ai_tutor}/config/project_config.yml +0 -0
- {code β apps/ai_tutor}/main.py +2 -2
- {code β apps/ai_tutor}/public/acastusphoton-svgrepo-com.svg +0 -0
- {code β apps/ai_tutor}/public/adv-screen-recorder-svgrepo-com.svg +0 -0
- {code β apps/ai_tutor}/public/alarmy-svgrepo-com.svg +0 -0
- {code β apps/ai_tutor}/public/avatars/ai_tutor.png +0 -0
- {code β apps/ai_tutor}/public/calendar-samsung-17-svgrepo-com.svg +0 -0
- {code β apps/ai_tutor}/public/logo_dark.png +0 -0
- {code β apps/ai_tutor}/public/logo_light.png +0 -0
- {code β apps/ai_tutor}/public/space.jpg +0 -0
- {code β apps/ai_tutor}/public/test.css +0 -0
- {storage β apps/ai_tutor/storage}/data/urls.txt +0 -0
- {code β apps/ai_tutor}/templates/cooldown.html +0 -0
- {code β apps/ai_tutor}/templates/dashboard.html +0 -0
- {code β apps/ai_tutor}/templates/error.html +0 -0
- {code β apps/ai_tutor}/templates/error_404.html +0 -0
- {code β apps/ai_tutor}/templates/login.html +0 -0
- {code β apps/ai_tutor}/templates/logout.html +0 -0
- apps/chainlit_base/.chainlit/config.toml +120 -0
- apps/chainlit_base/chainlit.md +14 -0
- {code β apps/chainlit_base}/chainlit_base.py +2 -2
- apps/chainlit_base/config/config.yml +60 -0
- apps/chainlit_base/config/project_config.yml +7 -0
- code/chainlit.md +0 -5
- {code/modules β modules}/__init__.py +0 -0
- {code/modules β modules}/chat/__init__.py +0 -0
- {code/modules β modules}/chat/base.py +0 -0
- {code/modules β modules}/chat/chat_model_loader.py +0 -0
- {code/modules β modules}/chat/helpers.py +1 -1
- {code/modules β modules}/chat/langchain/__init__.py +0 -0
- {code/modules β modules}/chat/langchain/langchain_rag.py +0 -0
- {code/modules β modules}/chat/langchain/utils.py +0 -0
- {code/modules β modules}/chat/llm_tutor.py +0 -0
- {code/modules β modules}/chat_processor/__init__.py +0 -0
- {code/modules β modules}/chat_processor/helpers.py +0 -0
- {code/modules β modules}/chat_processor/literal_ai.py +0 -0
- {code/modules β modules}/config/__init__.py +0 -0
- code/modules/dataloader/__init__.py β modules/config/config_manager.py +0 -0
- {code/modules β modules}/config/constants.py +0 -0
- {code/modules β modules}/config/prompts.py +0 -0
- {code/modules/retriever β modules/dataloader}/__init__.py +0 -0
- {code/modules β modules}/dataloader/data_loader.py +0 -0
- {code/modules β modules}/dataloader/helpers.py +1 -1
- {code/modules β modules}/dataloader/pdf_readers/base.py +0 -0
- {code/modules β modules}/dataloader/pdf_readers/gpt.py +0 -0
- {code/modules β modules}/dataloader/pdf_readers/llama.py +0 -0
.gitignore
CHANGED
|
@@ -169,5 +169,11 @@ code/.chainlit/translations/
|
|
| 169 |
storage/logs/*
|
| 170 |
vectorstores/*
|
| 171 |
|
| 172 |
-
|
| 173 |
code/storage/models/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
storage/logs/*
|
| 170 |
vectorstores/*
|
| 171 |
|
| 172 |
+
**/.files/*
|
| 173 |
code/storage/models/
|
| 174 |
+
|
| 175 |
+
**/translations/en-US.json
|
| 176 |
+
**/translations/zh-CN.json
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
**/vectorstores/*
|
{code β apps/ai_tutor}/.chainlit/config.toml
RENAMED
|
@@ -20,10 +20,10 @@ allow_origins = ["*"]
|
|
| 20 |
|
| 21 |
[features]
|
| 22 |
# Process and display HTML in messages. This can be a security risk (see https://stackoverflow.com/questions/19603097/why-is-it-dangerous-to-render-user-generated-html-or-javascript)
|
| 23 |
-
unsafe_allow_html =
|
| 24 |
|
| 25 |
# Process and display mathematical expressions. This can clash with "$" characters in messages.
|
| 26 |
-
latex =
|
| 27 |
|
| 28 |
# Automatically tag threads with the current chat profile (if a chat profile is used)
|
| 29 |
auto_tag_thread = true
|
|
@@ -53,7 +53,7 @@ edit_message = true
|
|
| 53 |
|
| 54 |
[UI]
|
| 55 |
# Name of the assistant.
|
| 56 |
-
name = "
|
| 57 |
|
| 58 |
# Description of the assistant. This is used for HTML tags.
|
| 59 |
# description = ""
|
|
@@ -62,14 +62,14 @@ name = "AI Tutor"
|
|
| 62 |
default_collapse_content = true
|
| 63 |
|
| 64 |
# Chain of Thought (CoT) display mode. Can be "hidden", "tool_call" or "full".
|
| 65 |
-
cot = "
|
| 66 |
|
| 67 |
# Link to your github repo. This will add a github button in the UI's header.
|
| 68 |
-
github = "
|
| 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.
|
| 72 |
-
custom_css = "/public/test.css"
|
| 73 |
|
| 74 |
# Specify a Javascript file that can be used to customize the user interface.
|
| 75 |
# The Javascript file can be served from the public directory.
|
|
@@ -79,7 +79,7 @@ custom_css = "/public/test.css"
|
|
| 79 |
# custom_font = "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap"
|
| 80 |
|
| 81 |
# Specify a custom meta image url.
|
| 82 |
-
custom_meta_image_url = "https://
|
| 83 |
|
| 84 |
# Specify a custom build directory for the frontend.
|
| 85 |
# This can be used to customize the frontend code.
|
|
@@ -87,7 +87,7 @@ custom_meta_image_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/f/
|
|
| 87 |
# custom_build = "./public/build"
|
| 88 |
|
| 89 |
[UI.theme]
|
| 90 |
-
default = "
|
| 91 |
#layout = "wide"
|
| 92 |
#font_family = "Inter, sans-serif"
|
| 93 |
# Override default MUI light theme. (Check theme.ts)
|
|
|
|
| 20 |
|
| 21 |
[features]
|
| 22 |
# Process and display HTML in messages. This can be a security risk (see https://stackoverflow.com/questions/19603097/why-is-it-dangerous-to-render-user-generated-html-or-javascript)
|
| 23 |
+
unsafe_allow_html = false
|
| 24 |
|
| 25 |
# Process and display mathematical expressions. This can clash with "$" characters in messages.
|
| 26 |
+
latex = false
|
| 27 |
|
| 28 |
# Automatically tag threads with the current chat profile (if a chat profile is used)
|
| 29 |
auto_tag_thread = true
|
|
|
|
| 53 |
|
| 54 |
[UI]
|
| 55 |
# Name of the assistant.
|
| 56 |
+
name = "Assistant"
|
| 57 |
|
| 58 |
# Description of the assistant. This is used for HTML tags.
|
| 59 |
# description = ""
|
|
|
|
| 62 |
default_collapse_content = true
|
| 63 |
|
| 64 |
# Chain of Thought (CoT) display mode. Can be "hidden", "tool_call" or "full".
|
| 65 |
+
cot = "full"
|
| 66 |
|
| 67 |
# Link to your github repo. This will add a github button in the UI's header.
|
| 68 |
+
# github = ""
|
| 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.
|
| 72 |
+
# custom_css = "/public/test.css"
|
| 73 |
|
| 74 |
# Specify a Javascript file that can be used to customize the user interface.
|
| 75 |
# The Javascript file can be served from the public directory.
|
|
|
|
| 79 |
# custom_font = "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap"
|
| 80 |
|
| 81 |
# Specify a custom meta image url.
|
| 82 |
+
# custom_meta_image_url = "https://chainlit-cloud.s3.eu-west-3.amazonaws.com/logo/chainlit_banner.png"
|
| 83 |
|
| 84 |
# Specify a custom build directory for the frontend.
|
| 85 |
# This can be used to customize the frontend code.
|
|
|
|
| 87 |
# custom_build = "./public/build"
|
| 88 |
|
| 89 |
[UI.theme]
|
| 90 |
+
default = "dark"
|
| 91 |
#layout = "wide"
|
| 92 |
#font_family = "Inter, sans-serif"
|
| 93 |
# Override default MUI light theme. (Check theme.ts)
|
{code β apps/ai_tutor}/app.py
RENAMED
|
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI, Request, Response, HTTPException
|
| 2 |
from fastapi.responses import HTMLResponse, RedirectResponse
|
| 3 |
from fastapi.templating import Jinja2Templates
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
# Add the parent directory of dl4ds_tutor to sys.path
|
| 5 |
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))
|
| 6 |
+
|
| 7 |
+
|
| 8 |
from fastapi import FastAPI, Request, Response, HTTPException
|
| 9 |
from fastapi.responses import HTMLResponse, RedirectResponse
|
| 10 |
from fastapi.templating import Jinja2Templates
|
{code/modules β apps/ai_tutor}/config/config.yml
RENAMED
|
File without changes
|
{code/modules β apps/ai_tutor}/config/project_config.yml
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/main.py
RENAMED
|
@@ -38,7 +38,7 @@ AGENT = "Agent"
|
|
| 38 |
YOU = "User"
|
| 39 |
ERROR = "Error"
|
| 40 |
|
| 41 |
-
with open("modules/config/config.yml", "r") as f:
|
| 42 |
config = yaml.safe_load(f)
|
| 43 |
|
| 44 |
|
|
@@ -85,7 +85,7 @@ class Chatbot:
|
|
| 85 |
"""
|
| 86 |
Load the configuration from a YAML file.
|
| 87 |
"""
|
| 88 |
-
with open("modules/config/config.yml", "r") as f:
|
| 89 |
return yaml.safe_load(f)
|
| 90 |
|
| 91 |
@no_type_check
|
|
|
|
| 38 |
YOU = "User"
|
| 39 |
ERROR = "Error"
|
| 40 |
|
| 41 |
+
with open("../../modules/config/config.yml", "r") as f:
|
| 42 |
config = yaml.safe_load(f)
|
| 43 |
|
| 44 |
|
|
|
|
| 85 |
"""
|
| 86 |
Load the configuration from a YAML file.
|
| 87 |
"""
|
| 88 |
+
with open("../../modules/config/config.yml", "r") as f:
|
| 89 |
return yaml.safe_load(f)
|
| 90 |
|
| 91 |
@no_type_check
|
{code β apps/ai_tutor}/public/acastusphoton-svgrepo-com.svg
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/public/adv-screen-recorder-svgrepo-com.svg
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/public/alarmy-svgrepo-com.svg
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/public/avatars/ai_tutor.png
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/public/calendar-samsung-17-svgrepo-com.svg
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/public/logo_dark.png
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/public/logo_light.png
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/public/space.jpg
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/public/test.css
RENAMED
|
File without changes
|
{storage β apps/ai_tutor/storage}/data/urls.txt
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/templates/cooldown.html
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/templates/dashboard.html
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/templates/error.html
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/templates/error_404.html
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/templates/login.html
RENAMED
|
File without changes
|
{code β apps/ai_tutor}/templates/logout.html
RENAMED
|
File without changes
|
apps/chainlit_base/.chainlit/config.toml
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
# Whether to enable telemetry (default: true). No personal data is collected.
|
| 3 |
+
enable_telemetry = true
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
# List of environment variables to be provided by each user to use the app.
|
| 7 |
+
user_env = []
|
| 8 |
+
|
| 9 |
+
# Duration (in seconds) during which the session is saved when the connection is lost
|
| 10 |
+
session_timeout = 3600
|
| 11 |
+
|
| 12 |
+
# Enable third parties caching (e.g LangChain cache)
|
| 13 |
+
cache = false
|
| 14 |
+
|
| 15 |
+
# Authorized origins
|
| 16 |
+
allow_origins = ["*"]
|
| 17 |
+
|
| 18 |
+
# Follow symlink for asset mount (see https://github.com/Chainlit/chainlit/issues/317)
|
| 19 |
+
# follow_symlink = false
|
| 20 |
+
|
| 21 |
+
[features]
|
| 22 |
+
# Process and display HTML in messages. This can be a security risk (see https://stackoverflow.com/questions/19603097/why-is-it-dangerous-to-render-user-generated-html-or-javascript)
|
| 23 |
+
unsafe_allow_html = false
|
| 24 |
+
|
| 25 |
+
# Process and display mathematical expressions. This can clash with "$" characters in messages.
|
| 26 |
+
latex = false
|
| 27 |
+
|
| 28 |
+
# Automatically tag threads with the current chat profile (if a chat profile is used)
|
| 29 |
+
auto_tag_thread = true
|
| 30 |
+
|
| 31 |
+
# Authorize users to spontaneously upload files with messages
|
| 32 |
+
[features.spontaneous_file_upload]
|
| 33 |
+
enabled = true
|
| 34 |
+
accept = ["*/*"]
|
| 35 |
+
max_files = 20
|
| 36 |
+
max_size_mb = 500
|
| 37 |
+
|
| 38 |
+
[features.audio]
|
| 39 |
+
# Threshold for audio recording
|
| 40 |
+
min_decibels = -45
|
| 41 |
+
# Delay for the user to start speaking in MS
|
| 42 |
+
initial_silence_timeout = 3000
|
| 43 |
+
# Delay for the user to continue speaking in MS. If the user stops speaking for this duration, the recording will stop.
|
| 44 |
+
silence_timeout = 1500
|
| 45 |
+
# Above this duration (MS), the recording will forcefully stop.
|
| 46 |
+
max_duration = 15000
|
| 47 |
+
# Duration of the audio chunks in MS
|
| 48 |
+
chunk_duration = 1000
|
| 49 |
+
# Sample rate of the audio
|
| 50 |
+
sample_rate = 44100
|
| 51 |
+
|
| 52 |
+
edit_message = true
|
| 53 |
+
|
| 54 |
+
[UI]
|
| 55 |
+
# Name of the assistant.
|
| 56 |
+
name = "Assistant"
|
| 57 |
+
|
| 58 |
+
# Description of the assistant. This is used for HTML tags.
|
| 59 |
+
# description = ""
|
| 60 |
+
|
| 61 |
+
# Large size content are by default collapsed for a cleaner ui
|
| 62 |
+
default_collapse_content = true
|
| 63 |
+
|
| 64 |
+
# Chain of Thought (CoT) display mode. Can be "hidden", "tool_call" or "full".
|
| 65 |
+
cot = "full"
|
| 66 |
+
|
| 67 |
+
# Link to your github repo. This will add a github button in the UI's header.
|
| 68 |
+
# github = ""
|
| 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.
|
| 72 |
+
# custom_css = "/public/test.css"
|
| 73 |
+
|
| 74 |
+
# Specify a Javascript file that can be used to customize the user interface.
|
| 75 |
+
# The Javascript file can be served from the public directory.
|
| 76 |
+
# custom_js = "/public/test.js"
|
| 77 |
+
|
| 78 |
+
# Specify a custom font url.
|
| 79 |
+
# custom_font = "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap"
|
| 80 |
+
|
| 81 |
+
# Specify a custom meta image url.
|
| 82 |
+
# custom_meta_image_url = "https://chainlit-cloud.s3.eu-west-3.amazonaws.com/logo/chainlit_banner.png"
|
| 83 |
+
|
| 84 |
+
# Specify a custom build directory for the frontend.
|
| 85 |
+
# This can be used to customize the frontend code.
|
| 86 |
+
# Be careful: If this is a relative path, it should not start with a slash.
|
| 87 |
+
# custom_build = "./public/build"
|
| 88 |
+
|
| 89 |
+
[UI.theme]
|
| 90 |
+
default = "dark"
|
| 91 |
+
#layout = "wide"
|
| 92 |
+
#font_family = "Inter, sans-serif"
|
| 93 |
+
# Override default MUI light theme. (Check theme.ts)
|
| 94 |
+
[UI.theme.light]
|
| 95 |
+
#background = "#FAFAFA"
|
| 96 |
+
#paper = "#FFFFFF"
|
| 97 |
+
|
| 98 |
+
[UI.theme.light.primary]
|
| 99 |
+
#main = "#F80061"
|
| 100 |
+
#dark = "#980039"
|
| 101 |
+
#light = "#FFE7EB"
|
| 102 |
+
[UI.theme.light.text]
|
| 103 |
+
#primary = "#212121"
|
| 104 |
+
#secondary = "#616161"
|
| 105 |
+
|
| 106 |
+
# Override default MUI dark theme. (Check theme.ts)
|
| 107 |
+
[UI.theme.dark]
|
| 108 |
+
#background = "#FAFAFA"
|
| 109 |
+
#paper = "#FFFFFF"
|
| 110 |
+
|
| 111 |
+
[UI.theme.dark.primary]
|
| 112 |
+
#main = "#F80061"
|
| 113 |
+
#dark = "#980039"
|
| 114 |
+
#light = "#FFE7EB"
|
| 115 |
+
[UI.theme.dark.text]
|
| 116 |
+
#primary = "#EEEEEE"
|
| 117 |
+
#secondary = "#BDBDBD"
|
| 118 |
+
|
| 119 |
+
[meta]
|
| 120 |
+
generated_by = "1.1.402"
|
apps/chainlit_base/chainlit.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Welcome to Chainlit! ππ€
|
| 2 |
+
|
| 3 |
+
Hi there, Developer! π We're excited to have you on board. Chainlit is a powerful tool designed to help you prototype, debug and share applications built on top of LLMs.
|
| 4 |
+
|
| 5 |
+
## Useful Links π
|
| 6 |
+
|
| 7 |
+
- **Documentation:** Get started with our comprehensive [Chainlit Documentation](https://docs.chainlit.io) π
|
| 8 |
+
- **Discord Community:** Join our friendly [Chainlit Discord](https://discord.gg/k73SQ3FyUh) to ask questions, share your projects, and connect with other developers! π¬
|
| 9 |
+
|
| 10 |
+
We can't wait to see what you create with Chainlit! Happy coding! π»π
|
| 11 |
+
|
| 12 |
+
## Welcome screen
|
| 13 |
+
|
| 14 |
+
To modify the welcome screen, edit the `chainlit.md` file at the root of your project. If you do not want a welcome screen, just leave this file empty.
|
{code β apps/chainlit_base}/chainlit_base.py
RENAMED
|
@@ -22,7 +22,7 @@ AGENT = "Agent"
|
|
| 22 |
YOU = "User"
|
| 23 |
ERROR = "Error"
|
| 24 |
|
| 25 |
-
with open("
|
| 26 |
config = yaml.safe_load(f)
|
| 27 |
|
| 28 |
|
|
@@ -51,7 +51,7 @@ class Chatbot:
|
|
| 51 |
"""
|
| 52 |
Load the configuration from a YAML file.
|
| 53 |
"""
|
| 54 |
-
with open("
|
| 55 |
return yaml.safe_load(f)
|
| 56 |
|
| 57 |
@no_type_check
|
|
|
|
| 22 |
YOU = "User"
|
| 23 |
ERROR = "Error"
|
| 24 |
|
| 25 |
+
with open("config/config.yml", "r") as f:
|
| 26 |
config = yaml.safe_load(f)
|
| 27 |
|
| 28 |
|
|
|
|
| 51 |
"""
|
| 52 |
Load the configuration from a YAML file.
|
| 53 |
"""
|
| 54 |
+
with open("config/config.yml", "r") as f:
|
| 55 |
return yaml.safe_load(f)
|
| 56 |
|
| 57 |
@no_type_check
|
apps/chainlit_base/config/config.yml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
log_dir: 'storage/logs' # str
|
| 2 |
+
log_chunk_dir: 'storage/logs/chunks' # str
|
| 3 |
+
device: 'cpu' # str [cuda, cpu]
|
| 4 |
+
|
| 5 |
+
vectorstore:
|
| 6 |
+
load_from_HF: True # 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 : 'RAGatouille' # 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
|
| 15 |
+
score_threshold : 0.2 # float
|
| 16 |
+
|
| 17 |
+
faiss_params: # Not used as of now
|
| 18 |
+
index_path: 'vectorstores/faiss.index' # str
|
| 19 |
+
index_type: 'Flat' # str [Flat, HNSW, IVF]
|
| 20 |
+
index_dimension: 384 # int
|
| 21 |
+
index_nlist: 100 # int
|
| 22 |
+
index_nprobe: 10 # int
|
| 23 |
+
|
| 24 |
+
colbert_params:
|
| 25 |
+
index_name: "new_idx" # str
|
| 26 |
+
|
| 27 |
+
llm_params:
|
| 28 |
+
llm_arch: 'langchain' # [langchain]
|
| 29 |
+
use_history: True # bool
|
| 30 |
+
generate_follow_up: False # bool
|
| 31 |
+
memory_window: 3 # int
|
| 32 |
+
llm_style: 'Normal' # str [Normal, ELI5]
|
| 33 |
+
llm_loader: 'gpt-4o-mini' # str [local_llm, gpt-3.5-turbo-1106, gpt-4, gpt-4o-mini]
|
| 34 |
+
openai_params:
|
| 35 |
+
temperature: 0.7 # float
|
| 36 |
+
local_llm_params:
|
| 37 |
+
temperature: 0.7 # float
|
| 38 |
+
repo_id: 'TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF' # HuggingFace repo id
|
| 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: 'gpt' # str [llama, pymupdf, gpt]
|
| 43 |
+
|
| 44 |
+
chat_logging:
|
| 45 |
+
log_chat: True # bool
|
| 46 |
+
platform: 'literalai'
|
| 47 |
+
callbacks: True # bool
|
| 48 |
+
|
| 49 |
+
splitter_options:
|
| 50 |
+
use_splitter: True # bool
|
| 51 |
+
split_by_token : True # bool
|
| 52 |
+
remove_leftover_delimiters: True # bool
|
| 53 |
+
remove_chunks: False # bool
|
| 54 |
+
chunking_mode: 'semantic' # str [fixed, semantic]
|
| 55 |
+
chunk_size : 300 # int
|
| 56 |
+
chunk_overlap : 30 # int
|
| 57 |
+
chunk_separators : ["\n\n", "\n", " ", ""] # list of strings
|
| 58 |
+
front_chunks_to_remove : null # int or None
|
| 59 |
+
last_chunks_to_remove : null # int or None
|
| 60 |
+
delimiters_to_remove : ['\t', '\n', ' ', ' '] # list of strings
|
apps/chainlit_base/config/project_config.yml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
retriever:
|
| 2 |
+
retriever_hf_paths:
|
| 3 |
+
RAGatouille: "XThomasBU/Colbert_Index"
|
| 4 |
+
|
| 5 |
+
metadata:
|
| 6 |
+
metadata_links: ["https://dl4ds.github.io/sp2024/lectures/", "https://dl4ds.github.io/sp2024/schedule/"]
|
| 7 |
+
slide_base_link: "https://dl4ds.github.io"
|
code/chainlit.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
# Welcome to DL4DS Tutor! ππ€
|
| 2 |
-
|
| 3 |
-
Hi there, this is an LLM chatbot designed to help answer questions on the course content.
|
| 4 |
-
|
| 5 |
-
### --- Please wait while the Tutor loads... ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{code/modules β modules}/__init__.py
RENAMED
|
File without changes
|
{code/modules β modules}/chat/__init__.py
RENAMED
|
File without changes
|
{code/modules β modules}/chat/base.py
RENAMED
|
File without changes
|
{code/modules β modules}/chat/chat_model_loader.py
RENAMED
|
File without changes
|
{code/modules β modules}/chat/helpers.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from modules.config.prompts import prompts
|
| 2 |
import chainlit as cl
|
| 3 |
|
| 4 |
|
|
|
|
| 1 |
+
from modules.config.prompts import prompts # TODO: MOVE THIS TO APP SPECIFIC DIRECTORY
|
| 2 |
import chainlit as cl
|
| 3 |
|
| 4 |
|
{code/modules β modules}/chat/langchain/__init__.py
RENAMED
|
File without changes
|
{code/modules β modules}/chat/langchain/langchain_rag.py
RENAMED
|
File without changes
|
{code/modules β modules}/chat/langchain/utils.py
RENAMED
|
File without changes
|
{code/modules β modules}/chat/llm_tutor.py
RENAMED
|
File without changes
|
{code/modules β modules}/chat_processor/__init__.py
RENAMED
|
File without changes
|
{code/modules β modules}/chat_processor/helpers.py
RENAMED
|
File without changes
|
{code/modules β modules}/chat_processor/literal_ai.py
RENAMED
|
File without changes
|
{code/modules β modules}/config/__init__.py
RENAMED
|
File without changes
|
code/modules/dataloader/__init__.py β modules/config/config_manager.py
RENAMED
|
File without changes
|
{code/modules β modules}/config/constants.py
RENAMED
|
File without changes
|
{code/modules β modules}/config/prompts.py
RENAMED
|
File without changes
|
{code/modules/retriever β modules/dataloader}/__init__.py
RENAMED
|
File without changes
|
{code/modules β modules}/dataloader/data_loader.py
RENAMED
|
File without changes
|
{code/modules β modules}/dataloader/helpers.py
RENAMED
|
@@ -2,7 +2,7 @@ import requests
|
|
| 2 |
from bs4 import BeautifulSoup
|
| 3 |
from urllib.parse import urlparse
|
| 4 |
import tempfile
|
| 5 |
-
from modules.config.constants import TIMEOUT
|
| 6 |
|
| 7 |
|
| 8 |
def get_urls_from_file(file_path: str):
|
|
|
|
| 2 |
from bs4 import BeautifulSoup
|
| 3 |
from urllib.parse import urlparse
|
| 4 |
import tempfile
|
| 5 |
+
from modules.config.constants import TIMEOUT # TODO: MOVE THIS TO APP SPECIFIC DIRECTORY
|
| 6 |
|
| 7 |
|
| 8 |
def get_urls_from_file(file_path: str):
|
{code/modules β modules}/dataloader/pdf_readers/base.py
RENAMED
|
File without changes
|
{code/modules β modules}/dataloader/pdf_readers/gpt.py
RENAMED
|
File without changes
|
{code/modules β modules}/dataloader/pdf_readers/llama.py
RENAMED
|
File without changes
|