This repository was archived by the owner on Feb 4, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathconsts.py
More file actions
61 lines (56 loc) · 1.72 KB
/
Copy pathconsts.py
File metadata and controls
61 lines (56 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import os
from pathlib import Path
from langchain.document_loaders import CSVLoader, UnstructuredWordDocumentLoader, UnstructuredEPubLoader, \
PDFMinerLoader, UnstructuredMarkdownLoader, TextLoader
EXCLUDE_DIRS = ['__pycache__', '.venv', '.git', '.idea', 'venv', 'env', 'node_modules', 'dist', 'build', '.vscode',
'.github', '.gitlab']
ALLOW_FILES = ['.txt', '.js', '.mjs', '.ts', '.tsx', '.css', '.scss', '.less', '.html', '.htm', '.json', '.py',
'.java', '.c', '.cpp', '.cs', '.go', '.php', '.rb', '.rs', '.swift', '.kt', '.scala', '.m', '.h',
'.sh', '.pl', '.pm', '.lua', '.sql']
EXCLUDE_FILES = ['requirements.txt', 'package.json', 'package-lock.json', 'yarn.lock']
MODEL_TYPES = {
"OPENAI": "openai",
"LOCAL": "local",
}
DEFAULT_MODEL_DIRECTORY = os.path.join(str(Path.home()), ".cache", "gpt4all").replace("\\", "\\\\")
DEFAULT_CONFIG = {
"max_tokens": "2056",
"chunk_size": "2056",
"chunk_overlap": "256",
"k": "2",
"temperature": "0.7",
"model_path": DEFAULT_MODEL_DIRECTORY,
"n_batch": "8",
}
LOADER_MAPPING = {
".csv": {
"loader": CSVLoader,
"args": {}
},
".doc": {
"loader": UnstructuredWordDocumentLoader,
"args": {}
},
".docx": {
"loader": UnstructuredWordDocumentLoader,
"args": {}
},
".epub": {
"loader": UnstructuredEPubLoader,
"args": {}
},
".md": {
"loader": UnstructuredMarkdownLoader,
"args": {}
},
".pdf": {
"loader": PDFMinerLoader,
"args": {}
}
}
for ext in ALLOW_FILES:
if ext not in LOADER_MAPPING:
LOADER_MAPPING[ext] = {
"loader": TextLoader,
"args": {}
}