Converting natural language into SQL query

Let’s say I have two kinds of columns in my table. The first one is the “customer” column, which contains the names of customers, and the second one is the “user” column, which contains the names of users.

Sometimes, when I ask a question related to a customer, the model fetches information from the user column. For example, if I ask a question like, “List the features used by the Flora system?”, the model should ideally fetch information from the customer column instead of the user column.

How can I avoid this issue?

openai #converting natural language to sql query

To me a customer and a user are the same thing, so if a human thinks that, you can be fairly sure the AI will also.

In your dataset what is the difference between a customer and a user?

Let’s say I have customer success product. For my product, there would be a customer, let’s call them ‘Customer X.’ Customer X may have several users: User 1, User 2, and User 3. So, in my table, I have both customers and users."

I don’t know what a customer success product is, I think the issue here may be word choice.

You consider your clients as customers and you consider their clients as users, which is fair enough for your own purposes, but as a general rule that is ambiguous and will cause confusion for the model.

You could try a term like “downstream-customer” or “downstream-user” for your customers customer to differentiate a little better, give that a try and see hoe that goes.

@datascience208. I also faced similar issue. And I started using the customer as “organization”. So you will have Organization and Users, which is correctly distinguishable in the natural language. Hope this helps

1 Like

Thanks for the information @shibi.panikkar16

Thank you for the answer @Foxabilo

I actually like @shibi.panikkar16 's idea more, moving your customers to organisations makes more sense to me and it will to the model.

@Foxabilo When I have tried with these two prompts, I am getting a different query.
1)How many customers were logged in in May 2023?
2)How many customers logged in in May 2023?

@shibi.panikkar16 If I mention the name (It can be a customer name or user name) in the prompt how will LLM Identify whether the given name is customer name or user name?!
For example , What is the product adoption rate of flora?

Note: Flora can be a user name or customer name. How will LLM identify this.I didn’t get the correct query when I run the llm with these type of questions.

Indeed, word choice matters. One method is to pass all user queries to the model first and ask the AI to reword the users questions for consistency, that way you isolate the end users from the query wording process and greatly reduce the amount of word choice issues.