diff options
| author | ache <ache@ache.one> | 2024-09-18 14:41:11 +0200 |
|---|---|---|
| committer | ache <ache@ache.one> | 2024-09-18 14:41:11 +0200 |
| commit | d757a05576b0785fe79791c9a7d60bd6c4ba63b8 (patch) | |
| tree | 7a3d10ccd51b30b4927438eb07672679019f71ee /lua/ache/plugins/llm | |
| parent | Color NBSP ! 🌈 (diff) | |
Clean up plugins
Diffstat (limited to 'lua/ache/plugins/llm')
| -rw-r--r-- | lua/ache/plugins/llm/gen.lua | 91 | ||||
| -rw-r--r-- | lua/ache/plugins/llm/gp.lua | 77 |
2 files changed, 124 insertions, 44 deletions
diff --git a/lua/ache/plugins/llm/gen.lua b/lua/ache/plugins/llm/gen.lua index 482ffa7..ed7abc7 100644 --- a/lua/ache/plugins/llm/gen.lua +++ b/lua/ache/plugins/llm/gen.lua @@ -1,47 +1,50 @@ +--[ +-- Basic LLM completion. +--] return { - "David-Kunz/gen.nvim", - enabled = false, - cmd = { "Gen" }, - opts = { - host = "box.ache.one", -- The host running the Ollama service. - port = "1080", -- The port on which the Ollama service is listening. - quit_map = "q", -- set keymap for close the response window - retry_map = "wc-rw", -- set keymap to re-send the current prompt - init = function(_) - -- pcall(io.popen, "ollama serve > /dev/null 2>&1 &") - end, - -- Function to initialize Ollama - command = function(options) - local body = { model = options.model, stream = true } - return "curl -u 'cecca:rouge_et_hedy<3' --basic --silent --no-buffer -X POST https://" - .. options.host - .. ":" - .. options.port - .. "/ollama/api/chat -d $body" - end, - -- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped). - -- This can also be a command string. - -- The executed command must return a JSON object with { response, context } - -- (context property is optional). - -- list_models = '<omitted lua function>', -- Retrieves a list of model names - display_mode = "float", -- The display mode. Can be "float" or "split" or "horizontal-split". - show_prompt = false, -- Shows the prompt submitted to Ollama. - show_model = false, -- Displays which model you are using at the beginning of your chat session. - no_auto_close = false, -- Never closes the window automatically. - debug = false, -- Prints errors and the command which is run. - }, - config = function(_, opts) - local gen = require("gen") - gen.setup(opts) + "David-Kunz/gen.nvim", + enabled = false, + cmd = { "Gen" }, + opts = { + host = "box.ache.one", -- The host running the Ollama service. + port = "1080", -- The port on which the Ollama service is listening. + quit_map = "q", -- set keymap for close the response window + retry_map = "wc-rw", -- set keymap to re-send the current prompt + init = function(_) + -- pcall(io.popen, "ollama serve > /dev/null 2>&1 &") + end, + -- Function to initialize Ollama + command = function(options) + local body = { model = options.model, stream = true } + return "curl -u 'cecca:rouge_et_hedy<3' --basic --silent --no-buffer -X POST https://" + .. options.host + .. ":" + .. options.port + .. "/ollama/api/chat -d $body" + end, + -- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped). + -- This can also be a command string. + -- The executed command must return a JSON object with { response, context } + -- (context property is optional). + -- list_models = '<omitted lua function>', -- Retrieves a list of model names + display_mode = "float", -- The display mode. Can be "float" or "split" or "horizontal-split". + show_prompt = false, -- Shows the prompt submitted to Ollama. + show_model = false, -- Displays which model you are using at the beginning of your chat session. + no_auto_close = false, -- Never closes the window automatically. + debug = false, -- Prints errors and the command which is run. + }, + config = function(_, opts) + local gen = require("gen") + gen.setup(opts) - gen.prompts["Complete"] = { - prompt = "$text", - replace = true, - } - gen.prompts["Improove"] = { - prompt = "Améliore ce texte de manière à le rendre formel mais amical:\n\n$text\n", - -- replace = true, - model = "MathiasB/llama3fr:latest", - } - end, + gen.prompts["Complete"] = { + prompt = "$text", + replace = true, + } + gen.prompts["Improove"] = { + prompt = "Améliore ce texte de manière à le rendre formel mais amical:\n\n$text\n", + -- replace = true, + model = "MathiasB/llama3fr:latest", + } + end, } diff --git a/lua/ache/plugins/llm/gp.lua b/lua/ache/plugins/llm/gp.lua new file mode 100644 index 0000000..9e59199 --- /dev/null +++ b/lua/ache/plugins/llm/gp.lua @@ -0,0 +1,77 @@ +return { + "robitx/gp.nvim", + config = function() + local conf = { + -- For customization, refer to Install > Configuration in the Documentation/Readme + providers = { + ollama = { + endpoint = "http://localhost:11434/v1/chat/completions", + }, + }, + agents = { + { + provider = "ollama", + name = "Codestrall", + chat = true, + command = false, + -- string with model name or table with model name and parameters + model = { + model = "codestral", + temperature = 0.5, + top_p = 1, + min_p = 0.05, + }, + -- system prompt (use this to specify the persona/role of the AI) + system_prompt = require("gp.defaults").code_system_prompt, + }, + { + provider = "ollama", + name = "Chatstrall", + chat = true, + command = false, + -- string with model name or table with model name and parameters + model = { + model = "mistral", + temperature = 0.6, + top_p = 1, + min_p = 0.05, + }, + -- system prompt (use this to specify the persona/role of the AI) + system_prompt = "Tu es un IA assistante général.", + }, + { + name = "ChatOllamaLlama3.1-8B", + disable = true, + }, + { + name = "ChatGPT4o", + disable = true, + }, + { + name = "ChatGPT4o-mini", + disable = true, + }, + { + provider = "ollama", + name = "ChatDeepSeek-coder", + chat = true, + command = false, + -- string with model name or table with model name and parameters + model = { + model = "deepseek-coder-v2", + temperature = 0.7, + top_p = 1, + min_p = 0.05, + }, + -- system prompt (use this to specify the persona/role of the AI) + system_prompt = require("gp.defaults").code_system_prompt, + }, + }, + default_chat_agent = "Chatstrall", + default_command_agent = nil, + } + require("gp").setup(conf) + + -- Setup shortcuts here (see Usage > Shortcuts in the Documentation/Readme) + end, +} |