Bropilot is a GitHub Copilot alternative that takes advantage of local LLMs through Ollama's API.
Current working models:
- codellama (7b & 13b)
- codegemma (2b & 7b)
- starcoder2 (3b & 7b)
You need to have Ollama installed and running for bro to work. Official download link
For Linux:
curl -fsSL https://ollama.com/install.sh | sh
# And check that the service is running
systemctl status ollama
Here is the default configuration.
model
is a string (e.g. "codellama:7b-code" or "codegemma:2b-code")model_params
is an optional table defining model params as per Ollama API paramsprompt
is a table defining the prefix, suffix and middle keywords for FIMmax_blocks
is a number that limits the suggested blocks count (-1 for unlimited)debounce
is a number in millisecondsauto_pull
is a boolean that allows bro to pull the model if not listed in ollama api
require('bropilot').setup({
model = "codegemma:2b-code",
-- model_params = {
-- mirostat = 0,
-- mirostat_eta = 0.1,
-- mirostat_tau = 5.0,
-- num_ctx = 2048,
-- repeat_last_n = 64,
-- repeat_penalty = 1.1,
-- temperature = 0.8,
-- seed = 0,
-- stop = {},
-- tfs_z = 1,
-- num_predict = 128,
-- top_k = 40,
-- top_p = 0.9,
-- },
prompt = { -- FIM prompt for codegemma
prefix = "<|fim_prefix|>",
suffix = "<|fim_suffix|>",
middle = "<|fim_middle|>",
},
max_blocks = 1,
debounce = 1000,
auto_pull = true,
})
Install and configure using lazy.nvim
{
'meeehdi-dev/bropilot.nvim',
event = "VeryLazy", -- preload model on start
dependencies = {
"nvim-lua/plenary.nvim",
"j-hui/fidget.nvim", -- optional
},
config = true, -- setup with default options
keys = {
{
"<Tab>",
function()
require("bropilot").accept_block()
end,
mode = "i",
},
},
}
-- or
{
'meeehdi-dev/bropilot.nvim',
event = "VeryLazy", -- preload model on start
dependencies = {
"nvim-lua/plenary.nvim",
-- "j-hui/fidget.nvim", -- optional
},
opts = {
model = "starcoder2:3b",
prompt = { -- FIM prompt for starcoder2
prefix = "<fim_prefix>",
suffix = "<fim_suffix>",
middle = "<fim_middle>",
},
debounce = 500,
auto_pull = false,
},
config = function (_, opts)
require("bropilot").setup(opts)
end,
keys = {
{
"<C-Right>",
function()
require("bropilot").accept_word()
end,
mode = "i",
},
{
"<M-Right>",
function()
require("bropilot").accept_line()
end,
mode = "i",
},
{
"<Tab>",
function()
require("bropilot").accept_block()
end,
mode = "i",
},
},
}
Roadmap available at ROADMAP.md