ChatExplorer / dataset_adapters /CollectiveCognitionchats-data-2023-10-16.py
thomasgauthier's picture
will this work?
10c1f9c
raw
history blame
406 Bytes
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