mods icon indicating copy to clipboard operation
mods copied to clipboard

Saved Prompt Management

Open MadBomber opened this issue 2 years ago • 4 comments

I really like the work you have done on mods A new feature set that I found to be very helpful is saved parameterized prompt management. I wrote a Ruby script to see just how nice this kind of prompt management would be as a wrapper around mods I think it works out pretty nicely. It would be great if mods implemented this same kind of stuff that my Ruby wrapper does.

You can see my Ruby wrapper at https://github.com/MadBomber/scripts/blob/master/aip.rb

I define a keyword (a parameter) within a prompt as any UPPER case text within square brackets. This is a [KEYWORD OR PHRASE] in a prompt.

Prompts are saved in my $HOME directory within the ~/.prompts directory. Prompts are text files. Any line in the text file that begins with a "#" character is considered a comment and is not included in the raw prompt that is sent to mods.

Each prompt when evaluated has its keywords replaced with input from the user. This input is saved in a JSON file with the same name as the prompt. If the user runs the prompt again, that JSON file is used as default values for each of the keywords. When the user just hits return on a keyword query, the default shown in (default) parentheses is taken as the value.

An advantage of saving these parameterized prompts in a common directory is that you can make that a git repository and version control your prompts.

MadBomber avatar Sep 07 '23 17:09 MadBomber

Hi, your script is really cool! We just released our initial support for saved conversations in v1.0.0. I think we can think about templating prompts somehow eventually so will leave this issue open for discussion.

toby avatar Sep 22 '23 23:09 toby

I'm not sure if I fully understand the feature you just described, but I believe I grasped some of it. Allow me to explain how I've been utilizing this approach and how it benefits me:

I've also set up a prompts folder, and whenever I need to use a new prompt, I simply run (for example):

cat ~/prompts/example.txt | mods

This allows me to create a new conversation based on my prompt, which I can run whenever needed, saving me the time and effort of typing the same thing over and over again.

I believe that mods could implement a feature like this, where this option is expected by default, allowing me to interactively choose between the prompts that I have saved in the prompts folder.

jessicatarra avatar Dec 26 '23 19:12 jessicatarra

That is a valid simple approach. Now consider what happens when when you example.txt prompt had embedded comments not intended for the LLM. For example comments that you want to maintain with the prompt that you created while developing the pompt. You don't want these comments passed on to mods So now you have to modify your CLI to something like this pattern cat | grep | mods to remove the comments.

Now lets suppose that you create your prompt with substitutable parameters. Before the prompt is sent to mods you want to replace these parameters with a value. Consider: "As a [ROLE] do something." Now your pattern becomes something like cat | grep | sed | mods

What my aia tool does is replace all that with a front end parameterized prompt management system that removes the comments, queries for replacements to the parameters, if any, and then sends them on to mods in the backend for processing.

aia is a Ruby gem. Install: gem install aia

aia allows you to specify your directory of prompt text files - prompts_dir. aia also saves the values you have previously used for the parameters in each of your prompts so that you can reuse those as well. aia is configured from the command line, from environment variables or from a designated config file.

I like mods it is a fantastic simple tool targeted at the command line and optimized for pipeline processes. I wrote my prompt_manager library and the aia gem specifically to augment mods as a front-end to its backend processing.

https://github.com/MadBomber/aia

MadBomber avatar Dec 27 '23 15:12 MadBomber

just merged the ability to create roles and use them...

it's not prompt templates, but I think it might solve a good part of the problem

let me know what you think!

caarlos0 avatar Mar 01 '24 20:03 caarlos0

closing as I think this is fixed by roles.

thanks!

caarlos0 avatar Jun 03 '24 14:06 caarlos0