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')"; + }; + }; + }; +}