jackMort / ChatGPT.nvim

ChatGPT Neovim Plugin: Effortless Natural Language Generation with OpenAI's ChatGPT API
Apache License 2.0
3.64k stars 312 forks source link

Edit with instructions using OpenAI functions #251

Closed thehunmonkgroup closed 12 months ago

thehunmonkgroup commented 1 year ago

This is a mostly working solution, which greatly expands upon the work started at https://github.com/jackMort/ChatGPT.nvim/pull/249

This PR implements a cleaner version of using GPT 3.5/4 directly, and also has support for leveraging OpenAI functions if the use_openai_functions_for_edits config option is set to true (default is false).

On the whole, using OpenAI functions works well, however, there are some edge cases where parsing out the function arguments throws JSON parsing errors -- I tried for awhile to figure out the escaping magic to get it to behave in all cases, but so far have not had luck. Perhaps another set of eyes could help with that...