-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
23 lines (21 loc) · 842 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import json
from datagen import agent1, agent2, messages
with open('documents.json', 'r') as f:
data = json.load(f)
for d in data:
if d['section'] == "Code and Scripts":
for doc in d['data']:
agent1(title=doc['metadata']['title'], document=doc['content']['code'])
agent2(title=doc['metadata']['title'], document=doc['content']['code'])
with open("messages.jsonl", 'a') as f:
json.dump({"messages": messages}, f)
f.write("\n")
messages.clear()
else:
for doc in d['data']:
agent1(title=doc['metadata']['title'], document=doc['content'])
agent2(title=doc['metadata']['title'], document=doc['content'])
with open('messages.jsonl', 'a') as f:
json.dump({"messages": messages}, f)
f.write("\n")
messages.clear()