I’m using bubble, it’s being sent in a form format, where the file is being uploaded directly and sent.
Line 1:
{“prompt”: “Old way/new way, how to build a web3 community###”, “completion”: “How to build a web3 community\n\nOld (2021) way:\n\n- Mint useless NFTs that have no underlying utility\n- Create a DAO yet hold the majority of governance tokens\n- Use snapshot to give a sense of decentralized decision-making\n- Leverage fakes and bots to prop up the numbers and show traction\n- Pay Hollywood celebrities to promote your project and be the lead voices\n\nNew (2023) way:\n\n- Mint an NFT collection that has real-life value \n- Distribute value and ownership in the community equitably\n- Make the decision-making process transparent for everyone\n- Build an army of dedicated early adopters to act as your ambassadors\n- Let established brands and well-respected web3 natives be your lead voice\n\n100 early ambassadors > 1000 disengaged members[END-PROMPT]”}
That validator is suspect, I used it and kept getting nonsense errors too.
Firstly, it spills the json into multiple lines, this is JSONL, meaning each line is a dict. That validator formats it differently and therefore breaks a JSONL format.
Secondly, that is a JSON validator, not JSON lines validator, while I don’t suspect it to be a huge difference, the error code is question is alerting that it’s a JSONL formatting problem, not a JSON formatting problem.
with open(“output_file.jsonl”, “w”) as output_file:
for {some content you want to write in the JSONL}:
prompt_text = f"{some_prompt_here}"
ideal_generated_text = {some_completion_here}
# Create the JSON object
json_obj = {
"prompt": prompt_text,
"completion": ideal_generated_text
}
# Write the JSON object as a line in the JSONL file
output_file.write(json.dumps(json_obj) + "\n")
Pandas is a good library for converting spreadsheets into JSON
Convert your object into a list of objects (if it’s not already like that for some reason)
Then use this
import json
with open('output.jsonl', 'w') as outfile:
for entry in <json_obj>:
json.dump(entry, outfile)
outfile.write('\n')
Also, try putting a r infront of your string so it doesn’t accidentally newline your string.
It could be actually doing a newline instead of “\n” as you have