thomasgauthier's picture
will this work?
10c1f9c
raw
history blame
462 Bytes
def transform_data(data):
transformed_data = {
'id': data['id'],
'conversations': []
}
for conversation in data['conversations']:
if conversation['from'] == 'human':
transformed_data['conversations'].append({'input': conversation['value']})
elif conversation['from'] == 'gpt':
transformed_data['conversations'][-1]['output'] = conversation['value']
return transformed_data