Trying to upload a JSON file and getting this error:
“Invalid JSON: Expect message object but got: . . .”
What does this mean?
Hey @WeeChef -
can you please share the JSON you were trying to upload, so I can take a look?
Hi, how do I send you the file? Thanks for the response!
Are you on our Discord server by any chance? If so you can DM me the file directly
If not, please email to ofer at vectara.com.
Hey @WeeChef - I received the file and responding here for the benefits of others too.
As you can see in our docs, we support multiple file types but JSON is not one of them. The reason is that a JSON file, just like the one you sent over, actually has a structure that you often would need to break down into text and metadata fields.
So let’s say you have a JSON file with hotel reviews that looks like this: [{“name”: “hotel A”, “stars”: 4, “review”: “great hotel!”}, {“name”: “hotel B”, “stars”: 2, “review”: “not so great hotel”}, …]
you will turn this into a JSON that is compatible with the format Vectara’s API expects (as shown here). In this example you might decide to setup a single document with multiple parts for each hotel, or a single document per hotel, etc.
I hope this clarifies. You can see for example how this is done in vectara-ingest with the so called “Bulk Upload crawler”: vectara-ingest/crawlers/CRAWLERS.md at 313e308fcffa5ef344d8f0611a3b33914686bf9d · vectara/vectara-ingest · GitHub