From d69c281f43ba4168df32ef4ae6b77f88bfc60d86 Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 21 Jul 2024 05:30:30 +0200 Subject: Init commit --- lua/ache/plugins/llm/model.lua | 81 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 lua/ache/plugins/llm/model.lua (limited to 'lua/ache/plugins/llm/model.lua') 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 = { + { "d", ":Mdelete", mode = "n" }, + { "s", ":Mselect", mode = "n" }, + { "", ":Mchat", 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 +} -- cgit v1.3-2-g11bf