File size: 462 Bytes
10c1f9c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def transform_data(data):
    conversations = []
    for item in data.get('conversation', []):
        conversations.append({
            "from" : "human",
            "value" : item.get("input", "")
        })
        conversations.append({
            "from" : "gpt",
            "value" : item.get("output", "")
        })

    transformed_data = {
        "id": hash(data['source']), 
        "conversations": conversations
    }

    return transformed_data