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

Add Upsampling Prompt #14

Merged
merged 1 commit into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Chat tab

Prompt Builder tab
- Added a "Detailed view" button to toggle between a compact view and a detailed view
- Added an alternative template `:PromptGeneratorUpsampler` that generates a prompt template for chat without extensive examples (zero-shot prompt)

Configuration
- Changed default OpenAI model to GPT-4 Omni
Expand Down
5 changes: 4 additions & 1 deletion app.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ const HISTORY_SAVE = get(ENV, "PROTO_HISTORY_SAVE", true)
@in builder_detailed_view = false
@in builder_model = isempty(PT.GROQ_API_KEY) ? "gpt4o" : "gllama370"
@in builder_samples = 3
@in builder_template = "PromptGeneratorBasic"
@out builder_tpl_options = filter(
x -> occursin("PromptGenerator", string(x)), keys(PT.TEMPLATE_STORE))
# Template browser
@in template_filter = ""
@in template_submit = false
Expand Down Expand Up @@ -335,7 +338,7 @@ const HISTORY_SAVE = get(ENV, "PROTO_HISTORY_SAVE", true)
if first_run
## Generate the first version
conv_current = send_to_model(
:PromptGeneratorBasic; task = builder_question, model = builder_model)
Symbol(builder_template); task = builder_question, model = builder_model)
instructions, inputs = parse_builder(PT.last_message(conv_current))
new_sample = Dict(:name => "tab$(i)",
:label => "Sample $(i)",
Expand Down
9 changes: 6 additions & 3 deletions src/view_builder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ function tab_builder_settings()
class = "py-5",
headerstyle = "bg-blue-1", [
row(p("Prompt Builder Settings", class = "text-lg text-weight-bold pt-4")),
row([select(:builder_model, options = :model_options, label = "Model")]),
row(cell([select(:builder_model, options = :model_options, label = "Model")])),
row(class = "pt-4",
[p("Number of Samples"),
cell([
p("Number of Samples"),
slider(
1:1:10, :builder_samples, labelalways = true, snap = true,
class = "ml-4, my-5",
markers = 1)])
markers = 1)])),
row(cell([select(:builder_template, options = :builder_tpl_options,
label = "Builder Template")]))
])
])
end
Expand Down
1 change: 1 addition & 0 deletions templates/PromptGeneratorUpsampler.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"content":"Template Metadata","description":"Given a user task it generates the enhanced system (instructions) and user prompt (inputs). It contains no examples (zero-shot prompt). Placeholders: `task`","version":"1.0","source":"","_type":"metadatamessage"},{"content":"You are an expert in writing clear, comprehensive instructions for unworldly AI assistants to accomplish tasks. Your goal is to take an existing task prompt that is often succint and generic and rewrite it to be clearer, more detailed, and better aligned with best practices for instructing AI.\n\nThe existing task prompt will be provided in the <Task></Task> tags. Carefully read through this prompt and identify areas that could be improved. \n\nThen, write a new and improved version of the task prompt. The structure should be:\n<Desired Structure>\n<thinking> Provide your thinking process and the plan you aim to follow when necessary. </thinking>\n<Instructions Structure>\n- Plan out where to include each variable.\n- Variables are formatted in double handlebars like this `{{variable_name}}` and are always single word or two words in lowercase with an underscore. You may refer to this variable later in the template, but do so without the double brackets.\n- Any information that the AI requires to know before it can complete the task MUST be included in the <Inputs> tags. But there can be only 2-3 variables. Everything else must be provided in the <Instructions> tags as suggestions to fill in the details.\n- Inputs section MUST preface each variable placeholder with its name, eg, `Milk Carton: {{milk_carton}}`, `Milk Curd: {{milk_curd}}`. You may refer to this variable later in the template by using its name, avoid using the curly braces in any references.\n</Instructions Structure>\n<Instructions>\n- Specify the AI's role using superlatives to enhance performance \n- Give step-by-step instructions for the AI to follow, including:\n-- Detailed explanation of the task goal and desired output format\n-- Examples of input the AI will receive and desired output\n-- Guidance to \"think through\" the task and show its reasoning before responding\n-- Encouragement to ask clarifying questions if needed\n- Define any key terms that may be ambiguous\n- Use simple language and short sentences\n- Encourage the AI assistant to \"think step by step\" before responding. Use tags like <scratchpad></scratchpad> or <thinking></thinking> to indicate thinking process BEFORE RESPONDING. \n- Repeat the most important instructions\n</Instructions>\n<Inputs>\nA list of input variables the AI will receive, enclosed in double curly braces like {{variable_name}}. Use descriptive names and keep the number of variables to a minimum.\n</Inputs>\n\n</Desired Structure>\n\nBefore drafting the improved prompt, take time to analyze the original and brainstorm ideas for enhancement. Think step by step inside of <thinking></thinking> tags. \nYou should use apply thinking process yourself before you write any of the instructions.Aim to make the new version substantially better than the original while preserving the core task. Let your first response be your improved prompt draft, formatted as specified above.\n\n ","variables":["variable_name","milk_carton","milk_curd","variable_name"],"_type":"systemmessage"},{"content":" <Task>\n {{task}}\n </Task>\n\nTo write your instructions, follow THESE instructions first:\n1. Apply thinking process in <thinking></thinking> tags.\n2. In <Instructions Structure> tags, plan out how you will structure your instructions.\n3. In <Instructions> tags, write the instructions for the AI assistant to follow.\n4. Finally, in <Inputs> tags, write down the barebones, minimal, nonoverlapping set of text input variable(s) the instructions will make reference to. They should be formatted as double handlebars (eg, `{{variable_name}}`).\n\n\nNote: This is probably obvious to you already, but you are not *completing* the task here. You are writing instructions for an AI to complete the task.\nNote: If the task is particularly complicated, you may wish to instruct the AI to think things out beforehand in scratchpad or inner monologue XML tags before it gives its final answer. For simple tasks, omit this.\nNote: If you want the AI to output its entire response or parts of its response inside certain tags, specify the name of these tags (e.g. \"write your answer inside <answer> tags\") but do not include closing tags or unnecessary open-and-close tag sections.\n ","variables":["task","variable_name"],"_type":"usermessage"}]
Loading