Skip to content
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

Saved Prompt Management #125

Open
MadBomber opened this issue Sep 7, 2023 · 4 comments
Open

Saved Prompt Management #125

MadBomber opened this issue Sep 7, 2023 · 4 comments

Comments

@MadBomber
Copy link

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.

@toby
Copy link
Contributor

toby commented Sep 22, 2023

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.

@jessicatarra
Copy link
Contributor

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.

@MadBomber
Copy link
Author

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

@caarlos0
Copy link
Member

caarlos0 commented Mar 1, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants