Skip to content

A plugin for working with chatgpt and openai api inside of neovim

Notifications You must be signed in to change notification settings

ThomasJamesCrawford/openai.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

openai.nvim

This is my simple plugin to work with the openai completions API.

A demo using the plugin

It combines your visual selection with a prompt and either performs a direct edit :OpenAICompletionEdit or just presents the result :OpenAICompletion.

It requires curl and the env var OPENAI_API_KEY to be set.

require('openai').setup {
    model = "gpt-3.5-turbo",
}

vim.keymap.set('v', 'ai', ':OpenAICompletion<CR>')
vim.keymap.set('v', 'ae', ':OpenAICompletionEdit<CR>')

You can also pass in custom values for the request body

require('openai').setup {
    model = "gpt-3.5-turbo",

    api_call_param = {
        max_tokens = 500,
        temperature = 0.5,
    },
}

About

A plugin for working with chatgpt and openai api inside of neovim

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages