Petr Tsvetkov commited on
Commit
34d6af9
β€’
1 Parent(s): 574fdf5

Full dataset generation

Browse files
Files changed (1) hide show
  1. generate_synthetic_dataset.py +11 -8
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['initial_msg_prompt'])):
95
  output = None
96
 
97
- if i < 5:
98
- while output is None:
99
- try:
100
- output = generate_initial_msg(prompt)
101
- except:
102
- pass
103
- initial_messages_pred.append(output if output is not None else "TBA")
 
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