Returns the predicted completion of a given prompt using an OpenAI model. For more information, visit OpenAI’s “Completions” documentation.

Sample Usage

OPENAI_COMPLETE(“Write a tweet about”)




  • prompt – The prompt for which a predicted completion will be generated
  • max_tokens – [OPTIONAL] The maximum number of tokens to generate in the completion
  • temperature – [OPTIONAL] The sampling temperature used; higher values instruct the model to take more risks
  • top_p – [OPTIONAL] An alternative to sampling with temperature called nucleus sampling
  • model – [OPTIONAL] The ID of the OpenAI model used in generating the completion


OPENAI_COMPLETE(“Write a tweet about”) returns a tweet about

OPENAI_COMPLETE(A1,50,0,1,”text-davinci-003”) returns a completion of a prompt in Cell A1 using the text-davinci-003 model with 50 max tokens, a temperature of 0, and a top-p of 1.


  • If no model is specified, “text-davinci-003” will be used by default
  • For a list of all models, visit OpenAI’s documentation
  • OpenAI recommends altering the temperature or top-p value, but not both
  • temperature and top-p values can be between or equal to 0 and 1