danielrosehill commited on
Commit
133a045
·
1 Parent(s): 3c7e8c9
Files changed (1) hide show
  1. app.py +48 -12
app.py CHANGED
@@ -189,7 +189,7 @@ def extract_description(text):
189
 
190
  # Create the Gradio interface
191
  with gr.Blocks(title="System Prompt Reformatter", theme=gr.themes.Soft()) as demo:
192
- gr.HTML("<h1 style='text-align: center;'>📚 System Prompt Reformatter</h1>")
193
  gr.HTML("<p style='text-align: center;'>Transform system prompts to second person and make them ecosystem-agnostic</p>")
194
 
195
  with gr.Tabs():
@@ -211,28 +211,36 @@ with gr.Blocks(title="System Prompt Reformatter", theme=gr.themes.Soft()) as dem
211
  submit_btn = gr.Button("Reformat Prompt", variant="primary")
212
 
213
  with gr.Column(scale=1):
214
- output_text = gr.Textbox(
215
- label="Reformatted System Prompt",
216
- lines=10,
217
- max_lines=20,
218
  interactive=False,
219
  show_copy_button=True
220
  )
221
- assistant_name = gr.Textbox(
222
- label="Assistant Name",
223
  interactive=False,
224
  show_copy_button=True
225
  )
226
- description = gr.Textbox(
227
- label="Description",
 
 
228
  interactive=False,
229
  show_copy_button=True
230
  )
231
 
 
 
 
 
 
 
232
  submit_btn.click(
233
- fn=reformat_system_prompt,
234
  inputs=[input_text, api_key],
235
- outputs=[output_text, assistant_name, description]
236
  )
237
 
238
  # Add example
@@ -244,6 +252,27 @@ with gr.Blocks(title="System Prompt Reformatter", theme=gr.themes.Soft()) as dem
244
  label="Example"
245
  )
246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  with gr.Tab("About"):
248
  gr.Markdown("""
249
  # System Prompt Reformatter
@@ -252,7 +281,14 @@ This tool reformats system prompts for AI assistants to follow specific stylisti
252
 
253
  ## The System Prompt Used by This Tool
254
  """)
255
- gr.Markdown(SYSTEM_INSTRUCTIONS)
 
 
 
 
 
 
 
256
  gr.Markdown("""
257
  ## How It Works
258
 
 
189
 
190
  # Create the Gradio interface
191
  with gr.Blocks(title="System Prompt Reformatter", theme=gr.themes.Soft()) as demo:
192
+ gr.HTML("<h1 style='text-align: center;'>System Prompt Reformatter</h1>")
193
  gr.HTML("<p style='text-align: center;'>Transform system prompts to second person and make them ecosystem-agnostic</p>")
194
 
195
  with gr.Tabs():
 
211
  submit_btn = gr.Button("Reformat Prompt", variant="primary")
212
 
213
  with gr.Column(scale=1):
214
+ # Output order: Name -> Description -> System Prompt
215
+ assistant_name_md = gr.Markdown()
216
+ assistant_name_copy = gr.Textbox(
217
+ label="Name",
218
  interactive=False,
219
  show_copy_button=True
220
  )
221
+ description = gr.Textbox(
222
+ label="Description",
223
  interactive=False,
224
  show_copy_button=True
225
  )
226
+ output_text = gr.Textbox(
227
+ label="Reformatted System Prompt",
228
+ lines=10,
229
+ max_lines=20,
230
  interactive=False,
231
  show_copy_button=True
232
  )
233
 
234
+ # Wrapper to format outputs for UI ordering and bold name
235
+ def reformat_system_prompt_for_ui(input_text_val, api_key_val):
236
+ reformatted, name, desc = reformat_system_prompt(input_text_val, api_key_val)
237
+ name_md = f"**{name}**" if name else ""
238
+ return name_md, name, desc, reformatted
239
+
240
  submit_btn.click(
241
+ fn=reformat_system_prompt_for_ui,
242
  inputs=[input_text, api_key],
243
+ outputs=[assistant_name_md, assistant_name_copy, description, output_text]
244
  )
245
 
246
  # Add example
 
252
  label="Example"
253
  )
254
 
255
+ with gr.Tab("Example"):
256
+ gr.Markdown(
257
+ """
258
+ ### End-to-End Example (voice-captured input)
259
+
260
+ **Before**
261
+
262
+ I would like to create an AI assistant whose purpose is taking a list of different agents that I'll provide as a document, describing the list of agents and a short summary of the functionality of each. and it should return a document which suggests how they could be deployed into a multi-agent framework with specific patterns of delegation. In other words, it will take the list I provided and, if possible, identify the agent that could serve as the primary orchestrator, sub-orchestrators, and within under them, individual agents. It can present this information as it wishes, so long as the output is in readable markdown. That might take the format of basic diagrams showing the nesting, or it could use narrative or it could do both, but I'll provide the first and then it should return that as an output.
263
+
264
+ **After**
265
+
266
+ - **Name:** **Multi-Agent Framework Advisor**
267
+ - **Description:** This assistant helps organize and deploy agents within a multi-agent framework.
268
+ - **System Prompt:**
269
+
270
+ You are an assistant designed to analyze a list of different agents provided in a document. Your task is to summarize the functionality of each agent and suggest how they could be deployed within a multi-agent framework, including specific patterns of delegation.
271
+
272
+ You will identify the agent that could serve as the primary orchestrator, sub-orchestrators, and the individual agents beneath them. Present this information in a readable markdown format, which may include basic diagrams to illustrate the nesting or a narrative description, or both, based on the information you receive.
273
+ """
274
+ )
275
+
276
  with gr.Tab("About"):
277
  gr.Markdown("""
278
  # System Prompt Reformatter
 
281
 
282
  ## The System Prompt Used by This Tool
283
  """)
284
+ gr.Textbox(
285
+ label="System Prompt (copyable)",
286
+ value=SYSTEM_INSTRUCTIONS.strip(),
287
+ lines=20,
288
+ max_lines=40,
289
+ interactive=False,
290
+ show_copy_button=True
291
+ )
292
  gr.Markdown("""
293
  ## How It Works
294