Modify the json-creation code to replace "random" with a random probe.
Browse files- create_json_file.py +5 -0
create_json_file.py
CHANGED
@@ -1,10 +1,15 @@
|
|
1 |
from hundred_system_prompts import *
|
2 |
import inspect
|
3 |
import json
|
|
|
4 |
|
5 |
def convert_triplets_to_json(triplets, json_file_path):
|
6 |
json_data = []
|
7 |
for prompt, probe, func in triplets:
|
|
|
|
|
|
|
|
|
8 |
# Get the source of the function
|
9 |
source = inspect.getsource(func)
|
10 |
|
|
|
1 |
from hundred_system_prompts import *
|
2 |
import inspect
|
3 |
import json
|
4 |
+
import random
|
5 |
|
6 |
def convert_triplets_to_json(triplets, json_file_path):
|
7 |
json_data = []
|
8 |
for prompt, probe, func in triplets:
|
9 |
+
# If needed, change the probe to be random
|
10 |
+
if probe == "random":
|
11 |
+
probe = random.choice(random_probes)
|
12 |
+
|
13 |
# Get the source of the function
|
14 |
source = inspect.getsource(func)
|
15 |
|