Skip to content

Commit

Permalink
bug(provider) fix system prompting
Browse files Browse the repository at this point in the history
- bump version
  • Loading branch information
frankroeder committed Jul 16, 2024
1 parent 440159c commit c45bbc3
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Let the parrot fix your bugs.
```lua
{
"frankroeder/parrot.nvim",
tag = "v0.3.4",
tag = "v0.3.5",
dependencies = { 'ibhagwan/fzf-lua', 'nvim-lua/plenary.nvim' },
config = function()
require("parrot").setup {
Expand Down
5 changes: 4 additions & 1 deletion lua/parrot/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1578,7 +1578,10 @@ M.Prompt = function(params, target, prompt, model, template, system_template, ag
M.logger.error("Mismatch of agent and current provider " .. prov.name .. " and " .. agent_provider)
return
end
messages = prov:add_system_prompt(messages, sys_prompt)

if sys_prompt ~= "" then
table.insert(messages, { role = "system", content = sys_prompt })
end

local repo_instructions = futils.find_repo_instructions()
if repo_instructions ~= "" and sys_prompt ~= "" then
Expand Down
4 changes: 0 additions & 4 deletions lua/parrot/provider/anthropic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ function Anthropic:verify()
end
end

function Anthropic:add_system_prompt(messages, _)
return messages
end

function Anthropic:process(line)
if line:match("content_block_delta") and line:match("text_delta") then
local decoded_line = vim.json.decode(line)
Expand Down
4 changes: 0 additions & 4 deletions lua/parrot/provider/gemini.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ function Gemini:verify()
end
end

function Gemini:add_system_prompt(messages, _)
return messages
end

function Gemini:process(line)
local pattern = '"text":'
if line:match(pattern) then
Expand Down
7 changes: 0 additions & 7 deletions lua/parrot/provider/mistral.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ function Mistral:verify()
end
end

function Mistral:add_system_prompt(messages, sys_prompt)
if sys_prompt ~= "" then
table.insert(messages, { role = "system", content = sys_prompt })
end
return messages
end

function Mistral:process(line)
if line:match("chat%.completion%.chunk") or line:match("chat%.completion") then
line = vim.json.decode(line)
Expand Down
7 changes: 0 additions & 7 deletions lua/parrot/provider/ollama.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ function Ollama:verify()
return true
end

function Ollama:add_system_prompt(messages, sys_prompt)
if sys_prompt ~= "" then
table.insert(messages, { role = "system", content = sys_prompt })
end
return messages
end

function Ollama:process(line)
if line:match("message") and line:match("content") then
line = vim.json.decode(line)
Expand Down
7 changes: 0 additions & 7 deletions lua/parrot/provider/openai.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ function OpenAI:verify()
end
end

function OpenAI:add_system_prompt(messages, sys_prompt)
if sys_prompt ~= "" then
table.insert(messages, { role = "system", content = sys_prompt })
end
return messages
end

function OpenAI:process(line)
if line:match("chat%.completion%.chunk") or line:match("chat%.completion") then
line = vim.json.decode(line)
Expand Down
7 changes: 0 additions & 7 deletions lua/parrot/provider/perplexity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@ function Perplexity:verify()
end
end

function Perplexity:add_system_prompt(messages, sys_prompt)
if sys_prompt ~= "" then
table.insert(messages, { role = "system", content = sys_prompt })
end
return messages
end

function Perplexity:process(line)
if line:match("chat%.completion%.chunk") or line:match("chat%.completion") then
line = vim.json.decode(line)
Expand Down

0 comments on commit c45bbc3

Please sign in to comment.