Trying to feed regular json files into the curl command, surely enough, gives an error:
尝试将常规的json文件提供给curl命令时,肯定会出现错误:
curl https://api.openai.com/v1/files \
-H "Authorization: Bearer [key]" \
-F "purpose=fine-tune" \
-F "file=@./formatted_dataset.json"
{
"error": {
"message": "Expected file to have JSONL format, where every line is a valid JSON dictionary. Line 1 is not a dictionary (HINT: line starts with: \"{...\").",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
Here is the data:
以下是数据:
{
"messages": [
{
"role":"system",
"content":"You are a friendly bot named docky with the experience of a well seasoned medical professional. Your job is to answer both to medical students using appropriate terminology, and regular people inquiring about their medical problems. You are not afraid to give advice."
},
{
"role":"user",
"content":"Is the protein Papilin secreted?"
},
{
"role":"assistant",
"content":"Yes, papilin is a secreted protein."
}
]
}
So I tried using jq
to format my data: jq -c '.[]' formatted_dataset.json >> output.jsonl
所以我试着用jq来格式化我的数据:jq -c '。[]'formatted_jsonet.json>> output.jsonl
...this being the output:
...这是输出:
[{"role":"system","content":"You are a friendly bot named docky with the experience of a well seasoned medical professional. Your job is to answer both to medical students using appropriate terminology, and regular people inquiring about their medical problems. You are not afraid to give advice."},{"role":"user","content":"Is the protein Papilin secreted?"},{"role":"assistant","content":"Yes, papilin is a secreted protein."}]
But the error prevails:
但错误占了上风:
{
"error": {
"message": "Expected file to have JSONL format, where every line is a valid JSON dictionary. Line 1 is not a dictionary (HINT: line starts with: \"[{\"r...\").",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
更多回答
我是一名优秀的程序员,十分优秀!