Generate text

The Generate text action sends a prompt to OpenAI and returns the generated text.

Connection

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

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](https://platform.openai.com/docs/models/model-endpoint-compatibility).
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 the same line verbatim.
Logit BiasModify the likelihood of specified tokens appearing in the completion. Accepts JSON.

Return data

The Generate text action returns a single field called text that contains the generated text.

Triggers

The Generate text action can be used with any trigger.

API reference

Flow calls the now legacy OpenAI completions API to generate text. To learn more, review the OpenAI API.

Frequently Asked Questions

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 answers you're looking for? We're here to help you.