Best usecases for chatgpt in neovim #39
Replies: 1 comment 2 replies
-
@AdrienLemaire Hey, for direct copilot equivalent have you looked into codeium?
Nope, because the gpt models are not there yet. The best most people can use is 16K token window with gpt3.5 (which is roughly 2K lines of code), with smarter gpt-4 8K it's half that. Recursively reading imports would quickly blow the token window. If you use established libraries, import resolving is not necessary, just tell the GPT what libs/frameworks you want to use. For private/less known code, you could just dump concise API reference for what you need into a -- example of adding command which writes concise API documentation for the selected code
APIDoc = function(gp, params)
local template = "I have the following code from {{filename}}:\n\n"
.. "```{{filetype}}\n{{selection}}\n```\n\n"
.. "Please respond by writing minimalistic markdown API documentation for the code above.\n\n"
.. "Ignore private code, public only.\n\n"
.. "Use minimum number of words and sentences.\n\n"
.. "\n\nFor function and methods provide just declaration - no word description necessary."
gp.Prompt(params, gp.Target.enew, nil, gp.config.command_model, template, gp.config.command_system_prompt)
end, so that hiting More manual surgically precise option would be to gather relevant pieces of code from multiple files into a chat buffer with
You're probably looking for something like sweep, these things are behemoths which put all your code base into vector database (which allows it to partially go around the token limit), spawn multiple interacting agents, which across multiple iteration edit your code and eventually produce result for specified task. Editor plugins such as gp.nvim are bound by the need for real time interactivity. I doubt you want a vim plugin to spawn multiple docker containers so they can cook the code for unspecified amount of time, while you go for coffee (or tea). 🙂
Yeah, I should work on that. Gp can be great helper which saves a lot of time and if you provide instructions by speech you barely have to touch the keyboard, but it still works as a human would editing one file at a time. And by design (at least for foreseeable future) I don't let the models run loose without human interaction in the loop the way sweep or auto-gpt does. |
Beta Was this translation helpful? Give feedback.
-
I've been using github copilot until recently, and am looking at replacing it with chatgpt. gp.nvim seems like a very nice plugin for this.
Can ChatGPT recursively read code imported in a file ?
Would it be able to refactore code across multiple files ? Do these files need to be opened in buffers ?
I'm hoping that the community can build a documentation around the best practices to make the most out of gp.nvim :)
Beta Was this translation helpful? Give feedback.
All reactions