I’m writing a Google Apps Script to populate a Google Sheet. Working in 3.5, but cannot find the endpoint URL to plug in to the code ANYWHERE. Yes, this is my first time.
_j
2
You will likely need to do far more than rely on ChatGPT to make up fabricated URLs.
API documentation.
https://platform.openai.com/docs/api-reference/chat/create
Sorry - what is it I’m looking for in this documentation? This appears to be a URL for chat completion, and that’s not what I’m doing.
I’ve read that I’d receive the enpoint URL when I received my API key, but this didn’t happen.
_j
4
The API isn’t just an “endpoint” but a carefully formulated set of messages and parameters that you must send in json format, to then get a response from the model, that must be parsed.
Simply pasting some URL into some script somewhere doesn’t create a chatbot you can interact with.
I appreciate your patience, but I’m not attempting to create a chatbot, but rather to create a script that populates a Google Sheet from ChatGPT results.
_j
6
Okay, hope you find what you are looking for in the documentation (specifically “curl” to show the headers and the body to be sent).
Note: ChatGPT is the web chatbot end-user product; the OpenAI API offers “models”, with names like “gpt-3.5-turbo”.
There’re two types of completions: chat completions and completions.
Chat ones take a message history/conversation history and generate the corresponding message, while the other one takes a text and generates the next chunk of text.
Visual difference:
Chat completions:
-
(will work)
-
User: Hello!
-
AI: Hi there, how can i assist you today?
-
(will also work)
-
System: You’re a system inside Google Sheets who completes the sheets. Here’s the data and what you have to do…
-
AI: (normally follows the structure and responds accordingly)
(normally, when you only take a system message and don’t follow an actual conversation it’s called “few-shot prompting”)
Completions:
-
(will not work)
-
User: Hello!
-
AI: (davinci will possibly answer with something random it thinks it’s correct)
-
(will work)
-
User: generate a tagline for a shoe shop
-
Davinci: cool shoes everywhere
(I’m not good at writing taglines lol)
So, yeah, you’d definitely want to use chat completions, whenever you’re building a ChatGPT implementation in Sheets or a chatbot. You also have access to GPT-4 via the chat completion API, OpenAI’s latest and smartest model.