Creating a Chatbot using the data stored in my huge database

@bill.french @curt.kennedy @EricGT @alden @nelson @castel
I have another problem which I have with my db is that for example if user can define their own item tags or vendor company tags
and if the question is something like
what is the total money spent on apple(users can have any tag like APPLES, Cheap Items)
what is the total money spent for the small business(user can have any tag here like small vendors)
In this case how can I define whether apple is a item tag or a company tag
we are facing this issue as users can have any name, so every user has his or her own names
now how can we know what they are referring to ??

we have two solutions but I want know if you have any more optimized solution

  1. we take user input and extract key words and search in the data base where they are present (I don’t have exactly how this is done but still we have an idea to do something like that) and we send this info in the prompt to the completion end point along with the sql query we get from the embedding model as @curt.kennedy described in this answer
  1. user should put it explicitly in the question saying that

what is the total money spent on items with item tag apple
what is the total money spent on organizations with company tag small business

then we can have similar questions in our embeddings and we may give the code with respect to that embedding along with the question to completion API to write a query and we can execute it and return the result plus prev prompt to gpt4 to write a descriptive answer.
But since this is not a good solution I want to hear from you have you faced such difficulty before?
if yes how to solve this problem?