diff options
author | AustinMroz <austinmroz@utexas.edu> | 2023-08-08 06:44:48 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-08 14:44:48 +0300 |
commit | 2d7baaf50f3277e65cf71071f61ea34823d14c30 (patch) | |
tree | 7be5c387918f7a1722028edb29c976b9be02a55c /examples/llm.vim | |
parent | f3c3b4b1672d860800639c87d3b5d17564692469 (diff) |
vim : streaming and more (#2495)
* Update Vim plugin
* Remove getbufoneline usage, Add input bind example.
getbufoneline() appears to be a recently added function and has been
replaced with getbufline for compatibility.
An additional example that explains how to add a keybind that works in
insert mode was added.
Diffstat (limited to 'examples/llm.vim')
-rw-r--r-- | examples/llm.vim | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/examples/llm.vim b/examples/llm.vim deleted file mode 100644 index efecad0..0000000 --- a/examples/llm.vim +++ /dev/null @@ -1,23 +0,0 @@ -function! Llm() - - let url = "http://127.0.0.1:8080/completion" - - " Get the content of the current buffer - let buffer_content = join(getline(1, '$'), "\n") - - " Create the JSON payload - let json_payload = {"temp":0.72,"top_k":100,"top_p":0.73,"repeat_penalty":1.100000023841858,"n_predict":10,"stream": v:false} - let json_payload.prompt = buffer_content - - " Define the curl command - let curl_command = 'curl -k -s -X POST -H "Content-Type: application/json" -d @- ' . url - let response = system(curl_command, json_encode(json_payload)) - - " Extract the content field from the response - let content = json_decode(response).content - - " Insert the content at the cursor position - call setline(line('.'), getline('.') . content) -endfunction - -command! Llm call Llm() |