branch: externals/minuet commit 4211e33361328334c89b9afdbe05b4de7d7b863f Author: Milan Glacier <d...@milanglacier.com> Commit: Milan Glacier <d...@milanglacier.com>
doc: update README. --- README.md | 35 +++++++++++++++++++++++++++-------- prompt.md | 48 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 69 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 284e08eb6f..7763b0f57e 100644 --- a/README.md +++ b/README.md @@ -230,15 +230,14 @@ option has no impact for overlay-based suggesion. ## minuet-n-completions -For FIM model, this is the number of requests to send. For chat LLM , -this is the number of completions encoded as part of the prompt. Note -that when `minuet-add-single-line-entry` is true, the actual number of -returned items may exceed this value. Additionally, the LLM cannot -guarantee the exact number of completion items specified, as this -parameter serves only as a prompt guideline. The default is `3`. +For FIM model, this is the number of requests to send. For chat LLM , this is +the number of completions encoded as part of the prompt. Note that when +`minuet-add-single-line-entry` is true, the actual number of returned items may +exceed this value. Additionally, the LLM cannot guarantee the exact number of +completion items specified, as this parameter serves only as a prompt guideline. +The default is `3`. -If resource efficiency is imporant, it is recommended to set this -value to `1`. +If resource efficiency is imporant, it is recommended to set this value to `1`. ## minuet-auto-suggestion-debounce-delay @@ -291,6 +290,11 @@ Below is the default value: :guidelines minuet-default-guidelines :n-completions-template minuet-default-n-completion-template) :fewshots minuet-default-fewshots + :chat-input + (:template minuet-default-chat-input-template + :language-and-tab minuet--default-chat-input-language-and-tab-function + :context-before-cursor minuet--default-chat-input-before-cursor-function + :context-after-cursor minuet--default-chat-input-after-cursor-function) :optional nil) "config options for Minuet OpenAI provider") @@ -315,6 +319,11 @@ Below is the default value: :guidelines minuet-default-guidelines :n-completions-template minuet-default-n-completion-template) :fewshots minuet-default-fewshots + :chat-input + (:template minuet-default-chat-input-template + :language-and-tab minuet--default-chat-input-language-and-tab-function + :context-before-cursor minuet--default-chat-input-before-cursor-function + :context-after-cursor minuet--default-chat-input-after-cursor-function) :optional nil) "config options for Minuet Claude provider") ``` @@ -374,6 +383,11 @@ The following config is the default. :guidelines minuet-default-guidelines :n-completions-template minuet-default-n-completion-template) :fewshots minuet-default-fewshots + :chat-input + (:template minuet-default-chat-input-template + :language-and-tab minuet--default-chat-input-language-and-tab-function + :context-before-cursor minuet--default-chat-input-before-cursor-function + :context-after-cursor minuet--default-chat-input-after-cursor-function) :optional nil) "config options for Minuet Gemini provider") ``` @@ -423,6 +437,11 @@ The following config is the default. :guidelines minuet-default-guidelines :n-completions-template minuet-default-n-completion-template) :fewshots minuet-default-fewshots + :chat-input + (:template minuet-default-chat-input-template + :language-and-tab minuet--default-chat-input-language-and-tab-function + :context-before-cursor minuet--default-chat-input-before-cursor-function + :context-after-cursor minuet--default-chat-input-after-cursor-function) :optional nil) "Config options for Minuet OpenAI compatible provider.") ``` diff --git a/prompt.md b/prompt.md index 28c4a86e94..f4bc81326f 100644 --- a/prompt.md +++ b/prompt.md @@ -23,11 +23,13 @@ by Ollama. If your use case requires special tokens not covered by Ollama's default template, disable the `:suffix` function by setting it to `nil` and incorporate the necessary special tokens within the prompt function. -# Default Template +# Chat LLM Prompt Structure + +## Default Template `{{{:prompt}}}\n{{{:guidelines}}}\n{{{:n_completion_template}}}` -# Default Prompt +## Default Prompt You are the backend of an AI-powered code completion engine. Your task is to provide code suggestions based on the user's input. The user's code will be @@ -40,7 +42,7 @@ enclosed in markers: Note that the user's code will be prompted in reverse order: first the code after the cursor, then the code before the cursor. -# Default Guidelines +## Default Guidelines Guidelines: @@ -57,11 +59,11 @@ Guidelines: 7. Create entirely new code completion that DO NOT REPEAT OR COPY any user's existing code around `<cursorPosition>`. -# Default `:n_completions` template +## Default `:n_completions` template 8. Provide at most %d completion items. -# Default Few Shots Examples +## Default Few Shots Examples ```lisp `((:role "user" @@ -91,7 +93,41 @@ def fibonacci(n): ")) ``` -# Customization +## Default Chat Input Example + +The chat input represents the final prompt delivered to the LLM for completion. +Its template follows a structured format similar to the system prompt and can be +customized as follows: + +The chat input template follows a structure similar to the system prompt and can +be customized using the following format: + +``` +{{{:language-and-tab}}} +<contextAfterCursor> +{{{:context-after-cursor}}} +<contextBeforeCursor> +{{{:context-before-cursor}}}<cursorPosition> +``` + +Components: + +- `:language-and-tab`: Specifies the programming language and indentation style + utilized by the user +- `:context-before-cursor`: Contains the text content preceding the cursor + position +- `:context-after-cursor`: Contains the text content following the cursor + position + +Implementation requires each component to be defined by a function +that accepts a single parameter `context` and returns a string. This +context parameter is a plist containing the following values: + +- `:before-cursor` +- `:after-cursor` +- `:language-and-tab` + +## Customization You can customize the `:template` by encoding placeholders within triple braces. These placeholders will be interpolated using the corresponding key-value pairs