Press enter or click to view image in full size
Although I have extensive experience with SQL (structured query language), I often wonder whether there is a way to query the database quickly using simple English or natural language and get instant answers. Such a feature would be incredibly helpful.
So, I have tried using a combination of two tools — OpenAI GPT-3 and LangChain to query the database quickly using simple English or natural language and get instant answers — and here are my experiences with them:
- I find that AI requires specificity when asking for an answer. For example, if you query a database of food safety violations and ask which business has the most violations, it may return businesses with multiple locations. To ensure it returns the business with the most violations, you need to specify to include the address.
- Both expertise in the business domain and expertise in the data domain is necessary to validate the answers, which means that AI is unlikely to replace data analytics professionals anytime soon.
- You can specify return_direct=True in the SQLDatabaseChain initialization to directly return the output of the SQL…