File size: 406 Bytes
10c1f9c
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
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