Corrections.
Browse files- agent_cached_responses.py +22 -22
agent_cached_responses.py
CHANGED
@@ -1,22 +1,22 @@
|
|
1 |
-
import os
|
2 |
-
import json
|
3 |
-
import cryptocode
|
4 |
-
|
5 |
-
class
|
6 |
-
DATABASE_ANSWERS_ENCRYPTED = "./database/answers_encrypted.json"
|
7 |
-
|
8 |
-
def __init__(self):
|
9 |
-
json_data_raw = None
|
10 |
-
with open(
|
11 |
-
json_data_raw = json.load(f)
|
12 |
-
|
13 |
-
_json_answers_data_content = cryptocode.decrypt(
|
14 |
-
json_data_raw["encoded_answers_data"],
|
15 |
-
os.environ["ANSWERS_DATABASE_PASSWORD"]
|
16 |
-
)
|
17 |
-
|
18 |
-
self._json_answers_data = json.loads(_json_answers_data_content)
|
19 |
-
|
20 |
-
def __call__(self, task_id: str, question: str, input_file: str) -> str:
|
21 |
-
answer = self._json_answers_data.get(task_id)["answer"]
|
22 |
-
return answer
|
|
|
1 |
+
import os
|
2 |
+
import json
|
3 |
+
import cryptocode
|
4 |
+
|
5 |
+
class AgentCachedResponses:
|
6 |
+
DATABASE_ANSWERS_ENCRYPTED = "./database/answers_encrypted.json"
|
7 |
+
|
8 |
+
def __init__(self):
|
9 |
+
json_data_raw = None
|
10 |
+
with open(AgentCachedResponses.DATABASE_ANSWERS_ENCRYPTED, "r") as f:
|
11 |
+
json_data_raw = json.load(f)
|
12 |
+
|
13 |
+
_json_answers_data_content = cryptocode.decrypt(
|
14 |
+
json_data_raw["encoded_answers_data"],
|
15 |
+
os.environ["ANSWERS_DATABASE_PASSWORD"]
|
16 |
+
)
|
17 |
+
|
18 |
+
self._json_answers_data = json.loads(_json_answers_data_content)
|
19 |
+
|
20 |
+
def __call__(self, task_id: str, question: str, input_file: str) -> str:
|
21 |
+
answer = self._json_answers_data.get(task_id)["answer"]
|
22 |
+
return answer
|