Spaces:
Sleeping
Sleeping
def transform_data(data): | |
new_data = {'id': id(data['title']), 'conversations': []} | |
# Ensure the conversation starts with a human message | |
if data['conversations'][0]['from'] == 'assistant': | |
new_data['conversations'].append({'from': 'system', 'value': 'START'}) | |
# Copy the remaining conversations | |
new_data['conversations'].extend(data['conversations']) | |
return new_data |