Farid Karimli
commited on
Commit
·
d697aa5
1
Parent(s):
e029e22
Minor changes
Browse files- code/main.py +14 -8
- code/modules/config/config.yml +2 -1
- code/modules/vectorstore/colbert.py +1 -0
code/main.py
CHANGED
|
@@ -9,6 +9,10 @@ from modules.config.constants import LLAMA_PATH
|
|
| 9 |
from modules.chat.helpers import get_sources
|
| 10 |
import copy
|
| 11 |
from typing import Optional
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
USER_TIMEOUT = 60_000
|
| 14 |
SYSTEM = "System 🖥️"
|
|
@@ -92,13 +96,13 @@ class Chatbot:
|
|
| 92 |
id="chat_model",
|
| 93 |
label="Model Name (Default GPT-3)",
|
| 94 |
values=["local_llm", "gpt-3.5-turbo-1106", "gpt-4"],
|
| 95 |
-
initial_index=
|
| 96 |
),
|
| 97 |
cl.input_widget.Select(
|
| 98 |
id="retriever_method",
|
| 99 |
label="Retriever (Default FAISS)",
|
| 100 |
values=["FAISS", "Chroma", "RAGatouille", "RAPTOR"],
|
| 101 |
-
initial_index=
|
| 102 |
),
|
| 103 |
cl.input_widget.Slider(
|
| 104 |
id="memory_window",
|
|
@@ -252,15 +256,17 @@ class Chatbot:
|
|
| 252 |
|
| 253 |
await cl.Message(content=answer_with_sources, elements=source_elements).send()
|
| 254 |
|
| 255 |
-
def
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
|
|
|
|
|
|
| 260 |
|
| 261 |
|
| 262 |
chatbot = Chatbot()
|
| 263 |
-
cl.
|
| 264 |
cl.set_starters(chatbot.set_starters)
|
| 265 |
cl.author_rename(chatbot.rename)
|
| 266 |
cl.on_chat_start(chatbot.start)
|
|
|
|
| 9 |
from modules.chat.helpers import get_sources
|
| 10 |
import copy
|
| 11 |
from typing import Optional
|
| 12 |
+
from dotenv import load_dotenv
|
| 13 |
+
|
| 14 |
+
load_dotenv()
|
| 15 |
+
print(os.environ.get("OAUTH_GOOGLE_CLIENT_ID"))
|
| 16 |
|
| 17 |
USER_TIMEOUT = 60_000
|
| 18 |
SYSTEM = "System 🖥️"
|
|
|
|
| 96 |
id="chat_model",
|
| 97 |
label="Model Name (Default GPT-3)",
|
| 98 |
values=["local_llm", "gpt-3.5-turbo-1106", "gpt-4"],
|
| 99 |
+
initial_index=["local_llm", "gpt-3.5-turbo-1106", "gpt-4"].index(config["llm_params"]["llm_loader"]),
|
| 100 |
),
|
| 101 |
cl.input_widget.Select(
|
| 102 |
id="retriever_method",
|
| 103 |
label="Retriever (Default FAISS)",
|
| 104 |
values=["FAISS", "Chroma", "RAGatouille", "RAPTOR"],
|
| 105 |
+
initial_index=["FAISS", "Chroma", "RAGatouille", "RAPTOR"].index(config["vectorstore"]["db_option"])
|
| 106 |
),
|
| 107 |
cl.input_widget.Slider(
|
| 108 |
id="memory_window",
|
|
|
|
| 256 |
|
| 257 |
await cl.Message(content=answer_with_sources, elements=source_elements).send()
|
| 258 |
|
| 259 |
+
def oauth_callback(
|
| 260 |
+
provider_id: str,
|
| 261 |
+
token: str,
|
| 262 |
+
raw_user_data: Dict[str, str],
|
| 263 |
+
default_user: cl.User,
|
| 264 |
+
) -> Optional[cl.User]:
|
| 265 |
+
return default_user
|
| 266 |
|
| 267 |
|
| 268 |
chatbot = Chatbot()
|
| 269 |
+
cl.oauth_callback(chatbot.oauth_callback)
|
| 270 |
cl.set_starters(chatbot.set_starters)
|
| 271 |
cl.author_rename(chatbot.rename)
|
| 272 |
cl.on_chat_start(chatbot.start)
|
code/modules/config/config.yml
CHANGED
|
@@ -11,12 +11,13 @@ vectorstore:
|
|
| 11 |
expand_urls: True # bool
|
| 12 |
db_option : 'FAISS' # str [FAISS, Chroma, RAGatouille, RAPTOR]
|
| 13 |
db_path : '../vectorstores' # str
|
|
|
|
| 14 |
model : 'sentence-transformers/all-MiniLM-L6-v2' # str [sentence-transformers/all-MiniLM-L6-v2, text-embedding-ada-002']
|
| 15 |
search_top_k : 3 # int
|
| 16 |
score_threshold : 0.2 # float
|
| 17 |
|
| 18 |
faiss_params: # Not used as of now
|
| 19 |
-
index_path: '
|
| 20 |
index_type: 'Flat' # str [Flat, HNSW, IVF]
|
| 21 |
index_dimension: 384 # int
|
| 22 |
index_nlist: 100 # int
|
|
|
|
| 11 |
expand_urls: True # bool
|
| 12 |
db_option : 'FAISS' # str [FAISS, Chroma, RAGatouille, RAPTOR]
|
| 13 |
db_path : '../vectorstores' # str
|
| 14 |
+
db_path : 'vectorstores' # str
|
| 15 |
model : 'sentence-transformers/all-MiniLM-L6-v2' # str [sentence-transformers/all-MiniLM-L6-v2, text-embedding-ada-002']
|
| 16 |
search_top_k : 3 # int
|
| 17 |
score_threshold : 0.2 # float
|
| 18 |
|
| 19 |
faiss_params: # Not used as of now
|
| 20 |
+
index_path: 'vectorstores/faiss.index' # str
|
| 21 |
index_type: 'Flat' # str [Flat, HNSW, IVF]
|
| 22 |
index_dimension: 384 # int
|
| 23 |
index_nlist: 100 # int
|
code/modules/vectorstore/colbert.py
CHANGED
|
@@ -89,6 +89,7 @@ class ColbertVectorStore(VectorStoreBase):
|
|
| 89 |
|
| 90 |
def load_database(self):
|
| 91 |
path = os.path.join(
|
|
|
|
| 92 |
self.config["vectorstore"]["db_path"],
|
| 93 |
"db_" + self.config["vectorstore"]["db_option"],
|
| 94 |
)
|
|
|
|
| 89 |
|
| 90 |
def load_database(self):
|
| 91 |
path = os.path.join(
|
| 92 |
+
os.getcwd(),
|
| 93 |
self.config["vectorstore"]["db_path"],
|
| 94 |
"db_" + self.config["vectorstore"]["db_option"],
|
| 95 |
)
|