Google Spreadsheet + GPT3

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.

Link to Google Sheet: ChatGPT-On-Custom-Data - Google Sheets

Here are some simple instructions you might find helpful.

1. Make a copy of the google sheet on to your own drive.

2. Update the Open API Key in the settings sheet

3. Modify the values in a cell to get GPT response

4. Chain cells together to get a workflow of actions

5. Search data using the semantic search in the embedding tab and call GPT at the same time

Link to the older version of this sheet that work with the older models: GPT3-On-Custom-Data - Google Sheets

9 Likes

Nice. I’ll put it on my to-check-out list …

Thanks for sharing.

1 Like

Sure, my pleasure! Let me know how it goes!

1 Like

Wow, cool. Checking it out right now.

1 Like

Thanks, hope you like it, let me know if you have ideas on improving it…

1 Like

FYI, I created a new version for this as well with Embeddings API.

1 Like

Hi @nelson. Thanks for sharing this!

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)

1 Like

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.

Best, Peter

1 Like

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.

  1. 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.
  2. 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.

For example feed such as MarketWatch.com - Real-time Headlines
can go into this sheet…

You can do use the Search to to find data and feed it into GPT Prompt like this…

The idea of using GPT to analyze stock trend for you on a spreadsheet is pretty cool.
Hope you make a lot of money!

3 Likes

Hi @nelson,

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.

Best,
Peter

1 Like

You are welcome, good luck.
Feel free to reach out if you hit a roadblock.

1 Like

Thanks a lot @nelson

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?

Thanks again.

2 Likes

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.

1 Like

Thanks for the prompt reply.

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.

1 Like

Hi @SilverH,
Maybe I can help you take a look at it? Do you mind sending over that to me?

1 Like

@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!

2 Likes

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!

2 Likes

Would be very grateful if you could share the solution to prevent unnecessary burning of tokens here!

1 Like

@songsofthespheres Are you using the newer version I posted here?

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.

2 Likes