I created file with name mydata.jsonl and I put on it these lines
{
"prompt": "aa",
"completion": "bb"
}
{
"prompt": "cc",
"completion": "dd"
}
then in index.js
I did this function
const { Configuration, OpenAIApi } = require("openai");
const fs = require("fs");
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
async function getAiResponse(topic) {
const openai = new OpenAIApi(configuration);
const filename = 'example.txt';
const fileContents = 'This is some example text.';
const response = await openai.createFile(
fs.createReadStream("mydata.jsonl"),
"fine-tune"
);
console.log(response)
}
getAiResponse("ee");
when I run my code I got error
Expected file to have JSONL format, where every line is a JSON dictionary. Line 1 is not a dictionary (HINT: line starts with: "{...").
I can't get where is the exactly the error
The JSONL format is where the each json object is sperated by a newline characater.
So your output should be:
{ "prompt": "aa", "completion": "bb" }
{ "prompt": "cc", "completion": "dd" }
i.e. one LINE per json object