I tried making my json file into the new assistant but it say this error
There was an error uploading the file appointments.json: Invalid file format. Supported formats: [‘c’, ‘cpp’, ‘csv’, ‘docx’, ‘html’, ‘java’, ‘json’, ‘md’, ‘pdf’, ‘php’, ‘pptx’, ‘py’, ‘rb’, ‘tex’, ‘txt’, ‘css’, ‘jpeg’, ‘jpg’, ‘js’, ‘gif’, ‘png’, ‘tar’, ‘ts’, ‘xlsx’, ‘xml’, ‘zip’]
but i tried making in a json file and a csv file both didn’t work
1 Like
Hi,
What happens if you try and upload your file using the playground assistants page?
I get the same error when i try using the playground assistant.
Only for that file or for any file?
(extra words for the minimum sentence length checking bot)
I tryed using the same file in csv and json both formats didn’t work
Ok, but what about a totally different file? I just uploaded a pdf and it was fine, then i tried an html and that was fine, so I’m trying to see if there is something specific in that file or if it’s with your account/upload environment.
When i make a different file it works i tryed another file with pdf format and it worked. The only stuff that is in my csv file i would like to use are just some dates i got from google calendar
can you upload the file to a google drive and link it here?
Ok i found out the error
in the file it had problems
{
“date”: “2023-11-12”,
“time”: “16:00:00”,
“summary”: “ajdjsad”
},
it has to be like this
thank you for your help
1 Like
ehzuiq
11
I’ve encountered the same issue. I wonder what went wrong.
const file = await AssistantHandler.UploadFiles({
file: [
{
"start": "2023-11-14T15:30:00+01:00",
"summary": "skdkasd",
},
{
"start": "2023-11-14T19:00:00+01:00",
"summary": "jadslk",
},
],
user_id: "ouG890XHkqh79nvlHQzftGkjKvEE",
date: "2021-10-17",
type: "prescription",
});
static CreateLocalFile = async ({ file, user_id, date, type }) => {
try {
const filePath = path.join("/tmp", `${user_id}-${type}-${date}.json`);
file.forEach((obj) => {
const jsonString = JSON.stringify(obj);
fs.appendFileSync(filePath, jsonString + "\n");
});
return filePath;
} catch (error) {
console.error("Error creating local file:", error.message);
throw error;
}
};
static async UploadFiles(params) {
try {
const filePath = await this.CreateLocalFile(params);
const fileStream = fs.createReadStream(filePath, { encoding: "binary" });
const response = await this.openai.files.create({
file: fileStream,
purpose: "assistants",
});
fs.unlinkSync(filePath);
return response;
} catch (error) {
console.error("Error uploading file:", error.message);
throw error;
}
}
You need to make the json like this
{
“date”: “2023-11-12”,
“time”: “17:00:00”,
“summary”: “jasdlk”
},
it doesn’t work when you have the T15:30:00+1:00 behind
ehzuiq
13
It’s still an error. What exactly went wrong?
const file = await AssistantHandler.UploadFiles({
file: [
{
start: "2023-11-14",
summary: "skdkasd",
},
{
start: "2023-11-14",
summary: "jadslk",
},
],
user_id: "ouG890XHkqh79nvlHQzftGkjKvEE",
date: "2021-10-17",
type: "prescription",
});
static CreateLocalFile = async ({ file, user_id, date, type }) => {
try {
const filePath = path.join("/tmp", `${user_id}-${type}-${date}.json`);
file.forEach((obj) => {
const jsonString = JSON.stringify(obj, null, 2);
fs.appendFileSync(filePath, jsonString + "\r\n", "utf8");
});
return filePath;
} catch (error) {
console.error("Error creating local file:", error.message);
throw error;
}
};
static async UploadFiles(params) {
try {
const filePath = await this.CreateLocalFile(params);
console.log("readFileSync", fs.readFileSync(filePath, "utf8"));
const fileStream = fs.createReadStream(filePath);
const response = await this.openai.files.create({
file: fileStream,
purpose: "assistants",
});
fs.unlinkSync(filePath);
return response;
} catch (error) {
console.error("Error uploading file:", error.message);
throw error;
}
}
where is the time?
{
start: “2023-11-14”,
summary: “skdkasd”,
},
you just have the date and the summary
ehzuiq
15
I replaced the data with new values, but it’s still incorrect.
const file = await AssistantHandler.UploadFiles({
file: [
{
"user_id":"ouG890XHkqh79nvlHQzftGkjKvEE1",
"nickName": "abcdefg1"
},
{
"user_id":"ouG890XHkqh79nvlHQzftGkjKvEE2",
"nickName": "abcdefg2",
},
],
user_id: "ouG890XHkqh79nvlHQzftGkjKvEE",
date: "2021-10-17",
type: "prescription",
});
Are you still experiencing the error? Cause I experience the same. My .json is the following:
{"profile_titles":["Senior Backend Developer","Software Engineer"],
"recent_skills":["NoSQL", "Wireframing", "Figma"],
"other_skills":["XML", "Testing"],
"recent_competencies": ["quick learner", "driven"],
"other_competencies": ["resilient", "flexible"],
"recent_experiences": ["launched product from scratch", "scaled the engine to 10m/week processed items"],
"other_experiences": ["driving company growth from 10 to 100 people"],
"location_current": "London, UK",
"experience_years": 5,
"work_permit_country": "Switzerland",
"languages": ["fluent English", "basic German", "native Italian"],
"certifications": ["PMI", "Scrum"],
"educations": ["MSc in Engineering from TU Berlin", "BSc in Management, MIT"]
}
Ani ideas why it might not let it in?
I’m experiencing the error and have no idea what can it be. I tried with a simple json file and still getting the error
{
“products”: [
{“name”:“bed”,“price”:“10”}
, {“name”:“table”,“price”:“5”}
, {“name”:“chair” ,“price”:“2”}
, {“name”:“mouse”,“price”:“0.5”}
, {“name”:“screen”,“price”:“5”}
]
}
ehzuiq
19
“I added the following code at the top, and it can be uploaded successfully, but this is not a standard JSON format.”
fs.writeFileSync(filePath, "application/json\n", "utf8");
If this helps, i tried uploading a json file that with less than 1kb size and it throws me the invalid file format error. Then i added items to the file until it’s was more than 1kb and the upload was successfully. But the i tried with this json file:
{
“products”:
}
26bytes and it uploaded successfull.
So i don’t if this is the correct behavior but i’ll just upload 1kb+ json files