Update params.py
Browse files
params.py
CHANGED
@@ -1,5 +1,28 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
|
3 |
+
DEFAULT_PARAMS = {
|
4 |
+
'PROVIDER': 'local-model',
|
5 |
+
'BASE_URL': 'http://localhost:11434/v1',
|
6 |
+
'WORKSPACE': 'mycoworks',
|
7 |
+
'API_KEY': '0MACR41-7804XQB-MGC1GS0-FGSKB44',
|
8 |
+
'OUTPUT_FILE_PATH': './dataset.jsonl',
|
9 |
+
'NUM_WORKERS': 1
|
10 |
+
}
|
11 |
+
|
12 |
+
def load_params():
|
13 |
+
try:
|
14 |
+
with open('config.json', 'r') as f:
|
15 |
+
return json.load(f)
|
16 |
+
except FileNotFoundError:
|
17 |
+
return DEFAULT_PARAMS
|
18 |
+
|
19 |
+
def save_params(params):
|
20 |
+
with open('config.json', 'w') as f:
|
21 |
+
json.dump(params, f, indent=2)
|
22 |
+
|
23 |
+
# For backwards compatibility
|
24 |
+
OPENAI_MODEL = "phi3:latest"
|
25 |
+
OPENAI_API_KEY = ""
|
26 |
+
OUTPUT_FILE_PATH = DEFAULT_PARAMS['OUTPUT_FILE_PATH']
|
27 |
+
NUM_WORKERS = DEFAULT_PARAMS['NUM_WORKERS']
|
28 |
+
PROVIDER = DEFAULT_PARAMS['PROVIDER']
|