Petr Tsvetkov
commited on
Commit
β’
34d6af9
1
Parent(s):
574fdf5
Full dataset generation
Browse files
generate_synthetic_dataset.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
from grazie.api.client.chat.prompt import ChatPrompt
|
2 |
from grazie.api.client.endpoints import GrazieApiGatewayUrls
|
3 |
from grazie.api.client.gateway import GrazieApiGatewayClient, GrazieAgent, AuthType
|
@@ -91,16 +93,17 @@ def generate_synthetic_dataset():
|
|
91 |
df['initial_msg_prompt'] = df.apply(generate_prompt_for_row, axis=1)
|
92 |
initial_messages_pred = []
|
93 |
|
94 |
-
for i, prompt in enumerate(tqdm(df['
|
95 |
output = None
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
104 |
|
105 |
df['initial_msg_pred'] = initial_messages_pred
|
106 |
|
|
|
1 |
+
import time
|
2 |
+
|
3 |
from grazie.api.client.chat.prompt import ChatPrompt
|
4 |
from grazie.api.client.endpoints import GrazieApiGatewayUrls
|
5 |
from grazie.api.client.gateway import GrazieApiGatewayClient, GrazieAgent, AuthType
|
|
|
93 |
df['initial_msg_prompt'] = df.apply(generate_prompt_for_row, axis=1)
|
94 |
initial_messages_pred = []
|
95 |
|
96 |
+
for i, prompt in enumerate(tqdm(df['initial_msg_ prompt'])):
|
97 |
output = None
|
98 |
|
99 |
+
while output is None:
|
100 |
+
try:
|
101 |
+
output = generate_initial_msg(prompt)
|
102 |
+
except:
|
103 |
+
time.sleep(0.5)
|
104 |
+
|
105 |
+
assert output is not None
|
106 |
+
initial_messages_pred.append(output)
|
107 |
|
108 |
df['initial_msg_pred'] = initial_messages_pred
|
109 |
|