Find answers from the community

Updated 2 years ago

Good evening I ve a big JSON dataset of

At a glance
Good evening. I've a big JSON dataset of restaurants (name, location, etc.) and its menu items (price, id, etc). Can I use it as is for indexing? Which would be the best index (vector, tree, etc.) for my use-case? I want to be able to create a chatbot using this data and GPT-3. Some queries that I can think of "What are some restaurants near me?", "What are some pizza options near me?", etc.
j
a
P
14 comments
Yeah you can start with the vector index! Some suggestions:
  • for a JSON dataset you will probably want to reformat it to plain-text (for instance outputting each key/value pair as "<key>:<value>\n" in a .txt file)
  • instead of asking "..near me" queries you may want to be specific about the location since the tool won't know where you currently are
let me know if the vector index doesn't work for queries and i can help brainstorm for you other options
is there a reason you'd want to map it to key:value? I tend to json.dumps my JSON files (because im lazy) but maybe I should start mapping out fields explicitly
i guess reduced token count is one reason
Thanks @jerryjliu0 . It worked . The trick was in translating the json data into natural language. One last question. I am running an infinite while loop to take user input and query the index and respond and then take the next question and so on. How do I keep storing the context of the conversation, such that i can then ask contextual questions?
@Pi๐… there's insert functionality to all indices where you can insert a Document into an existing index. https://www.notion.so/robustintelligence/Draft-CT-OKRs-033a873f801c4401b48a64b246568302
@jerryjliu0 , I probably wasn't clear with my question. I had created a simple chatbot script using Langchain. LLMChain allowed me to maintain the conversation history. Now that I have managed to create index using gpt-index, how can I query the index by using the conversation history as I did with Langchain?
Attachment
Screenshot_2023-01-10_at_1.44.02_PM.png
The PromptTemplate class is from the Langchain package.
Ah got it. I'm not sure if gpt index is completely interoperable with the memory + conversation modules in Langchain right now but let me think about it!

Out of curiosity, are you using GPT Index to store the conversation history or something else? I can help you brainstorm omething to try
I am using GPT index to store the the restaurant and menu data. I converted the JSON data I had to natural language paragraphs and created a vector index on it. Now I want to create a food ordering chatbot based on it. Simply querying on the vector index " I'd like to have a Plain Bagel from Starbucks" responds with necessary data for me to add a Bagel to the cart. But when I say "Make it 2", I want to update the item quantity of Bagel to 2 in the cart. Will the conversation know that I am talking about the Bagel, when I just say "Make it 2"? How can I achieve this?
The index is not storing the conversation history. It only stores the restaurant data.
The underlying question is how to create a chatbot based on the indexed data, instead of individual Q&As.
One way is that I can keeping appending the conversation in an array and prefix it before every query.
I am sure there is a better way.
Add a reply
Sign up and join the conversation on Discord