I want to build a system where I can provide files containing 4-5 database tables and query them using natural language. For example, if I ask, “I need a property in Florida for 3 people living around the seashore,” the system should return the property ID and relevant details that match the criteria.
I plan to utilize the GPT-4 API to process natural language queries. What is the best OpenAI subscription plan or package (gonna implement in js stack) to support this integration? Specifically, I am looking for a solution that can interpret natural language input and map it to SQL queries that retrieve data from structured tables effectively.
I would investigate function-calling on Chat Completions API endpoint models (of which there are several, no need to pick the most expensive).
Though you could say, “here’s SQL, go crazy”, the best way to interface is to provide some functions that are coded to make a particular type of query, easy for the AI to individually understand and place the fields for.
The natural language user input would then be the AI finding a useful tool that reports it can return the needed data as part of its description.
A hypothetical tool you code being used by a clever and informed AI:
user: “I need a property in Florida for 3 people living around the seashore,” assistant writes: to functions.property_search({“state”: “FL”, “min_occupancy”: 3, “keywords”: [“beach”, “beachfront”, “ocean”]}