Help required in differentiation of user context (general cases vs custom knowledge base)

Hello Team :wave: :wave:,

Iโ€™m developing an interactive chatbot which answers general user queries and also can give details from custom knowledge base (postgres SQL).

Various scenario it should handle

:point_right: If I ask it a query like โ€œmy laptop is running slowโ€ it should show suggestions how to fix it ( like general chat gpt answers to debug and steps to fix/check )
:point_right: If I ask it query like โ€œwhat is my laptop order status for id 1024โ€ it should understand and create a sql query for finding order status from postgres SQL table , which can be run in DB and fetch the results.

MY QUESTION :question:

how do I differentiate if the query asked comes under general context or does it come under get from database context. Since if it comes under DB context I have to start separate flow to create query and run operation to get details from DB.

:bulb: Pls help me with the approaches to identify the context type without making initial prompt large

( I thought of sending table details to check if intent is related to get details from these tables but that is becoming a huge prompt to send details of all tables, also increasing cost of each query).

Iโ€™m using model : gpt-3.5-turbo

Thanks :pray:

Can you specify the exact criteria for which type of query should be dealt with by each process?

If you can, then each query can be filtered by using a pre-processing prompt (or custom-trained model) and the response parsed by python (or whatever you prefer) to pass to the relevant prompt.

1 Like