summaryrefslogtreecommitdiff
path: root/lua/ache/plugins/llm/model.lua
diff options
context:
space:
mode:
authorache <ache@ache.one>2024-07-21 05:30:30 +0200
committerache <ache@ache.one>2024-07-21 05:30:30 +0200
commitd69c281f43ba4168df32ef4ae6b77f88bfc60d86 (patch)
tree844fe20b45d099cbd35c1ccb3ae89dafb3da51a7 /lua/ache/plugins/llm/model.lua
Init commit
Diffstat (limited to 'lua/ache/plugins/llm/model.lua')
-rw-r--r--lua/ache/plugins/llm/model.lua81
1 files changed, 81 insertions, 0 deletions
diff --git a/lua/ache/plugins/llm/model.lua b/lua/ache/plugins/llm/model.lua
new file mode 100644
index 0000000..20ccb10
--- /dev/null
+++ b/lua/ache/plugins/llm/model.lua
@@ -0,0 +1,81 @@
+return {
+ "gsuuon/model.nvim",
+ enabled = true,
+
+ -- Don't need these if lazy = false
+ cmd = { "M", "Model", "Mchat" },
+ init = function()
+ vim.filetype.add({
+ extension = {
+ mchat = "mchat",
+ },
+ })
+ end,
+ ft = "mchat",
+
+ keys = {
+ { "<C-m>d", ":Mdelete<cr>", mode = "n" },
+ { "<C-m>s", ":Mselect<cr>", mode = "n" },
+ { "<C-m><space>", ":Mchat<cr>", mode = "n" },
+ },
+ config = function(_, opts)
+ local ollama = require("model.providers.ollama")
+ local model = require("model")
+ local starters = require("model.prompts.chats")
+ local qflist = require("model.util.qflist")
+
+ model.setup({
+ chats = {
+ ["codellama:qfix"] = vim.tbl_deep_extend("force", starters["together:codellama"], {
+ system = "You are an intelligent programming assistant",
+ create = function()
+ return qflist.get_text()
+ end,
+ }),
+ ["ollama:mistral"] = vim.tbl_deep_extend("force", starters["ollama:starling"], {}),
+ },
+ prompts = {
+ ["ollama:starling"] = {
+ provider = ollama,
+ params = {
+ model = "starling-lm",
+ },
+ builder = function(input)
+ return {
+ prompt = "GPT4 Correct User: " .. input .. "<|end_of_turn|>GPT4 Correct Assistant: ",
+ }
+ end,
+ },
+ ["ollama:mistral"] = {
+ provider = ollama,
+ params = {
+ model = "mistral",
+ },
+ builder = function(input)
+ return {
+ prompt = input,
+ params = {
+ model = "mistral",
+ },
+ }
+ end,
+ },
+ },
+ })
+ end,
+
+ -- To override defaults add a config field and call setup()
+
+ -- config = function()
+ -- require('model').setup({
+ -- prompts = {..},
+ -- chats = {..},
+ -- ..
+ -- })
+ --
+ -- require('model.providers.llamacpp').setup({
+ -- binary = '~/path/to/server/binary',
+ -- models = '~/path/to/models/directory'
+ -- })
+ --end
+}