GPTWEB Function Reference

Edited

Description

Scrapes a webpage and passes its contents to a prompt for evaluation.

The following will read the contents of the https://openai.com web page and pass it to the default AI model along with the prompt to describe its contents in one sentence.

=GPTWEB("Describe this company's products in one sentence", "https://openai.com")

If you want to use the value in another cell as the prompt, you can do so by directly passing it in:

=GPTWEB(A1, A2)

Syntax

=GPTWEB(prompt, page_url, gpt_model, temperature, max_tokens, cache)

The function parameters are as follows:

Parameter

Required

Default

Description

prompt

Yes

String (or cell reference) representing a user prompt)

page_url

Yes

The URL of the web page whose contents should be passed with the prompt to the AI model.

gpt_model

No

gpt-4o-mini

String representing the OpenAI GPT model to use. See the list of available models for usage and pricing details.

temperature

No

1

Number between 0 and 1 representing how much variance to introduce when responding. 0 is very little variance and 1 is the most variance.

max_tokens

No

1000

Number representing the max number of tokens to return as the response.

cache

No

true

Whether or not to cache the response. Setting to false will incur a re-execution on every cell refresh.

Sample Usage

=GPTWEB("Describe this company in one sentence", "https://glideapps.com")

Advanced Options

The GPTWEB function accepts several optional arguments which you can use to further control the response to your prompt. Here are some examples:


Specify a different GPT model

The third argument to GPT lets you specify a different OpenAI model to use when responding to your prompt. The default model is the best blend of cost-efficiency and performance. If you have more specific needs you may use one of the other OpenAI models instead:

=GPTWEB("Summarize this person's career in one paragraph", "https://en.wikipedia.org/wiki/Karen_Alloy", "gpt-4o")

Using non-default models (such as GPT4) may consume your SheetGPT usage credits at a much higher rate than the default model. Please make sure you understand what you are doing before using a different model.


Adjust the variety of the response

The fourth argument to GPT lets you specify a different "temperature" to use for the response. The temperature is a number between 0 and 1 (so a decimal like 0.5) that defines how much variability you want in your response.

=GPTWEB("Summarize this person's career in one paragraph", "https://en.wikipedia.org/wiki/Karen_Alloy",,0.1)


A higher temperature like 1 (the default) means you are likely to get very different responses to the same prompt - there is more "drift" in the responses. Use a lower number like 0 or 0.1 if you want more determinism in your responses.


Limit the length of the response

The fifth argument to GPT lets you specify a response length limit (in terms of tokens, which roughly equals half an average word in length). So if you want to limit the length of your response to about 15 words you could pass in 25 as the fifth argument to GPT:

=GPTWEB("Summarize this person's career in one, very short, sentence:", "https://en.wikipedia.org/wiki/Karen_Alloy",,,25)‍

Performance & caching

‍The completion that is returned is cached by SheetGPT to ensure that cell refreshes and other Sheet actions do not cause an unnecessary burn on your tokens.

Any GPTWEB request with the same arguments in a Sheet will return the cached value, indefinitely. This is well beyond the typical 6-hour cache limit of most Sheet plugins and is our attempt to make SheetGPT the most cost-effective way to utilize various GPT functionality.

If you ever need to avoid hitting the cache and force the generation of a new response, you can set the cache argument to false to force re-generation:

=GPTWEB("Summarize this person's career in one paragraph", "https://en.wikipedia.org/wiki/Karen_Alloy",,,,false)