Overview
The node provides an interface to OpenAI's text editing models, allowing users to submit input text along with instructions on how to edit it. The node sends this data to the OpenAI API, which returns an edited version of the text based on the specified model and instructions.
This node is beneficial in scenarios such as:
- Automatically correcting spelling or grammar mistakes.
- Rewriting text to improve clarity or style.
- Simplifying complex sentences.
- Generating variations of a given text snippet.
For example, you could input a sentence with typos and instruct the model to "Fix the spelling mistakes," receiving back a corrected version. Another use case might be providing a paragraph and instructing "Make this more concise," to get a shortened rewrite.
Properties
| Name | Meaning |
|---|---|
| Model | The OpenAI model used for editing. Options: code-davinci-edit-001, text-davinci-edit-001. |
| Input | The original text that you want the model to edit. |
| Instruction | A textual instruction guiding how the input should be edited (e.g., "Fix the spelling mistakes"). |
| Simplify | Whether to return a simplified response containing only the essential edited text instead of the full raw API response. Defaults to true. |
| Options | Additional optional parameters to customize the editing request: |
| - Echo Prompt | (Only for completion operation) Whether to include the prompt text in the output alongside the completion. |
| - Frequency Penalty | Penalizes new tokens based on their existing frequency in the text to reduce repetition. Range: -2 to 2. |
| - Maximum Tokens | (Only for completion operation) Maximum number of tokens to generate. Default is 16. |
| - Number of Completions | How many edited versions to generate per input. Default is 1. |
| - Presence Penalty | Penalizes new tokens based on whether they appear in the text so far to encourage new topics. Range: -2 to 2. |
| - Temperature | Controls randomness of output. Lower values make output more deterministic. Range: 0 to 1. |
| - Top P | Controls diversity via nucleus sampling. Range: 0 to 1. |
Output
The node outputs JSON data containing the edited text(s) returned by the OpenAI API. If "Simplify" is enabled, the output is simplified to an array under the data property containing only the choices from the API response, each representing an edited text completion.
If multiple completions are requested, the output will contain multiple edited versions.
The node does not output binary data.
Dependencies
- Requires an API key credential for authenticating with the OpenAI API.
- The base URL defaults to
https://api.openai.combut can be customized via credentials. - No other external dependencies are required.
Troubleshooting
- Common issues:
- Invalid or missing API key will cause authentication errors.
- Exceeding token limits may result in errors or truncated responses.
- Providing empty or invalid input or instruction fields may lead to unexpected results or errors.
- Error messages:
- Authentication failures: Check that your API key credential is correctly configured.
- Rate limit exceeded: Wait and retry later or adjust usage.
- Invalid parameter errors: Verify that all required properties are set correctly and within allowed ranges.