From 3c27e1b35ca0fee6a89bfc20840654361ffe888d Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 24 Jan 2026 11:20:30 +0100 Subject: [PATCH] plugins/model: init --- plugins/by-name/model/default.nix | 30 ++++++++++++ .../plugins/by-name/model/default.nix | 46 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 plugins/by-name/model/default.nix create mode 100644 tests/test-sources/plugins/by-name/model/default.nix diff --git a/plugins/by-name/model/default.nix b/plugins/by-name/model/default.nix new file mode 100644 index 00000000..b8878042 --- /dev/null +++ b/plugins/by-name/model/default.nix @@ -0,0 +1,30 @@ +{ lib, ... }: +lib.nixvim.plugins.mkNeovimPlugin { + name = "model"; + package = "model-nvim"; + + maintainers = [ lib.maintainers.GaetanLepage ]; + + settingsExample = { + prompts = { + zephyr = { + provider.__raw = "require('model.providers.llamacpp')"; + options.url = "http:localhost:8080"; + + builder.__raw = '' + function(input, context) + return { + prompt = + '<|system|>' + .. (context.args or 'You are a helpful assistant') + .. '\n\n<|user|>\n' + .. input + .. '\n<|assistant|>', + stop = { '' } + } + end + ''; + }; + }; + }; +} diff --git a/tests/test-sources/plugins/by-name/model/default.nix b/tests/test-sources/plugins/by-name/model/default.nix new file mode 100644 index 00000000..1f42e341 --- /dev/null +++ b/tests/test-sources/plugins/by-name/model/default.nix @@ -0,0 +1,46 @@ +{ + empty = { + plugins.model.enable = true; + }; + + example = { + plugins.model = { + enable = true; + + settings = { + prompts = { + zephyr = { + provider.__raw = "require('model.providers.llamacpp')"; + options.url = "http:localhost:8080"; + + builder.__raw = '' + function(input, context) + return { + prompt = + '<|system|>' + .. (context.args or 'You are a helpful assistant') + .. '\n\n<|user|>\n' + .. input + .. '\n<|assistant|>', + stop = { '' } + } + end + ''; + }; + }; + }; + }; + }; + + defaults = { + plugins.model = { + enable = true; + + settings = { + default_prompt.__raw = "require('model.providers.openai').default_prompt"; + prompts.__raw = "require('model.prompts.starters')"; + chats.__raw = "require('model.prompts.chats')"; + }; + }; + }; +}