diff --git a/nvim/.config/nvim/lua/plugins/llm.lua b/nvim/.config/nvim/lua/plugins/llm.lua new file mode 100644 index 0000000..7a339e4 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/llm.lua @@ -0,0 +1,49 @@ +return { + -- TODO: Add completion w blink, see https://codecompanion.olimorris.dev/installation.html + { + "olimorris/codecompanion.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "github/copilot.vim", + }, + opts = { + strategies = { + chat = { adapter = "groq" }, + inline = { adapter = "groq" }, + }, + adapters = { + groq = function() + return require("codecompanion.adapters").extend("openai", { + env = { + api_key = "GROQ_API_KEY", + }, + name = "Groq", + url = "https://api.groq.com/openai/v1/chat/completions", + schema = { + model = { + default = "llama-3.1-8b-instant", + choices = { + "llama-3.3-70b-versatile", + "mixtral-8x7b-32768", + }, + }, + }, + max_tokens = { + default = 4096, + }, + temperature = { + default = 1, + }, + }) + end, + }, + }, + keys = { + { "aa", "CodeCompanionActions", desc = "Actions", silent = true, mode = { "n", "v" } }, + { "ac", "CodeCompanionChat Toggle", desc = "Toggle chat", silent = true }, + { "ac", "CodeCompanionChat Add", desc = "Add to chat", silent = true, mode = "v" }, + }, + cmd = { "CodeCompanionActions", "CodeCompanionChat", "CodeCompanion", "CodeCompanionCmd" }, + }, +}