Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 782 Bytes

README.md

File metadata and controls

30 lines (22 loc) · 782 Bytes

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,
    },
}