-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uploading JSON to Files API returns invalid file format #727
Comments
Thanks for reporting! We can repro this bug and are working on fixing it. |
Hi, I think this bug is the same as #333 and found a way to fix it. In this line if instead of The only difference I see in Unfortunately there is currently an API Outage so I can't investigate that much more at the moment. At least my workaround fixes it for the whisper case. |
@thiswillbeyourgithub you're looking at the CLI code, not the client code itself. This issue also appears to be an API issue as the same error is reported in the Node SDK. Please open a separate issue for the CLI error you're seeing! |
I'm sorry @RobertCraigie but I don't understand the problem. My issue is indeed appearing when I use the CLI like so I don't really get the meaning of "the CLI code, not the client code itself" as cli is part of the client and both are in this repo. In any case my issue is originaly with whisper and might not be related to this one after all so I will stop talking here. I messaged the thread #333 with my workaround anyway. Cheers |
It might be related to bug in open ai API reported today - https://community.openai.com/t/possible-bug-with-agent-creation-php-file-upload/484490/5 I have same issue with PHP SDK, uplading php and json files fails, the txt and html succeeds. |
This is a backend bug, not an SDK bug, so I'm going to go ahead and close this issue. |
The same issue, just try to send incorrect JSON file, and it will work ;) |
Hi @athyuttamre, is there an issue # to track this bug? |
Yes, I need to keep track of this bug, I am unable to work with some files |
I was really hoping you were kidding about this. I've been banging my head over this for the past 5 hours. I added garbage to the beginning of my file and now it works. 🤦🏻♂️ I don't even understand how this can be possible on their back end. |
OK I think I finally found a pattern, at least for our case. Valid JSON files upload fine so long as they are over 1025 bytes in size. If they are 1025 bytes or under, they will also work if you make them invalid by making them invalid as @albertaleksieiev suggested. |
@kennymatic , I believe as you do that in this case size matters. @albertaleksieiev also seems to be correct (i.e. send an invalid JSON formatted file and it will work.) I found to be routinely successful uploading a 10kb json file. It's one of those, "Are you kidding me?" bugs. BTW, ChatGPT can't help solve this bug. I asked for help repeatedly even after providing documentation from: |
BTW, a stupid but successful work-around is to create an initial entry in the JSON file with enough content that will make the file size exceed the 1kb that @kennymatic mentioned. |
This is basically what we did except we got the difference in length to get up to the min characters. Then we added a field to the JSON and filled it with spaces to get us up to the min limit. 😬 |
Thumbs up 👍 !
…On Tue, Dec 19, 2023, 9:32 AM Kenny Louie ***@***.***> wrote:
BTW, a stupid but successful work-around is to create an initial entry in
the JSON file with enough content that will make the file size exceed the
1kb that @kennymatic <https://github.com/kennymatic> mentioned. I put in
the following: [ { "id": "msg_0001", "role": "user", "content": "\n This
messgage is to create and initialize the JSON file with enough file size
that OpenAI will upload it.\n A JSON (JavaScript Object Notation) file is a
lightweight data interchange format that is easy for humans to read and
write,\n and easy for machines to parse and generate. It is based on a
subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition
- December 1999.\n JSON is a text format that is completely language
independent but uses conventions that are familiar to programmers of the
C-family of languages,\n including C, C++, C#, Java, JavaScript, Perl,
Python, and many others. These properties make JSON an ideal
data-interchange language.\n The structure of a JSON file is simple yet
flexible. It represents data in a text format consisting of key-value
pairs,\n making it analogous to a dictionary in Python or an object in
JavaScript.\n These key-value pairs are enclosed in curly braces, with the
key being a string and the value being a valid JSON data type such as\n a
string, number, array, or even another JSON object.\n This hierarchical
structure allows for the representation of complex data in an organized and
hierarchical manner,\n which is particularly useful in web applications for
data exchange between a client and a server, as well as in many other\n
programming contexts where data needs to be stored or transmitted in a
structured format.\n " }, { "id": "msg_0002", "role": "user", "content":
"\n We need to have a meeting of everyone within the company. Our strategic
goal is to raise revenue by 10%.\n Your mission is to discuss amongst
yourself to provide a consensus suggestion of the top five initiatives the
company should take.\n When the mission has been completed provide the five
initiatives and your reasonsing for each.\n " } ]
This is basically what we did except we got the difference in length to
get up to the min characters. Then we added a field to the JSON and filled
it with spaces to get us up to the min limit. 😬
—
Reply to this email directly, view it on GitHub
<#727 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A64PFD5HFQAIL37RF6LL5FTYKHFTJAVCNFSM6AAAAAA7CC562CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRTGIYDMMZXGM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Upload to the files endpoint with a JSON file throws an error
Code:
Stacktrace:
Here is the example file: example_1.json
The text was updated successfully, but these errors were encountered: