raviix46 commited on
Commit
4fc333a
·
verified ·
1 Parent(s): 9143472

Create rag_config.py

Browse files
Files changed (1) hide show
  1. rag_config.py +29 -0
rag_config.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ import json
3
+
4
+ ROOT_DIR = Path(__file__).resolve().parent
5
+ DATA_DIR = ROOT_DIR / "data"
6
+
7
+ CHUNKS_PATH = DATA_DIR / "chunks.jsonl"
8
+ THREADS_PATH = DATA_DIR / "threads.json"
9
+ MESSAGES_PATH = DATA_DIR / "messages.json"
10
+ EMBEDDINGS_PATH = DATA_DIR / "embeddings.npy"
11
+ CHUNK_IDS_PATH = DATA_DIR / "chunk_ids.json"
12
+
13
+ RUNS_DIR = ROOT_DIR / "runs"
14
+
15
+
16
+ def load_json(path: Path):
17
+ with path.open("r", encoding="utf-8") as f:
18
+ return json.load(f)
19
+
20
+
21
+ def load_jsonl(path: Path):
22
+ items = []
23
+ with path.open("r", encoding="utf-8") as f:
24
+ for line in f:
25
+ line = line.strip()
26
+ if not line:
27
+ continue
28
+ items.append(json.loads(line))
29
+ return items