#Openai api function to read data in SQL DB

1 messages · Page 1 of 1 (latest)

river heart
#

New learner here. I'm testing the api function to ask the model to read and interpret the data from SQL DB. The table is relatively small hence i use select all to pass the data to the model. I found wired things when the DB table has 200+ rows (5 cols), the model is not able to sum all the sales records. But if i reduce it to < 100 rows, the model can get the right sales number summation. Is there any limitation for the model to interpret the data? Also if i put 500 rows into csv, the model seems ok to read and interpret it properly. i use below function:

getTodaySales = json.loads(db.run_query("select * from TodaySalesTable"))

solar thicket
#

hey, Im currently doing something similar. My recommendation is to use code interpreter for this. Feeding the sql data to the AI via text string is never accurate. It gets REALLY good when you can save it to a spreadsheet file whether xlsx or csv.