@@ -734,7 +734,7 @@ Here are some more examples:
734734 .. " ```{{filetype}}\n {{selection}}\n ```\n\n "
735735 .. " Please respond by writing table driven unit tests for the code above."
736736 local agent = gp .get_command_agent ()
737- gp .Prompt (params , gp .Target .enew , nil , agent . model , template , agent . system_prompt )
737+ gp .Prompt (params , gp .Target .vnew , agent , template )
738738 end ,
739739 ````
740740
@@ -747,7 +747,7 @@ Here are some more examples:
747747 .. " ```{{filetype}}\n {{selection}}\n ```\n\n "
748748 .. " Please respond by explaining the code above."
749749 local agent = gp .get_chat_agent ()
750- gp .Prompt (params , gp .Target .popup , nil , agent . model , template , agent . system_prompt )
750+ gp .Prompt (params , gp .Target .popup , agent , template )
751751 end ,
752752 ````
753753
@@ -760,7 +760,7 @@ Here are some more examples:
760760 .. " ```{{filetype}}\n {{selection}}\n ```\n\n "
761761 .. " Please analyze for code smells and suggest improvements."
762762 local agent = gp .get_chat_agent ()
763- gp .Prompt (params , gp .Target .enew (" markdown" ), nil , agent . model , template , agent . system_prompt )
763+ gp .Prompt (params , gp .Target .enew (" markdown" ), agent , template )
764764 end ,
765765 ````
766766
@@ -769,9 +769,12 @@ Here are some more examples:
769769 ``` lua
770770 -- example of adding command which opens new chat dedicated for translation
771771 Translator = function (gp , params )
772- local agent = gp .get_command_agent ()
773- local chat_system_prompt = " You are a Translator, please translate between English and Chinese."
774- gp .cmd .ChatNew (params , agent .model , chat_system_prompt )
772+ local chat_system_prompt = " You are a Translator, please translate between English and Chinese."
773+ gp .cmd .ChatNew (params , chat_system_prompt )
774+
775+ -- -- you can also create a chat with a specific fixed agent like this:
776+ -- local agent = gp.get_chat_agent("ChatGPT4o")
777+ -- gp.cmd.ChatNew(params, chat_system_prompt, agent)
775778 end ,
776779 ```
777780
@@ -786,7 +789,16 @@ Here are some more examples:
786789 end ,
787790 ```
788791
789- The raw plugin text editing method ` Prompt ` has seven aprameters:
792+ The raw plugin text editing method ` Prompt ` has following signature:
793+ ``` lua
794+ --- @param params table # vim command parameters such as range, args, etc.
795+ --- @param target integer | function | table # where to put the response
796+ --- @param agent table # obtained from get_command_agent or get_chat_agent
797+ --- @param template string # template with model instructions
798+ --- @param prompt string | nil # nil for non interactive commads
799+ --- @param whisper string | nil # predefined input (e.g. obtained from Whisper)
800+ Prompt (params , target , agent , template , prompt , whisper )
801+ ```
790802
791803- ` params ` is a [ table passed to neovim user commands] ( https://neovim.io/doc/user/lua-guide.html#lua-guide-commands-create ) , ` Prompt ` currently uses:
792804
@@ -871,13 +883,14 @@ The raw plugin text editing method `Prompt` has seven aprameters:
871883 }
872884 ```
873885
874- - ` prompt `
875- - string used similarly as bash/zsh prompt in terminal, when plugin asks for user command to gpt.
876- - if ` nil ` , user is not asked to provide input (for specific predefined commands - document this, explain that, write tests ..)
877- - simple ` 🤖 ~ ` might be used or you could use different msg to convey info about the method which is called
878- (` 🤖 rewrite ~ ` , ` 🤖 popup ~ ` , ` 🤖 enew ~ ` , ` 🤖 inline ~ ` , etc.)
879- - ` model `
880- - see [ gpt model overview] ( https://platform.openai.com/docs/models/overview )
886+
887+ - ` agent ` table obtainable via ` get_command_agent ` and ` get_chat_agent ` methods which have following signature:
888+ ``` lua
889+ --- @param name string | nil
890+ --- @return table # { cmd_prefix, name, model, system_prompt, provider }
891+ get_command_agent (name )
892+ ```
893+
881894- ` template `
882895
883896 - template of the user message send to gpt
@@ -889,7 +902,10 @@ The raw plugin text editing method `Prompt` has seven aprameters:
889902 | ` {{selection}} ` | last or currently selected text |
890903 | ` {{command}} ` | instructions provided by the user |
891904
892- - ` system_template `
893- - See [ gpt api intro] ( https://platform.openai.com/docs/guides/chat/introduction )
905+ - ` prompt `
906+ - string used similarly as bash/zsh prompt in terminal, when plugin asks for user command to gpt.
907+ - if ` nil ` , user is not asked to provide input (for specific predefined commands - document this, explain that, write tests ..)
908+ - simple ` 🤖 ~ ` might be used or you could use different msg to convey info about the method which is called
909+ (` 🤖 rewrite ~ ` , ` 🤖 popup ~ ` , ` 🤖 enew ~ ` , ` 🤖 inline ~ ` , etc.)
894910- ` whisper `
895911 - optional string serving as a default for input prompt (for example generated from speech by Whisper)
0 commit comments