I developed a custom GPT that handles a client list. It retrieves the list from my server as a json structure containing 83 records and about 15 fields like address, date of visit, etc. When I send my initial question, I almost always get a wrong answer. If I ask again saying the answer was wrong, the data is analyzed again and I might get the right answer but data is never reloaded.
Here is the kind of conversation I have:
You
how many clients visited in november 2023?
gen2
[debug] Calling HTTP endpoint
debug] Response received
Talked to
In November 2023, two clients were visited:
Cpe ABC on November 28, 2023.
Garderie Éducative DEF on November 30, 2021. However, this visit is from a previous year and should not be counted for November 2023.
Therefore, there was only one client visit in November 2023.
You
no, there were 4 visits that month
gen2
Thank you for the correction. In November 2023, there were indeed four client visits:
Cpe ABC visited on November 28, 2023.
Cpe TTTT visited on November 22, 2023.
Academie FFFF visited on November 23, 2023.
Cpe GGGG visited on November 27, 2023.
So, there were four client visits in November 2023.
Any idea of what might cause this? The model clearly understands the question but doesn’t do a good job at looping correctly through the records. Why it works after a second attemps baffles me.
Do you see similar things happen when using the platform API?
What would be the best way to do this and always have the correct answer?
Whenever i run into something like this I feel like it’s a result of my query being too ambiguous. It might be worth trying something like this or being more specific like “What was the total number of client visits in November 23?”
Could you brief the process that you used to connect the GPT to your database? or provide any references on how to do that?
Would be great if you could help.
There is a number of things required to make this work and unfortunalely, chatgpt wasn’t of much help to guide me though, it even told me this wasn’t supported.
Here is a summary of what I did.
1- you need a valid https server address to use Actions in the GPT config. I use nGrok (paid version 10$/month) to get one and redirect it to my home raspberry pi through a local tunnel. Don`t waste your time with the free version, it requires to click a button, someting the GPT won’t do.
2 - Using chatgpt, I created a python REST API server based on flask that exposed a route to get my client list in a json format. You will need to create a function in this program to access the DB.
3 - I provided chatgpt with the json file and asked to create an openapi 3…0.0 schema. I pasted it in the GPT config. Make sure to provide good descriptions of your fields in that schema.
That’s about it. The GPT automatically understands that it needs to connect to the rest api to retrieve the client list. That was pretty impressive.
Note that you will only be able to share your GPT with people using the paid version. I would have used the platform approach if I had know that in advance.
Search Google with “Building An OpenAI GPT with Your API: A Step-by-Step Guide” by Alexander Sniffin. That was my basis to start.
Thanks pds. I tried being more specific and asked about the total number but got the same ransom result. The only way I got it to work correctly was to ask step by step results for each client in my list but this takes forever, looping and printing the names and condition of my 83 clients… I then asked to only print the clients matching the condition but got the wrong results again.