From a37328c59c5e42c5286f0032cece05e3ddc1e692 Mon Sep 17 00:00:00 2001 From: Martin Bielik Date: Wed, 5 Apr 2023 18:53:43 +0200 Subject: chat engine docu, defaults --- README.md | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index f92377c..b7d9577 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,6 @@ nnoremap c :AIChat nnoremap r :AIRedo ``` - ### Interface configuration Default interface configuration: @@ -155,7 +154,9 @@ Below are listed available options along with default values: ```vim " :AI " - https://platform.openai.com/docs/api-reference/completions +" - see how to configure chat engine for completion in the section below let g:vim_ai_complete = { +\ "engine": "complete", \ "options": { \ "model": "text-davinci-003", \ "max_tokens": 1000, @@ -166,7 +167,9 @@ let g:vim_ai_complete = { " :AIEdit " - https://platform.openai.com/docs/api-reference/completions +" - see how to configure chat engine for edits in the section below let g:vim_ai_edit = { +\ "engine": "complete", \ "options": { \ "model": "text-davinci-003", \ "max_tokens": 1000, @@ -183,10 +186,44 @@ let g:vim_ai_chat = { \ "max_tokens": 1000, \ "temperature": 1, \ "request_timeout": 10, +\ "initial_prompt": "", \ }, \} ``` +### Using chat engine for completion and edits + +It is possible to configure chat models, such as `gpt-3.5-turbo`, to be used in `:AI` and `:AIEdit` commands. +These models are cheaper, but currently less suitable for code editing/completion, as they respond with human-like text and commentary. + +Depending on the use case, a good initial prompt can help to instruct the chat model to respond in the desired way: + +```vim +let initial_prompt =<< trim END +>>> system + +You are going to play a role of a completion engine with following parameters: +Task: Provide compact code/text completion, generation, transformation or explanation +Topic: general programming and text editing +Style: Plain result without any commentary, unless commentary is necessary +Audience: Users of text editor and programmers that need to transform/generate text +END + +let chat_engine_config = { +\ "engine": "chat", +\ "options": { +\ "model": "gpt-3.5-turbo", +\ "max_tokens": 1000, +\ "temperature": 0.1, +\ "request_timeout": 20, +\ "initial_prompt": initial_prompt, +\ }, +\} + +let g:vim_ai_complete = chat_engine_config +let g:vim_ai_complete = chat_engine_config +``` + ### Custom commands To customize and re-use prompts it is useful to put some context in it. You can do it by prepending text to AI commands. -- cgit v1.2.3