Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5aaf247
llama : add infill sampler
ggerganov Oct 9, 2024
0566c69
llama.vim : neovim plugin
ggerganov Oct 9, 2024
0c649c8
llama.vim : fix suffix construction + fix virt text offset
ggerganov Oct 9, 2024
07e7dd4
llama.vim : handle space
ggerganov Oct 9, 2024
9d13e87
llama.vim : add processing info overlay
ggerganov Oct 9, 2024
6e82a03
llama.vim : display realtime [no ci]
ggerganov Oct 9, 2024
26a0c61
llama.vim : allow repeated suggestions [no ci]
ggerganov Oct 9, 2024
7e0b506
llama.vim : reduce scope of ids to local [no ci]
ggerganov Oct 9, 2024
41053f9
llama.vim : simplify init and cancel + auto-fim
ggerganov Oct 10, 2024
c507a65
llama.vim : async
ggerganov Oct 10, 2024
6669b55
llama.vim : set time limit for the generation phase
ggerganov Oct 10, 2024
2e8c350
llama.vim : fix edge cases
ggerganov Oct 10, 2024
4b1bd81
llama : simplify infill sampler
ggerganov Oct 10, 2024
865d9bc
llama : clean-up
ggerganov Oct 11, 2024
c9a46f4
llama.vim : minor [no ci]
ggerganov Oct 11, 2024
5624e91
llama.vim : fix docs [no ci]
ggerganov Oct 11, 2024
491f211
llama : improve infill sampler
ggerganov Oct 11, 2024
4f46e29
llama : print more info about control tokens
ggerganov Oct 13, 2024
b889022
llama.vim : add ring context from opened files and yanked text
ggerganov Oct 13, 2024
27bc11d
llama.vim : update server command [no ci]
ggerganov Oct 13, 2024
f794549
llama.vim : gather chunk on leaving buffer [no ci]
ggerganov Oct 13, 2024
27d53cb
llama.vim : logic to evict old chunks that are similar to new one
ggerganov Oct 13, 2024
d81a0ac
llama.vim : do not evict certain chunks [no ci]
ggerganov Oct 13, 2024
2960510
llama.vim : do not auto-fim when far from the end of the line [no ci]
ggerganov Oct 13, 2024
bc2857b
llama.vim : async context processing
ggerganov Oct 13, 2024
916c2ee
llama : simplify infill sampler
ggerganov Oct 13, 2024
ae76a09
llama.vim : pass filenames for each chunk
ggerganov Oct 13, 2024
9f8fa90
llama.vim : fix repetitions [no ci]
ggerganov Oct 13, 2024
25ecb35
llama.vim : simplify job logic + improve robustness and responsivness
ggerganov Oct 14, 2024
e4be74b
llama.vim : add top_p + improve responsivness + fix edge cases
ggerganov Oct 15, 2024
0c1f51b
llama : improve infill sampler
ggerganov Oct 15, 2024
42a9008
llama.vim : process extra chunks in the background [no ci]
ggerganov Oct 15, 2024
060573f
llama.vim : add comments [no ci]
ggerganov Oct 15, 2024
847c8c0
llama.vim : update infill API params [no ci]
ggerganov Oct 15, 2024
4583aef
llama.vim : final touches
ggerganov Oct 15, 2024
d1b8b21
llama.vim : fix repetitions of existing text
ggerganov Oct 17, 2024
1600d84
llama.vim : complete only whithin the local scope [no ci]
ggerganov Oct 17, 2024
6bb6e6d
llama.vim : display ring capacity [no ci]
ggerganov Oct 18, 2024
fe78c39
llama.vim : fix large chunk accept + comments [no ci]
ggerganov Oct 18, 2024
b8efb07
llama.vim : minor [no ci]
ggerganov Oct 18, 2024
32927e6
llama.vim : remove on-hold code + fixes [no ci]
ggerganov Oct 21, 2024
8fb5154
llama.vim : minor [no ci]
ggerganov Oct 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
llama.vim : fix edge cases
  • Loading branch information
ggerganov committed Oct 21, 2024
commit 2e8c350a5f5f70c913b68c539f065a4be22458a4
44 changes: 29 additions & 15 deletions examples/llama.vim
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ function! llama#fim(is_auto) abort
\ 'infill_p_eog': 0.001,
\ 'stream': v:false,
\ 'samplers': ["top_k", "infill"],
"\ 'cache_prompt': v:true,
\ 't_max_prompt_ms': g:llama_config.t_max_prompt_ms,
\ 't_max_predict_ms': g:llama_config.t_max_predict_ms,
\ 'cache_prompt': v:true
\ 't_max_predict_ms': g:llama_config.t_max_predict_ms
\ })

let l:curl_command = printf(
Expand All @@ -111,10 +111,21 @@ function! llama#fim(is_auto) abort
" send the request asynchronously
let s:current_job = jobstart(l:curl_command, {
\ 'on_stdout': function('s:fim_on_stdout'),
\ 'on_exit': function('s:fim_on_exit'),
\ 'on_exit': function('s:fim_on_exit'),
\ 'stdout_buffered': v:true,
\ 'is_auto': a:is_auto
\ })

" this trick is needed to avoid the cursor shifting upon C-O when at the end of the line
if !a:is_auto
augroup llama_insert
autocmd!
augroup END

if g:llama_config.auto_fim
call timer_start(0, {-> s:fim_auto_enable()})
endif
endif
endfunction

function! llama#fim_accept()
Expand Down Expand Up @@ -151,9 +162,16 @@ function! llama#fim_cancel()

augroup llama_insert
autocmd!
if g:llama_config.auto_fim
autocmd CursorMovedI * call s:fim_auto()
endif
augroup END

if g:llama_config.auto_fim
call s:fim_auto_enable()
endif
endfunction

function! s:fim_auto_enable()
augroup llama_insert
autocmd CursorMovedI * call s:fim_auto()
augroup END
endfunction

Expand All @@ -176,6 +194,9 @@ endfunction

function! s:fim_on_stdout(job_id, data, event) dict
let l:raw = join(a:data, "\n")
if len(l:raw) == 0
return
endif

let s:can_accept = v:true
let l:has_info = v:false
Expand All @@ -195,13 +216,6 @@ function! s:fim_on_stdout(job_id, data, event) dict
let s:can_accept = v:false
endif

if s:can_accept && l:raw == ""
if !self.is_auto
call add(s:content, "<| empty response: is the server on? |>")
endif
let s:can_accept = v:false
endif

" get the generated suggestion
if s:can_accept
let l:response = json_decode(l:raw)
Expand Down Expand Up @@ -232,7 +246,7 @@ function! s:fim_on_stdout(job_id, data, event) dict

if len(s:content) == 0
if !self.is_auto
call add(s:content, "<| nothing to suggest |>")
call add(s:content, "<| EOT |>")
endif
let s:can_accept = v:false
endif
Expand Down Expand Up @@ -272,7 +286,7 @@ function! s:fim_on_stdout(job_id, data, event) dict

call nvim_buf_set_extmark(l:bufnr, l:id_vt_fim, s:pos_y - 1, s:pos_x - 1, {
\ 'virt_text': [[s:content[0], 'llama_hl_hint']],
\ 'virt_text_win_col': s:pos_x == len(s:line_cur) ? virtcol('.') : virtcol('.') - 1
\ 'virt_text_win_col': virtcol('.') - 1
\ })

call nvim_buf_set_extmark(l:bufnr, l:id_vt_fim, s:pos_y - 1, 0, {
Expand Down