Skip to main content

Create Completion

Generates text completions using OpenAI's legacy completion models.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Connection Id - The connection ID for the OpenAI service.
  • Prompt - The text prompt to generate completions for. Default is "Say this is a test".
  • Model - The OpenAI model to use for completion. Default is "gpt-3.5-turbo-instruct".

Options

  • Best of - Generates best_of completions server-side and returns the best. Results cannot be streamed.
  • Frequency Penalty - Number between -2.0 and 2.0 that penalizes frequent tokens.
  • Logit Bias - Modify the likelihood of specified tokens appearing in the completion.
  • Log Probabilities - Include the log probabilities on the logprobs most likely tokens.
  • Max Tokens - The maximum number of tokens to generate in the completion. Default is 512.
  • Number of Completions - How many completions to generate for each prompt. Default is 1.
  • Presence Penalty - Number between -2.0 and 2.0 that penalizes new tokens.
  • Seed - Seed for deterministic sampling.
  • Stop - Up to 4 sequences where the API will stop generating further tokens.
  • Streaming - Enable streaming of responses as they are generated.
  • Suffix - The suffix that comes after a completion of inserted text.
  • Temperature - What sampling temperature to use between 0 and 2. Default is 1.
  • Top P - An alternative to sampling with temperature. Default is 1.
  • User - A unique identifier representing your end-user.
  • Timeout (sec) - Timeout for the request. Only available with Robomotion Credits. Leave blank for default value (120+).

Output

  • Completion Text - The generated completion text from the model.
  • Stream Index - Index counter for streaming responses.

How It Works

The Create Completion node uses OpenAI's legacy completion models to generate text based on provided prompts. When executed, the node:

  1. Validates the provided Connection Id
  2. Prepares the completion request with the specified prompt and model
  3. Configures all specified options for the model
  4. Sends the request to the selected OpenAI completion model
  5. Processes the response and returns the completion text

Requirements

  • A valid OpenAI API key or Robomotion Credits
  • An active OpenAI connection
  • A text prompt to process

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Connection Id
  • Empty or invalid Prompt
  • Empty or invalid Model
  • Invalid option values (frequency penalty, temperature, etc.)
  • OpenAI API errors
  • Timeout errors

Usage Notes

  • This node uses legacy completion models which are less capable than the newer chat models
  • The default model is gpt-3.5-turbo-instruct
  • The default prompt is "Say this is a test"
  • Streaming can be enabled for real-time response generation
  • When using Robomotion Credits, the timeout can be customized for better performance
  • The temperature parameter controls randomness in the output
  • Top P is an alternative to temperature for controlling diversity
  • Best of generates multiple completions and returns the best one (cannot be used with streaming)