File size: 944 Bytes
d1009a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import json
import os
import datetime


def export_dict_as_jsonl(data: dict, filename: str):
    """
    Export a dictionary as a JSONL file.
    """
    with open(filename, "w") as f:
        for item in data:
            f.write(json.dumps(item) + "\n")


"""
        {
            "inputs": {"": ""},
            "output": "",
        },
"""


if __name__ == "__main__":
    data = [
        {
            "inputs": {
                "now": datetime.datetime.now(datetime.UTC).strftime('%Y-%m-%d'),
                "zep_context": "Zep is your daddy",
                "history": [
                    {"role": "user", "content": "what are some dinner ideas..."},
                    # {"role": "assistant", "content": "here are some dinner ideas..."},
                ],
            },
            "output": "here are some dinner ideas...",
        },
    ]
    # export dict as jsonl
    export_dict_as_jsonl(data, "formatted_prompt.jsonl")