Conversation
…port - cache now stores up to n_cmpl individual completions per key (ring buffer) - simplify fim_try_hint: exact match with cycling, nearby match without - add n_cmpl config option (default: 1) - add keymap_fim_next/keymap_fim_prev for cycling (<C-J>/<C-K>) - add llama#fim_cycle() for cycling through completions - deduplicate completions on cache insert by content - update info bar to show total cached entries and completion index Assisted-by: llama.cpp:local pi
Map the cycle keymaps whenever a FIM hint is shown, not just when multiple completions are available. llama#fim_cycle returns '' early when there is nothing to cycle, preventing the default insert-mode behavior of moving the cursor. Assisted-by: llama.cpp:local pi
The fuzzy flag was only used to suppress the [N/M] completion index in the info bar. Simply checking len(responses) > 1 is sufficient. Assisted-by: llama.cpp:local pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Support generating multiple completions at a time using the
n_cmplparameter:ggml-org/llama.cpp#17775
Approach
Cache as ring buffer per key
Each cache key (hash of prefix/middle/suffix) now maps to a ring buffer of up to
n_cmplindividual completion responses. When a new completion arrives for an existing key, it is appended; if the ring is full, the oldest entry is evicted. Completions with duplicatecontentare skipped on insert.This naturally accumulates diverse completions across multiple requests for the same position, without packing them into a single array value.
Simplified
fim_try_hintTwo clear phases:
<C-J>/<C-K>).New config options
n_cmpl(default: 1) — max completions per position in the ring bufferkeymap_fim_next/keymap_fim_prev(default:<C-J>/<C-K>) — cycle through completionsChanges
s:cache_insert/s:cache_get— ring buffer per key, dedup by contents:fim_on_response— normalize server response (dict or array), insert each individuallys:fim_try_hint— simplified two-phase logics:fim_render— accept list of responses + selected index + fuzzy flagllama#fim_cycle— cycle through completions[N/M]completion index and total cached entriesAI usage disclosure: YES. llama.cpp + pi