Skip to content

Commit d55c537

Browse files
authored
Merge pull request #98 from edubotics-ai/dev_branch
Dev branch to Main
2 parents c571e3b + b7d3eda commit d55c537

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+110
-65
lines changed

.github/workflows/publish.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: "3.x"
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install setuptools wheel twine
23+
- name: Build and publish
24+
env:
25+
TWINE_USERNAME: __token__
26+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} # from pypi
27+
run: |
28+
python setup.py sdist bdist_wheel
29+
twine upload dist/*

.github/workflows/push_to_hf_space.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
- name: Deploy Production (main) to HuggingFace
1919
env:
2020
HF_TOKEN: ${{ secrets.HF_TOKEN }}
21-
run: git push --force https://trgardos:[email protected]/spaces/dl4ds/dl4ds_tutor main:main
21+
run: git push --force https://trgardos:[email protected]/spaces/edubotics/dl4ds_tutor main:main

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{ "name":"Python Debugger: Module store_manager",
1818
"type":"debugpy",
1919
"request":"launch",
20-
"module":"modules.vectorstore.store_manager",
20+
"module":"edubotics_core.vectorstore.store_manager",
2121
"env": {"PYTHONPATH": "${workspaceFolder}/code"},
2222
"cwd": "${workspaceFolder}/code",
2323
"justMyCode": true
@@ -26,7 +26,7 @@
2626
"name": "Python Debugger: Module data_loader",
2727
"type": "debugpy",
2828
"request": "launch",
29-
"module": "modules.dataloader.data_loader",
29+
"module": "edubotics_core.dataloader.data_loader",
3030
"env": {"PYTHONPATH": "${workspaceFolder}/code"},
3131
"cwd": "${workspaceFolder}/code",
3232
"justMyCode": true

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ RUN --mount=type=secret,id=LITERAL_API_KEY_LOGGING,mode=0444,required=true
4040
RUN --mount=type=secret,id=CHAINLIT_AUTH_SECRET,mode=0444,required=true
4141

4242
# Default command to run the application
43-
CMD python -m modules.vectorstore.store_manager --config_file config/config.yml --project_config_file config/project_config.yml && python -m uvicorn app:app --host 0.0.0.0 --port 7860
43+
CMD python -m edubotics_core.vectorstore.store_manager --config_file config/config.yml --project_config_file config/project_config.yml && python -m uvicorn app:app --host 0.0.0.0 --port 7860

Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ RUN ls -R /code
3535
EXPOSE 7860
3636

3737
# Default command to run the application
38-
CMD python -m modules.vectorstore.store_manager --config_file config/config.yml --project_config_file config/project_config.yml && python -m uvicorn app:app --host 0.0.0.0 --port 7860
38+
CMD python -m edubotics_core.vectorstore.store_manager --config_file config/config.yml --project_config_file config/project_config.yml && python -m uvicorn app:app --host 0.0.0.0 --port 7860

README.md

Lines changed: 6 additions & 6 deletions

apps/ai_tutor/.chainlit/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ default_collapse_content = true
6565
cot = "hidden"
6666

6767
# Link to your github repo. This will add a github button in the UI's header.
68-
github = "https://github.com/DL4DS/dl4ds_tutor"
68+
github = "https://github.com/edubotics-ai/edubot-core"
6969

7070
# Specify a CSS file that can be used to customize the user interface.
7171
# The CSS file can be served from the public directory or via an external link.

apps/ai_tutor/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
reset_tokens_for_user,
2222
check_user_cooldown,
2323
)
24-
from modules.chat_processor.helpers import get_user_details, update_user_info
24+
from edubotics_core.chat_processor.helpers import get_user_details, update_user_info
2525
from config.config_manager import config_manager
2626
import hashlib
2727

apps/ai_tutor/chainlit_app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
LITERAL_API_KEY_LOGGING,
55
LITERAL_API_URL,
66
)
7-
from modules.chat_processor.literal_ai import CustomLiteralDataLayer
7+
from edubotics_core.chat_processor.literal_ai import CustomLiteralDataLayer
88
import json
99
from typing import Any, Dict, no_type_check
1010
import chainlit as cl
11-
from modules.chat.llm_tutor import LLMTutor
12-
from modules.chat.helpers import (
11+
from edubotics_core.chat.llm_tutor import LLMTutor
12+
from edubotics_core.chat.helpers import (
1313
get_sources,
1414
get_history_chat_resume,
1515
get_history_setup_llm,
1616
# get_last_config,
1717
)
18-
from modules.chat_processor.helpers import (
18+
from edubotics_core.chat_processor.helpers import (
1919
update_user_info,
2020
get_user_details,
2121
)

apps/ai_tutor/config/config_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class TokenConfig(BaseModel):
104104

105105

106106
class MiscConfig(BaseModel):
107-
github_repo: HttpUrl = "https://github.com/DL4DS/dl4ds_tutor"
107+
github_repo: HttpUrl = "https://github.com/edubotics-ai/edubot-core"
108108
docs_website: HttpUrl = "https://dl4ds.github.io/dl4ds_tutor/"
109109

110110

apps/ai_tutor/config/project_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ token_config:
1313
all_time_tokens_allocated: 1000000
1414

1515
misc:
16-
github_repo: "https://github.com/DL4DS/dl4ds_tutor"
16+
github_repo: "https://github.com/edubotics-ai/edubot-core"
1717
docs_website: "https://dl4ds.github.io/dl4ds_tutor/"
1818

1919
api_config:

apps/ai_tutor/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from datetime import datetime, timedelta, timezone
22
import tiktoken
3-
from modules.chat_processor.helpers import update_user_info, convert_to_dict
3+
from edubotics_core.chat_processor.helpers import update_user_info, convert_to_dict
44

55

66
def get_time():

apps/chainlit_base/chainlit_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import asyncio
33
from typing import Any, Dict, no_type_check
44
import chainlit as cl
5-
from modules.chat.llm_tutor import LLMTutor
6-
from modules.chat.helpers import (
5+
from edubotics_core.chat.llm_tutor import LLMTutor
6+
from edubotics_core.chat.helpers import (
77
get_sources,
88
get_history_setup_llm,
99
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

modules/chat/langchain/langchain_rag.py renamed to edubotics_core/chat/langchain/langchain_rag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from langchain_core.prompts import ChatPromptTemplate
22

3-
# from modules.chat.langchain.utils import
3+
# from edubotics_core.chat.langchain.utils import
44
from langchain_community.chat_message_histories import ChatMessageHistory
5-
from modules.chat.base import BaseRAG
5+
from edubotics_core.chat.base import BaseRAG
66
from langchain_core.prompts import PromptTemplate
77
from langchain.memory import ConversationBufferWindowMemory
88
from langchain_core.runnables.utils import ConfigurableFieldSpec

modules/chat/llm_tutor.py renamed to edubotics_core/chat/llm_tutor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from modules.chat.helpers import get_prompt
2-
from modules.chat.chat_model_loader import ChatModelLoader
3-
from modules.vectorstore.store_manager import VectorStoreManager
4-
from modules.retriever.retriever import Retriever
5-
from modules.chat.langchain.langchain_rag import (
1+
from edubotics_core.chat.helpers import get_prompt
2+
from edubotics_core.chat.chat_model_loader import ChatModelLoader
3+
from edubotics_core.vectorstore.store_manager import VectorStoreManager
4+
from edubotics_core.retriever.retriever import Retriever
5+
from edubotics_core.chat.langchain.langchain_rag import (
66
Langchain_RAG_V2,
77
QuestionGenerator,
88
)
File renamed without changes.
File renamed without changes.

modules/dataloader/data_loader.py renamed to edubotics_core/dataloader/data_loader.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
import html2text
1919
import bs4
2020
import PyPDF2
21-
from modules.dataloader.pdf_readers.base import PDFReader
22-
from modules.dataloader.pdf_readers.llama import LlamaParser
23-
from modules.dataloader.pdf_readers.gpt import GPTParser
24-
from modules.dataloader.helpers import get_metadata
25-
from modules.config.constants import TIMEOUT
21+
from edubotics_core.dataloader.pdf_readers.base import PDFReader
22+
from edubotics_core.dataloader.pdf_readers.llama import LlamaParser
23+
from edubotics_core.dataloader.pdf_readers.gpt import GPTParser
24+
from edubotics_core.dataloader.helpers import get_metadata
25+
from edubotics_core.config.constants import TIMEOUT
2626

2727
logger = logging.getLogger(__name__)
2828
BASE_DIR = os.getcwd()

modules/dataloader/helpers.py renamed to edubotics_core/dataloader/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from bs4 import BeautifulSoup
33
from urllib.parse import urlparse
44
import tempfile
5-
from modules.config.constants import (
5+
from edubotics_core.config.constants import (
66
TIMEOUT,
77
) # TODO: MOVE THIS TO APP SPECIFIC DIRECTORY
88

modules/dataloader/pdf_readers/gpt.py renamed to edubotics_core/dataloader/pdf_readers/gpt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from openai import OpenAI
77
from pdf2image import convert_from_path
88
from langchain.schema import Document
9-
from modules.config.constants import TIMEOUT
9+
from edubotics_core.config.constants import TIMEOUT
1010

1111

1212
class GPTParser:

modules/dataloader/pdf_readers/llama.py renamed to edubotics_core/dataloader/pdf_readers/llama.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import requests
33
from llama_parse import LlamaParse
44
from langchain.schema import Document
5-
from modules.config.constants import OPENAI_API_KEY, LLAMA_CLOUD_API_KEY, TIMEOUT
6-
from modules.dataloader.helpers import download_pdf_from_url
5+
from edubotics_core.config.constants import OPENAI_API_KEY, LLAMA_CLOUD_API_KEY, TIMEOUT
6+
from edubotics_core.dataloader.helpers import download_pdf_from_url
77

88

99
class LlamaParser:

modules/dataloader/webpage_crawler.py renamed to edubotics_core/dataloader/webpage_crawler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import requests
55
from bs4 import BeautifulSoup
66
from urllib.parse import urljoin, urldefrag
7-
from modules.config.constants import TIMEOUT
7+
from edubotics_core.config.constants import TIMEOUT
88

99

1010
class WebpageCrawler:
File renamed without changes.
File renamed without changes.
File renamed without changes.

modules/retriever/retriever.py renamed to edubotics_core/retriever/retriever.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from modules.retriever.faiss_retriever import FaissRetriever
2-
from modules.retriever.chroma_retriever import ChromaRetriever
3-
from modules.retriever.colbert_retriever import ColbertRetriever
4-
from modules.retriever.raptor_retriever import RaptorRetriever
1+
from edubotics_core.retriever.faiss_retriever import FaissRetriever
2+
from edubotics_core.retriever.chroma_retriever import ChromaRetriever
3+
from edubotics_core.retriever.colbert_retriever import ColbertRetriever
4+
from edubotics_core.retriever.raptor_retriever import RaptorRetriever
55

66

77
class Retriever:
File renamed without changes.

modules/vectorstore/chroma.py renamed to edubotics_core/vectorstore/chroma.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from langchain_community.vectorstores import Chroma
2-
from modules.vectorstore.base import VectorStoreBase
2+
from edubotics_core.vectorstore.base import VectorStoreBase
33
import os
44

55

modules/vectorstore/colbert.py renamed to edubotics_core/vectorstore/colbert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from ragatouille import RAGPretrainedModel
2-
from modules.vectorstore.base import VectorStoreBase
2+
from edubotics_core.vectorstore.base import VectorStoreBase
33
from langchain_core.retrievers import BaseRetriever
44
from langchain_core.callbacks.manager import CallbackManagerForRetrieverRun
55
from langchain_core.documents import Document

modules/vectorstore/embedding_model_loader.py renamed to edubotics_core/vectorstore/embedding_model_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from langchain_community.embeddings import OpenAIEmbeddings
22
from langchain_community.embeddings import HuggingFaceEmbeddings
3-
from modules.config.constants import OPENAI_API_KEY, HUGGINGFACE_TOKEN
3+
from edubotics_core.config.constants import OPENAI_API_KEY, HUGGINGFACE_TOKEN
44

55

66
class EmbeddingModelLoader:

modules/vectorstore/faiss.py renamed to edubotics_core/vectorstore/faiss.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from langchain_community.vectorstores import FAISS
2-
from modules.vectorstore.base import VectorStoreBase
2+
from edubotics_core.vectorstore.base import VectorStoreBase
33
import os
44

55

modules/vectorstore/raptor.py renamed to edubotics_core/vectorstore/raptor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from langchain_community.chat_models import ChatOpenAI
1212
from langchain_community.vectorstores import FAISS
1313
from langchain.text_splitter import RecursiveCharacterTextSplitter
14-
from modules.vectorstore.base import VectorStoreBase
14+
from edubotics_core.vectorstore.base import VectorStoreBase
1515

1616
RANDOM_SEED = 42
1717

modules/vectorstore/store_manager.py renamed to edubotics_core/vectorstore/store_manager.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
from modules.vectorstore.vectorstore import VectorStore
2-
from modules.dataloader.helpers import get_urls_from_file
3-
from modules.dataloader.webpage_crawler import WebpageCrawler
4-
from modules.dataloader.data_loader import DataLoader
5-
from modules.vectorstore.embedding_model_loader import EmbeddingModelLoader
1+
from edubotics_core.vectorstore.vectorstore import VectorStore
2+
from edubotics_core.dataloader.helpers import get_urls_from_file
3+
from edubotics_core.dataloader.webpage_crawler import WebpageCrawler
4+
from edubotics_core.dataloader.data_loader import DataLoader
5+
from edubotics_core.vectorstore.embedding_model_loader import EmbeddingModelLoader
66
import logging
77
import os
88
import time
99
import asyncio
10+
import yaml
11+
import argparse
1012

1113

1214
class VectorStoreManager:
@@ -137,7 +139,7 @@ def load_database(self):
137139
self.loaded_vector_db = self.vector_db._load_database(self.embedding_model)
138140
except Exception as e:
139141
raise ValueError(
140-
f"Error loading database, check if it exists. if not run python -m modules.vectorstore.store_manager / Resteart the HF Space: {e}"
142+
f"Error loading database, check if it exists. if not run python -m edubotics_core.vectorstore.store_manager / Resteart the HF Space: {e}"
141143
)
142144
# print(f"Creating database")
143145
# self.create_database()
@@ -162,10 +164,7 @@ def __len__(self):
162164
return len(self.vector_db)
163165

164166

165-
if __name__ == "__main__":
166-
import yaml
167-
import argparse
168-
167+
def main():
169168
# Add argument parsing for config files
170169
parser = argparse.ArgumentParser(description="Load configuration files.")
171170
parser.add_argument(
@@ -216,3 +215,7 @@ def __len__(self):
216215
print("Loaded database")
217216

218217
print(f"View the logs at {config['log_dir']}/vector_db.log")
218+
219+
220+
if __name__ == "__main__":
221+
main()

modules/vectorstore/vectorstore.py renamed to edubotics_core/vectorstore/vectorstore.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from modules.vectorstore.faiss import FaissVectorStore
2-
from modules.vectorstore.chroma import ChromaVectorStore
3-
from modules.vectorstore.colbert import ColbertVectorStore
4-
from modules.vectorstore.raptor import RAPTORVectoreStore
1+
from edubotics_core.vectorstore.faiss import FaissVectorStore
2+
from edubotics_core.vectorstore.chroma import ChromaVectorStore
3+
from edubotics_core.vectorstore.colbert import ColbertVectorStore
4+
from edubotics_core.vectorstore.raptor import RAPTORVectoreStore
55
from huggingface_hub import snapshot_download
66
import os
77
import shutil

0 commit comments

Comments
 (0)