OpenAI completion
Sublime Text OpenAI completion plugin with GPT-4 support!
Details
Installs
- Total 2K
- Win 893
- Mac 617
- Linux 265
Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | Sep 4 | Sep 3 | Sep 2 | Sep 1 | Aug 31 | Aug 30 | Aug 29 | Aug 28 | Aug 27 | Aug 26 | Aug 25 | Aug 24 | Aug 23 | Aug 22 | Aug 21 | Aug 20 | Aug 19 | Aug 18 | Aug 17 | Aug 16 | Aug 15 | Aug 14 | Aug 13 | Aug 12 | Aug 11 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 3 | 3 | 5 | 8 | 1 | 3 | 2 | 1 | 2 | 4 | 2 | 2 | 3 | 3 | 3 | 1 | 4 | 5 | 2 | 3 | 1 | 3 | 0 | 5 | 0 | 1 | 1 | 1 | 2 | 1 | 4 | 6 | 1 | 3 | 1 | 0 | 0 | 4 | 3 | 8 | 1 | 1 | 3 | 2 | 1 |
Mac | 3 | 1 | 2 | 3 | 3 | 4 | 1 | 2 | 3 | 2 | 1 | 0 | 5 | 3 | 3 | 2 | 4 | 1 | 3 | 1 | 4 | 0 | 2 | 4 | 2 | 2 | 2 | 2 | 1 | 0 | 2 | 3 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 3 | 6 | 3 | 4 | 1 | 0 | 3 |
Linux | 1 | 2 | 1 | 0 | 1 | 0 | 2 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 1 | 1 | 2 | 2 | 1 | 1 | 0 | 3 | 2 | 2 | 1 | 0 | 3 | 0 | 1 | 2 | 2 | 0 | 2 | 1 | 0 | 1 | 1 | 2 | 1 | 0 | 1 |
Readme
- Source
- raw.githubusercontent.com
OpenAI Sublime Text Plugin
Abstract
OpenAI Completion is a Sublime Text 4 plugin that uses the OpenAI natural language processing (NLP) model to provide suggestions for editing code within the Sublime Text editor.
Features
- Append suggested text to selected code
- Insert suggested text instead of placeholder in selected code
- Edit selected code according to a given command
- ChatGPT mode support.
- [Multi]Markdown syntax with syntax highlight support (ChatGPT mode only).
- Proxy support.
- GPT-4 support.
- Server Side Streaming (SSE) support
ChatGPT completion demo
Click to see screens
Simple completion demo
Click to see screens
Requirements
- Sublime Text 4
- OpenAI API key (paid service)
- Internet connection
Installation
- Install the Sublime Text Package Control plugin if you haven't done this before.
- Open the command palette and type
Package Control: Install Package
. - Type
OpenAI
and pressEnter
.
Usage
ChatGPT usage
ChatGPT mode works the following way:
- Run the
OpenAI: New Message
command - Right after that the plug-in will open the output panel and start printing the model response into it.
- Wait until the model stops transferring its answer (currently there's no way how to abort transmission or hide the output panel within that process).
- If you would like to fetch chat history to another window manually, you can do that by running the
OpenAI: Refresh Chat
command. - When you're done or want to start all over you should run the
OpenAI: Reset Chat History
command, which deletes the chat cache.
Note You can bind both of the most usable commands
OpenAI: New Message
andOpenAI: Show output panel
, to do that please followSettings
->Package Control
->OpenAI completion
->Key Bindings
.Note As for now there's just a single history instance. I guess this limitation would disappear sometime.
Single shot completion usage
- Open the Sublime Text 4 editor and select some code.
- Open the command palette and run the
OpenAI: Complete
,OpenAI: Insert
, orOpenAI: Edit
commands.- To use the
OpenAI: Insert
command, the selected code should include a placeholder[insert]
. This can be modified in the settings.
- To use the
- The plugin will send the selected code to the OpenAI servers, using your API key, to generate a suggestion for editing the code.
- The suggestion will modify the selected code in the editor, according to the command you ran (append, insert, or edit).
Other features
[Multi]Markdown syntax with syntax highlight support
ChatGPT output panel supports markdown syntax highlight. It should just work (if it's not please report an issue).
Although it's highly recommended to install the MultimarkdownEditing
to apply syntax highlighting for code snippets provided by ChatGPT. OpenAI completion
should just pick it up implicitly for the output panel content.
Proxy support
That's it. Now you can set up a proxy for this plugin.
You can setup it up by overriding the proxy property in the OpenAI completion
settings like follow:
"proxy": {
"address": "127.0.0.1",
"port": 9898
}
GPT-4 support
Note You have to have access to the
GPT-4
model within your account, to use that feature.
It should just work, just set the chat_model
setting to GPT-4
.
Settings
The OpenAI Completion plugin has a settings file where you can set your OpenAI API key. This is required for the plugin to work. To set your API key, open the settings within Preferences
-> Package Settings
-> OpenAI
-> Settings
and paste your API key in the token property, as follows:
{
"token": "sk-your-token",
}
Disclaimers
Note Please note that OpenAI is a paid service, and you will need to have an API key and sufficient credit to use this plugin.
Warning All selected code will be sent to the OpenAI servers for processing, so make sure you have all necessary permissions to do so.
This one was at 80% written by that thing itself including this readme. I was here mostly for debugging purposes, rather than designing and researching. This is pure magic, I swear.