Generate text

The Generate text action sends a prompt to OpenAI and returns the generated text. The Generate text action can be used with any trigger and returns a single field called text that contains the generated text.

Connecting OpenAI to Flow

To begin using OpenAI actions, you must first connect Flow to your OpenAI account by adding an API key.

Steps:

  1. In Shopify Flow, open either a new or existing workflow.
  2. After adding the trigger step, click Then to add an Action.
  3. Click Clear all to display all installed and uninstalled Flow apps.
  4. In the Search apps and tasks field, search for OpenAI.
  5. Click OpenAI, and then click Connect.
  6. Add your OpenAI API key, and then click Submit.

You can now add the Generate text action to your new or existing workflow.

Fields

The Generate text action contains the following fields:

Fields used in the Generate text action.
FieldDescription
PromptRequired. Enter a prompt to generate the text that you want.
ModelRequired. The OpenAI model you want to use. Defaults to `gpt-3.5-turbo-instruct`. For compatible models, refer to `/v1/completions` in the OpenAI documentation.
SuffixThe suffix that comes after a completion of inserted text.
TemperatureSampling temperature to use. Higher values means the model will take more risks.
Top PAlternative to sampling with temperature called nucleus sampling.
StopWhen this single ASCII string is reached, the API will stop generating further completion tokens.
Presence PenaltyNumber between -2.0 and 2.0. Positive values penalize new tokens based on whether they're present in the text so far, increasing the model's likelihood to talk about new topics.
Frequency PenaltyNumber between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat exactly the same line.
Logit BiasModify the likelihood of specified tokens appearing in the completion. Accepts JSON.

Troubleshooting the OpenAI Generate text action

I entered another model and keep getting an error when I run the action. What is happening?

If you get the error This is a chat model and not supported in the v1/completions endpoint., then the model you entered isn't compatible with the OpenAI API that Flow uses for this action. We recommend accepting the default model or a model listed for /v1/completions in the OpenAI documentation.

Can’t find the answers you’re looking for? We’re here to help.