OpenAI: GPT Summarizing Database Tables

Has anyone used GPT-3 to load data from a database table and summarize the data into words. For example load a database table about people which contains data about address and it would summarize:

X% of people live in NY and has increased by X.

Hi @chirag.shah285

Could you explain further what you want in a more step-by-step manner?

GPT-3 has no access to the internet so it cannot “load data from a database table”.

If I am not mistaken drinking morning coffee, you mean to take the contents of an SQL query and sent the results to a the OpenAI API completion method as a prompt which instructs the model to summarize the output in a specific format.

Please help us help you by providing the following data:

  • The exact results of an example SQL query into your database.
  • The desired completion using the OpenAI API.



Thanks @ruby_coder . Here is what I’m looking to do. Lets say I have a database table that’s looks like this:

I have data in a pandas dataframe such as:

Full Name Agent Mkt Assignment Number License Number Date License State Expiration
Ron Woodcock AMA-125201 IA100005569 1/7/2021 CO 12/31/2021
James Holden AMA-81563 1964889 9/23/2018 CA 11/2/2018
Kevin Bilafer AMA-125196 9088798 1/7/2021 MA 9/30/2022
James Hall AMA-77771 24530 9/23/2018 WA 3/30/2020
Nikki Biama AMA-125191 1950149 1/7/2021 CA 4/14/2022
James Hall AMA-81564 2005832 9/23/2018 CA 9/25/2020
Lynda Wennerstrom AMA-125193 1994854 1/11/2021 CA 1/20/2024
James Hall AMA-74107 1704157 9/23/2018 CA 6/20/2019

Now assume this is a larger table with multiple records.

I want to be able to teach OpenAi this data and summarize it such that. I can say, “Summarize this data,” and it will say something to the effect of:

X% of people have a license in NY and has increased by X this month (year, etc)

Basically have OpenAI learn my data so I can ask it any type of question?

1 Like

The short answer is no.

Even if you use the fine-tuning API method, you cannot “teach” a generative AI to run calculations for you like you want, I am sorry to inform you @chirag.shah285

You will need a different approach.

Sorry to inform.


Interesting I was in the Playground messing around with the data I provided and its doing basically what I want:

Its unclear to my how can I scale this to load all my data

Hi @chirag.shah285

That is because you just “got lucky” because if I test it using the API, text-davinci-003 “makes up” a different answer.

As I tried to explain to you, these generative AI models do not actually do calculations. They generate text. They auto-complete. They make things up to generate a completion.

It’s easy to be fooled into thinking that a generative AI is performing calculations whenit is just “generating blah, blah” generating a sequence of tokens based on the current tokens.

This is one of the “dangers” of generative AI.

Hope this helps.


1 Like