Using GPT for Automatic Database Querying and Code Execution
Introduction This post will show how to prompt GPT (or any language model) to answer a natural language query. Specifically: Take a human-written question write query statements to parse data tables based on human question return final result from database as answer to user’s question This code can be found in this repo. The Code Without further adu, below is the code itself. import openai import os openai.api_key = os.environ["OPENAI_API_KEY"] import time query = "Feel like eating some good chinese food tonight....