Spaces:
Sleeping
Sleeping
Commit
•
44bab49
1
Parent(s):
2ef37b6
Add log_to_jsonl function to data.py and remove duplicate function from utils.py
Browse files
chill.py
CHANGED
@@ -2,6 +2,7 @@ import argparse
|
|
2 |
import json
|
3 |
import time
|
4 |
import uuid
|
|
|
5 |
from datetime import datetime
|
6 |
from utils import calculate_overall_score, query_ai_prompt
|
7 |
from promptObjects import (
|
@@ -48,10 +49,6 @@ start_time = None
|
|
48 |
|
49 |
|
50 |
|
51 |
-
def log_to_jsonl(file_path, data):
|
52 |
-
with open(file_path, 'a') as file:
|
53 |
-
jsonl_str = json.dumps(data) + "\n"
|
54 |
-
file.write(jsonl_str)
|
55 |
|
56 |
def improve_text_attempt():
|
57 |
global suggestions
|
|
|
2 |
import json
|
3 |
import time
|
4 |
import uuid
|
5 |
+
from data import log_to_jsonl
|
6 |
from datetime import datetime
|
7 |
from utils import calculate_overall_score, query_ai_prompt
|
8 |
from promptObjects import (
|
|
|
49 |
|
50 |
|
51 |
|
|
|
|
|
|
|
|
|
52 |
|
53 |
def improve_text_attempt():
|
54 |
global suggestions
|
data.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
|
3 |
+
def log_to_jsonl(file_path, data):
|
4 |
+
with open(file_path, 'a') as file:
|
5 |
+
jsonl_str = json.dumps(data) + "\n"
|
6 |
+
file.write(jsonl_str)
|
utils.py
CHANGED
@@ -3,10 +3,9 @@ import json
|
|
3 |
from time import time, sleep
|
4 |
from os import environ as env
|
5 |
from typing import Any, Dict, Union
|
6 |
-
import
|
7 |
-
|
8 |
import requests
|
9 |
-
from huggingface_hub import hf_hub_download
|
10 |
|
11 |
|
12 |
# There are 4 ways to use a LLM model currently used:
|
@@ -235,10 +234,6 @@ def llm_stream_mistral_api(prompt: str, pydantic_model_class) -> Union[str, Dict
|
|
235 |
print("No pydantic model class provided, returning without class validation")
|
236 |
return json.loads(output)
|
237 |
|
238 |
-
def log_to_jsonl(file_path, data):
|
239 |
-
with open(file_path, 'a') as file:
|
240 |
-
jsonl_str = json.dumps(data) + "\n"
|
241 |
-
file.write(jsonl_str)
|
242 |
|
243 |
|
244 |
def query_ai_prompt(prompt, replacements, model_class):
|
|
|
3 |
from time import time, sleep
|
4 |
from os import environ as env
|
5 |
from typing import Any, Dict, Union
|
6 |
+
from data import log_to_jsonl
|
|
|
7 |
import requests
|
8 |
+
from huggingface_hub import hf_hub_download
|
9 |
|
10 |
|
11 |
# There are 4 ways to use a LLM model currently used:
|
|
|
234 |
print("No pydantic model class provided, returning without class validation")
|
235 |
return json.loads(output)
|
236 |
|
|
|
|
|
|
|
|
|
237 |
|
238 |
|
239 |
def query_ai_prompt(prompt, replacements, model_class):
|