I thought it will be great if there is a way to combine prompt and response from GPT3 using our own data.
So I created a google spreadsheet that does just that. Feel free to make a copy and play around with it!
Remember to update your API key before you use it, and be smart about not sharing your API key by mistake. The newest version of this sheet is pointed to the new ChatGPT API.
Is there a way where ChatGPT could answer prompt questions with responses from real-time data coming from my API? For example: if my API feeds real-time stock information could this be incorporated into the chatGPT interface?
You cant do this with ChatGPT right now because there is no API for it.
You could however, do something with GPT3 and a chat prompt. Even though it can’t get data from a specific end point, you could potentially train it up to answer questions and use placeholders in your training.
Eg the current stock price on the for Russell 2000 on the NYSE is ##price##
Then whenever you see ##price## in a response, you could swap it out with the data you get from making your own call to another service that provides stock prices
The real trick here is to figure out what the placeholder(s) should be to get it to appear inline on a reliable basis.
Eg. The ## may be intercepted by codex and it may start to think you are trying to write a program instead of asking a completion.
You may also be able to use a different placeholder for the trading stock name (Russell 2000)
You may even be able to do this using a few-shot prompt instead of training
Anyway, just some ideas to try (Nothing tested by me)
Thanks for the explanation @raymonddavey. Probably I could reach the simple QA task with slot/placeholder filling however this is much cheaper with the some open-source QA model.
I will try a few-shot prompt this week and let you know how this turns out.
Hi @peter.nemec
That is a very interesting use case. As @raymonddavey has mentioned, there is no official ChatGPT API now but the new text-davinci-003 model is pretty close.
I think there are many ways you can approach this problem.
You can get someone to integrate the API feeds with the GPT API for you, and with programing you can customize it however you like.
The other approach is the use the spreadsheet above and pull the stock information into the google spreadsheet in near realtime. That involves a little programming too, but there are probably plugins that can help you do that.
That was super fast. Thanks also for open-sourcing the google sheet.
Will try using your second approach to verify text-davinci-003 QA task before diving into unnecessary coding.
I’ve been working on a sheet similar to yours. It does work and generate the GPT3 response. My problem is that the formulas re-execute/prompt a response whenever I reopen the sheet. So, consuming additional tokens.
I checked your script, but I’m not sure if it prevents this issue. If so, how?
Hi @SilverH
Thanks for sharing that, from what I can tell, it will only trigger the API call when the cell id modified. Let me check if there are other actions that can cause re-executing the prompt. Will keep you posted.
The issue is with my own script. I was wondering if you were experiencing a similar problem. I haven’t tried your script yet. If there is no problem, I can start using yours with some modifications.
@nelson I have a solution to preserve outputs and prevent unnecessary burning of tokens. Would love to connect to share with you here. Also have a question for you about how you were able to leverage embeddings into google sheets. Thanks!
Hi all, just want to make a friendly reminder.
Some users have been getting issues on editing the Google Spreadsheet. Just wanted to say that by default the Google Spreadsheet is read-only, but you are more than welcome to make a copy of the google spreadsheet to your own drive and make any changes necessary.
Cheers!
This one should not have any issues on burning tokens.
Also if you want to make sure, I added a new function call getCompletionsWithTimestamp
You can use this to test when was the last time the API executed.