GPT-3 and Codex Edit and Insert Capabilities
OpenAI has introduced new capabilities for GPT-3 and Codex that allow the models to edit existing text and insert content into the middle of a document. This shift from simple text completion to iterative revision makes the OpenAI API more practical for tasks such as refactoring code and rewriting paragraphs.
Inserting Content into Existing Text
The new insert capability allows GPT-3 and Codex to add contextually relevant text in the middle of existing content. By providing the model with both preceding and following context, the quality of completions is improved for long-form writing, transitioning between paragraphs, and following outlines.
Technical Implementation and Use Cases
- Long-form Text: The model can fill in gaps between section headers in an outline, ensuring the generated content ties the two sections together logically.
- Software Development: The insert capability is particularly effective for adding code to the middle of a file. It allows the model to complete missing functions, add docstrings, and include necessary imports by analyzing the code that follows the insertion point.
- Integration: This capability is currently being piloted in GitHub Copilot.
Availability and Models
Insert is available in beta via the completions endpoint and the Playground interface. It is supported by the following models:
text-davinci-002code-davinci-002
Editing Existing Text
OpenAI has released a specialized edits endpoint in beta that modifies existing text based on a specific instruction rather than completing it. This allows users to change the tone, structure, or specific details of a text without generating entirely new content.
Capabilities and Applications
- Text Modification: The edits endpoint can change the tone of a piece of writing, restructure text, or fix spelling errors. It also supports empty prompts, enabling text generation similar to the completions endpoint.
- Code Refactoring: The tool is highly effective for refactoring code, adding documentation, translating between programming languages, and altering coding styles. For example, it can remove specific fields from a JSON input and convert the format to YAML.
Availability and Models
Editing is available through a specialized API endpoint and the Playground interface. It is supported by the following models:
text-davinci-edit-001code-davinci-edit-001
At the time of release, the edits endpoint is publicly available in beta and free to use.