No system prompt for Anthropic? #22
-
Am I right in assuming that currently there is no support for |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 14 replies
-
Hmmm, it seems it should support Maybe obivous questions for people who have authored nvim plugins more often, but I'm a bit in the dark on this. |
Beta Was this translation helpful? Give feedback.
-
Anthropic expects the system prompt inside the curl parameters (https://docs.anthropic.com/en/api/messages) and not inside the messages with Yes, it definitely would be helpful to write a comment or document it somewhere. parrot.nvim/lua/parrot/agents.lua Line 119 in 2719099 You can see my print statements for the messages, header and agent.model below, comparing Anthropic and OpenAI: I hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the explanation @frankroeder , it seems the system prompt doesn't end up in the curl params.
|
Beta Was this translation helpful? Give feedback.
-
Hi @eterps, they definitely end up in the request, otherwise the topic model would not be able to generate a 2-3 word topic headlines for the chats. Have a look at the BTW, I think it is always good to double proof things. I really appreciate your effort! |
Beta Was this translation helpful? Give feedback.
-
Ok, found some more details. For instance, this config results in the curl params below it: {
"frankroeder/parrot.nvim",
dependencies = { 'ibhagwan/fzf-lua', 'nvim-lua/plenary.nvim' },
opts = {
providers = {
anthropic = { api_key = os.getenv "ANTHROPIC_API_KEY" }
}
}
}
While this config results in the curl params below (notice the system prompt missing in the first, but still present in the second curl request): {
"frankroeder/parrot.nvim",
dependencies = { 'ibhagwan/fzf-lua', 'nvim-lua/plenary.nvim' },
opts = {
providers = {
anthropic = { api_key = os.getenv "ANTHROPIC_API_KEY" }
}
agents = {
chat = {
{
name = "CustomClaude",
provider = "anthropic",
model = {
model = "claude-3-5-sonnet-20240620",
max_tokens = 4096
},
system_prompt = "Help me!"
}
}
}
}
}
I'll see if I can locate the problem, but if you have an idea what might be wrong I would appreciate it. |
Beta Was this translation helpful? Give feedback.
Anthropic expects the system prompt inside the curl parameters (https://docs.anthropic.com/en/api/messages) and not inside the messages with
role = system
, like the OpenAI API.Yes, it definitely would be helpful to write a comment or document it somewhere.
By default, all providers have the system prompt defines as OpenAI. However, for Anthropic I implement this exception by removing the default system prompt
parrot.nvim/lua/parrot/provider/anthropic.lua
Line 43 in 2719099
parrot.nvim/lua/parrot/agents.lua
Line 119 in 2719099