dustinblackman / oatmeal

Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors!
https://dustinblackman.com/posts/oatmeal/
MIT License
477 stars 23 forks source link

Using oatmeal in neovim #35

Closed MikeyBeez closed 7 months ago

MikeyBeez commented 7 months ago

I was able to load oatmeal using packer. I find that only codellama will put numbers for code blocks. I can copy and append, but I don't know how to interact with existing code. The video shows a window being opened from within nvim. Can you please give some more detailed instructions on working with code?

dustinblackman commented 7 months ago

Sure! The neovim plugins usage docs has a quick description on how to start a session from an existing file using either your configured hot key, or the :Oatmeal command. Check it out! https://github.com/dustinblackman/oatmeal.nvim

As for code clocks missing the selection number, what version of Oatmeal are you using? As of version 0.9.0, all code blocks get an index number assigned to them. Would you also happen to have a screenshot of an example with missing index numbers? You can open up your old sessions by running oatmeal sessions open

Thanks!

MikeyBeez commented 7 months ago

oatmeal --version oatmeal 0.12.1
With the model set to llama2 there were no numbers.
Here's the image that shows the session without numbers:

Screenshot 2023-12-31 at 11 10 59 PM

I think I figured out highlighting text before hitting space-om. Then replace works if I request refactoring, for example. Cool!

dustinblackman commented 7 months ago

That's a funny looking response from the model, that's why! Oatmeal is expecting markdown code blocks (triple back ticks) to be sent back from the model to mark them with an index number. It tries to encourage the model to do it too by appending to the first prompt you send.

Did you change something with your system prompt that had it come back with [PYTHON] prefixed to the code example responses? I've never seen that before.

MikeyBeez commented 7 months ago

U just noticed that I wrote [ython. I wonder it the brace could have caused this.

dustinblackman commented 7 months ago

Probably! LLMs can spit out some odd responses, but generally do a good job. As long as code comes back on markdown blocks, all should work as expected :)