From bd0e7668f6709b8fc9cac79e42ccecafde949aff Mon Sep 17 00:00:00 2001 From: Martin Bielik Date: Sat, 21 Oct 2023 12:30:41 +0200 Subject: base_url extracted to config, docu --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 1ff7973..76996b1 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,7 @@ Below are listed all available configuration options, along with their default v " - engine: complete | chat - see how to configure chat engine in the section below " - options: openai config (see https://platform.openai.com/docs/api-reference/completions) " - options.request_timeout: request timeout in seconds +" - options.base_url: openai endpoint url " - options.selection_boundary: seleciton prompt wrapper (eliminates empty responses, see #20) " - ui.paste_mode: use paste mode (see more info in the Notes below) let g:vim_ai_complete = { @@ -215,6 +216,7 @@ let g:vim_ai_complete = { \ "max_tokens": 1000, \ "temperature": 0.1, \ "request_timeout": 20, +\ "base_url": "https://api.openai.com", \ "selection_boundary": "#####", \ }, \ "ui": { @@ -226,6 +228,7 @@ let g:vim_ai_complete = { " - engine: complete | chat - see how to configure chat engine in the section below " - options: openai config (see https://platform.openai.com/docs/api-reference/completions) " - options.request_timeout: request timeout in seconds +" - options.base_url: openai endpoint url " - options.selection_boundary: seleciton prompt wrapper (eliminates empty responses, see #20) " - ui.paste_mode: use paste mode (see more info in the Notes below) let g:vim_ai_edit = { @@ -235,6 +238,7 @@ let g:vim_ai_edit = { \ "max_tokens": 1000, \ "temperature": 0.1, \ "request_timeout": 20, +\ "base_url": "https://api.openai.com", \ "selection_boundary": "#####", \ }, \ "ui": { @@ -254,6 +258,7 @@ END " - options: openai config (see https://platform.openai.com/docs/api-reference/chat) " - options.initial_prompt: prompt prepended to every chat request (list of lines or string) " - options.request_timeout: request timeout in seconds +" - options.base_url: openai endpoint url " - options.selection_boundary: seleciton prompt wrapper (eliminates empty responses, see #20) " - ui.populate_options: put [chat-options] to the chat header " - ui.open_chat_command: preset (preset_below, preset_tab, preset_right) or a custom command @@ -265,6 +270,7 @@ let g:vim_ai_chat = { \ "max_tokens": 1000, \ "temperature": 1, \ "request_timeout": 20, +\ "base_url": "https://api.openai.com", \ "selection_boundary": "", \ "initial_prompt": s:initial_chat_prompt, \ }, @@ -314,6 +320,7 @@ let chat_engine_config = { \ "max_tokens": 1000, \ "temperature": 0.1, \ "request_timeout": 20, +\ "base_url": "https://api.openai.com", \ "selection_boundary": "", \ "initial_prompt": initial_prompt, \ }, -- cgit v1.2.3 From dca2bcf256df92196febf9bae77206bb6e51dac1 Mon Sep 17 00:00:00 2001 From: Martin Bielik Date: Sat, 21 Oct 2023 18:18:10 +0200 Subject: option to disable authorization --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 76996b1..6439b49 100644 --- a/README.md +++ b/README.md @@ -207,6 +207,7 @@ Below are listed all available configuration options, along with their default v " - options: openai config (see https://platform.openai.com/docs/api-reference/completions) " - options.request_timeout: request timeout in seconds " - options.base_url: openai endpoint url +" - options.enable_auth: enable authorization using openai key " - options.selection_boundary: seleciton prompt wrapper (eliminates empty responses, see #20) " - ui.paste_mode: use paste mode (see more info in the Notes below) let g:vim_ai_complete = { @@ -217,6 +218,7 @@ let g:vim_ai_complete = { \ "temperature": 0.1, \ "request_timeout": 20, \ "base_url": "https://api.openai.com", +\ "enable_auth": 1, \ "selection_boundary": "#####", \ }, \ "ui": { @@ -229,6 +231,7 @@ let g:vim_ai_complete = { " - options: openai config (see https://platform.openai.com/docs/api-reference/completions) " - options.request_timeout: request timeout in seconds " - options.base_url: openai endpoint url +" - options.enable_auth: enable authorization using openai key " - options.selection_boundary: seleciton prompt wrapper (eliminates empty responses, see #20) " - ui.paste_mode: use paste mode (see more info in the Notes below) let g:vim_ai_edit = { @@ -239,6 +242,7 @@ let g:vim_ai_edit = { \ "temperature": 0.1, \ "request_timeout": 20, \ "base_url": "https://api.openai.com", +\ "enable_auth": 1, \ "selection_boundary": "#####", \ }, \ "ui": { @@ -259,6 +263,7 @@ END " - options.initial_prompt: prompt prepended to every chat request (list of lines or string) " - options.request_timeout: request timeout in seconds " - options.base_url: openai endpoint url +" - options.enable_auth: enable authorization using openai key " - options.selection_boundary: seleciton prompt wrapper (eliminates empty responses, see #20) " - ui.populate_options: put [chat-options] to the chat header " - ui.open_chat_command: preset (preset_below, preset_tab, preset_right) or a custom command @@ -271,6 +276,7 @@ let g:vim_ai_chat = { \ "temperature": 1, \ "request_timeout": 20, \ "base_url": "https://api.openai.com", +\ "enable_auth": 1, \ "selection_boundary": "", \ "initial_prompt": s:initial_chat_prompt, \ }, @@ -320,7 +326,6 @@ let chat_engine_config = { \ "max_tokens": 1000, \ "temperature": 0.1, \ "request_timeout": 20, -\ "base_url": "https://api.openai.com", \ "selection_boundary": "", \ "initial_prompt": initial_prompt, \ }, -- cgit v1.2.3 From d9e1e193b6d8a8d2eb4eb2deb64d774ab5d5079b Mon Sep 17 00:00:00 2001 From: Martin Bielik Date: Sat, 21 Oct 2023 18:29:55 +0200 Subject: endpoint_url config --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 6439b49..d9d7a29 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,6 @@ Below are listed all available configuration options, along with their default v " - engine: complete | chat - see how to configure chat engine in the section below " - options: openai config (see https://platform.openai.com/docs/api-reference/completions) " - options.request_timeout: request timeout in seconds -" - options.base_url: openai endpoint url " - options.enable_auth: enable authorization using openai key " - options.selection_boundary: seleciton prompt wrapper (eliminates empty responses, see #20) " - ui.paste_mode: use paste mode (see more info in the Notes below) @@ -214,10 +213,10 @@ let g:vim_ai_complete = { \ "engine": "complete", \ "options": { \ "model": "text-davinci-003", +\ "endpoint_url": "https://api.openai.com/v1/completions", \ "max_tokens": 1000, \ "temperature": 0.1, \ "request_timeout": 20, -\ "base_url": "https://api.openai.com", \ "enable_auth": 1, \ "selection_boundary": "#####", \ }, @@ -230,7 +229,6 @@ let g:vim_ai_complete = { " - engine: complete | chat - see how to configure chat engine in the section below " - options: openai config (see https://platform.openai.com/docs/api-reference/completions) " - options.request_timeout: request timeout in seconds -" - options.base_url: openai endpoint url " - options.enable_auth: enable authorization using openai key " - options.selection_boundary: seleciton prompt wrapper (eliminates empty responses, see #20) " - ui.paste_mode: use paste mode (see more info in the Notes below) @@ -238,10 +236,10 @@ let g:vim_ai_edit = { \ "engine": "complete", \ "options": { \ "model": "text-davinci-003", +\ "endpoint_url": "https://api.openai.com/v1/completions", \ "max_tokens": 1000, \ "temperature": 0.1, \ "request_timeout": 20, -\ "base_url": "https://api.openai.com", \ "enable_auth": 1, \ "selection_boundary": "#####", \ }, @@ -262,7 +260,6 @@ END " - options: openai config (see https://platform.openai.com/docs/api-reference/chat) " - options.initial_prompt: prompt prepended to every chat request (list of lines or string) " - options.request_timeout: request timeout in seconds -" - options.base_url: openai endpoint url " - options.enable_auth: enable authorization using openai key " - options.selection_boundary: seleciton prompt wrapper (eliminates empty responses, see #20) " - ui.populate_options: put [chat-options] to the chat header @@ -272,10 +269,10 @@ END let g:vim_ai_chat = { \ "options": { \ "model": "gpt-3.5-turbo", +\ "endpoint_url": "https://api.openai.com/v1/chat/completions", \ "max_tokens": 1000, \ "temperature": 1, \ "request_timeout": 20, -\ "base_url": "https://api.openai.com", \ "enable_auth": 1, \ "selection_boundary": "", \ "initial_prompt": s:initial_chat_prompt, @@ -323,6 +320,7 @@ let chat_engine_config = { \ "engine": "chat", \ "options": { \ "model": "gpt-3.5-turbo", +\ "endpoint_url": "https://api.openai.com/v1/chat/completions", \ "max_tokens": 1000, \ "temperature": 0.1, \ "request_timeout": 20, -- cgit v1.2.3 From 61870b4bb62412772c6fb9f3c9d05b1a0586a036 Mon Sep 17 00:00:00 2001 From: Martin Bielik Date: Sat, 21 Oct 2023 18:55:10 +0200 Subject: docu on custom apis --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index d9d7a29..408e2b8 100644 --- a/README.md +++ b/README.md @@ -298,6 +298,20 @@ let g:vim_ai_chat = { " hits token limit, which respond with `OpenAI: HTTPError 400` ``` +### Using custom API + +It is possible to configure the plugin to use different OpenAI-compatible endpoints. +See some cool projects listed in [Custom APIs](https://github.com/madox2/vim-ai/wiki/Custom-APIs) section on the [Community Wiki](https://github.com/madox2/vim-ai/wiki). + +```vim +let g:vim_ai_chat = { +\ "options": { +\ "endpoint_url": "http://localhost:8000/v1/chat/completions", +\ "enable_auth": 0, +\ }, +\} +``` + ### 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. -- cgit v1.2.3