-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom assistant prompt (i.e. agent prefix/suffix) #27
Comments
@eterps could you share your "proofreader" with me? |
Sure: hooks = {
--PrtProofReader
ProofReader = function(prt, params)
local chat_system_prompt = [[
I want you to act as a proofreader. I will provide you with texts and
I would like you to review them for any spelling, grammar, or
punctuation errors. Once you have finished reviewing the text,
provide me with any necessary corrections or suggestions to improve the
text. Highlight the corrected fragments (if any) using markdown backticks.
When you have done that subsequently provide me with a slightly better
version of the text, but keep close to the original text.
Finally provide me with an ideal version of the text.
Whenever I provide you with text, you reply in this format directly:
## Corrected text:
{corrected text, or say "NO_CORRECTIONS_NEEDED" instead if there are no corrections made}
## Slightly better text
{slightly better text}
## Ideal text
{ideal text}
]]
local agent = prt.get_chat_agent()
agent.model.system = chat_system_prompt
prt.cmd.ChatNew(params, agent.model, '')
end,
} |
I am not sure if this worked at all. In the current version I changed the arguments for |
It definitely works, the markdown response of this prompt is quite elaborate. I use it with Anthropic's Claude 3.5 model. |
There is no hurry, it works for anthropic, but not for other providers. |
I found some additional information while trying to understand what's happening. prt.cmd.ChatNew(params, agent.model, '') However, that doesn't make sense because the That means that However, I also see you're working on: #29 |
Dear @eterps, I have added a lightweight chat template support. In the latest release, you can now provide custom prompt text that is part of the first message. ProofReader = function(prt, params)
local chat_prompt = [[
I want you to act as a proofreader. I will provide you with texts and
I would like you to review them for any spelling, grammar, or
punctuation errors. Once you have finished reviewing the text,
provide me with any necessary corrections or suggestions to improve the
text. Highlight the corrected fragments (if any) using markdown backticks.
When you have done that subsequently provide me with a slightly better
version of the text, but keep close to the original text.
Finally provide me with an ideal version of the text.
Whenever I provide you with text, you reply in this format directly:
## Corrected text:
{corrected text, or say "NO_CORRECTIONS_NEEDED" instead if there are no corrections made}
## Slightly better text
{slightly better text}
## Ideal text
{ideal text}
]]
prt.cmd.ChatNew(params, chat_prompt)
end |
Ah, thanks! It makes sense that way. I'll give it a try 👍 |
@frankroeder it works great, however I can imagine it might be confusing UX to some users. On line 5 in this screenshot is the Making it part of the first message is a powerful feature, but it feels quite different than having it as a system prompt for that particular chat. But like I said, it works for me, so thank you 👍 |
Now that I think of it, I can probably improve my prompt as well so that it reads less like a system prompt and has a clear separator for the text I'm pasting in. |
@eterps, I also considered this and decided to go with the message because the system prompt is not visible to the user. However, it is quite simple to make it the system prompt. The question is whether it should be appended to the existing general system prompt or replace it entirely. |
I believe replacing the prompt entirely would be preferable, as automatic merging could potentially be frustrating for users. If needed, users can always incorporate the general system prompt, which they would likely customize to suit their specific requirements for the hook in question. |
@eterps, you are right. I will change this very soon. |
@eterps Despite everything being cramped into a single row, this is how it looks when provided as a system prompt, using the former structure of |
@frankroeder looks quite clear to me. Another possibility would be to use vim folds around the system prompt so the user can expand it on demand. |
Oh, that is just my setup. You can simply call |
similarly, it would be nice to be able configure the |
@GerardGarcia Sure, I added the agent prefix with commit 2b29eb3 on the main branch. It will be part of the next release today. |
Another useful feature is being able to customise assitant prompt (i.e. agent prefix/suffix) in the responses for custom commands (for example my 'proofreader' command could have a different emoji like 👓 instead of 🦜).
Originally posted by @eterps in #23 (comment)
The text was updated successfully, but these errors were encountered: