Tan Hong Ming commited on
Commit
4c1b4d9
·
1 Parent(s): 0559e8e

instructor tools and reference prompt

Browse files
Files changed (1) hide show
  1. app.py +70 -9
app.py CHANGED
@@ -87,6 +87,47 @@ Rules:
87
  - Do not call the tool unless it is genuinely needed
88
  """
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  SAMPLE_EMAILS = {
91
  "Customer Complaint": """Subject: Delayed shipment SG-18427
92
 
@@ -351,17 +392,33 @@ with gr.Blocks(title="Executive Agent Lab") as demo:
351
  load_advanced_tool_btn = gr.Button("Load Advanced (Tool)")
352
 
353
  with gr.Accordion("What makes a good agent prompt?", open=False):
354
- gr.Markdown(
355
- """- role
356
- - task
357
- - decision criteria
358
- - routing rules
359
- - output format
360
- - tone
361
- - handling ambiguity
362
- - when to use the tool and when not to use it"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
  )
364
 
 
 
365
  with gr.Column(scale=1):
366
  gr.Markdown("## Test Input")
367
  gr.Markdown("Load a sample email or paste your own.")
@@ -422,6 +479,9 @@ with gr.Blocks(title="Executive Agent Lab") as demo:
422
  def load_advanced_tool():
423
  return ADVANCED_TOOL_CALLING_PROMPT
424
 
 
 
 
425
  def load_email(sample_name):
426
  return SAMPLE_EMAILS[sample_name]
427
 
@@ -429,6 +489,7 @@ with gr.Blocks(title="Executive Agent Lab") as demo:
429
  load_structured_btn.click(fn=load_structured, outputs=system_prompt)
430
  load_advanced_btn.click(fn=load_advanced, outputs=system_prompt)
431
  load_advanced_tool_btn.click(fn=load_advanced_tool, outputs=system_prompt)
 
432
 
433
  btn_customer.click(fn=lambda: load_email("Customer Complaint"), outputs=email)
434
  btn_sales.click(fn=lambda: load_email("Sales Inquiry"), outputs=email)
 
87
  - Do not call the tool unless it is genuinely needed
88
  """
89
 
90
+ YOUR_REFERENCE_PROMPT = """You are an enterprise email triage agent.
91
+
92
+ Your job is to analyze incoming emails and decide how they should be handled.
93
+
94
+ You have access to one tool:
95
+
96
+ lookup_status(reference_id)
97
+
98
+ Use this tool only when the email refers to a specific order, shipment, incident, or ticket and the current status is needed to answer well.
99
+
100
+ If you decide to use the tool, respond with exactly this format and nothing else:
101
+
102
+ CALL_TOOL: lookup_status <reference_id>
103
+
104
+ Examples:
105
+ CALL_TOOL: lookup_status SG-18427
106
+ CALL_TOOL: lookup_status INC-2041
107
+
108
+ If you call the tool, do not include any explanation or answer. Only return the tool call.
109
+ If no tool is needed, then provide your final answer directly.
110
+
111
+ With no tool call the Final output format should be:
112
+
113
+ Intent:
114
+ Priority:
115
+ Owner:
116
+ Action:
117
+ Reasoning:
118
+ Draft Reply:
119
+
120
+ With tool call the Final output format should be:
121
+ CALL_TOOL: lookup_status <reference_id>
122
+
123
+ Rules:
124
+ - Be concise and practical
125
+ - If the email is ambiguous, say so clearly
126
+ - If there is urgency, reflect that in both priority and action
127
+ - Keep the draft reply professional and appropriate for business use
128
+ - Do not call the tool unless it is genuinely needed
129
+ """
130
+
131
  SAMPLE_EMAILS = {
132
  "Customer Complaint": """Subject: Delayed shipment SG-18427
133
 
 
392
  load_advanced_tool_btn = gr.Button("Load Advanced (Tool)")
393
 
394
  with gr.Accordion("What makes a good agent prompt?", open=False):
395
+ gr.Markdown("""
396
+ - role
397
+ - task
398
+ - decision criteria
399
+ - routing rules
400
+ - output format
401
+ - tone
402
+ - handling ambiguity
403
+ - when to use the tool and when not to use it"""
404
+ )
405
+
406
+ with gr.Accordion("Instructor Tools", open=False):
407
+ gr.Markdown("""
408
+ ### How to use this app in a session
409
+
410
+ 1. Ask participants to start with Basic / Structured prompts
411
+ 2. Let them test and struggle with outputs
412
+ 3. Introduce tool calling concept
413
+ 4. Have them refine prompts to trigger tool correctly
414
+ 5. Only then reveal the reference prompt
415
+
416
+ Key teaching point:
417
+ Participants are designing agent behavior, not just prompting."""
418
  )
419
 
420
+ load_reference_btn = gr.Button("Load Reference Prompt")
421
+
422
  with gr.Column(scale=1):
423
  gr.Markdown("## Test Input")
424
  gr.Markdown("Load a sample email or paste your own.")
 
479
  def load_advanced_tool():
480
  return ADVANCED_TOOL_CALLING_PROMPT
481
 
482
+ def load_reference():
483
+ return YOUR_REFERENCE_PROMPT
484
+
485
  def load_email(sample_name):
486
  return SAMPLE_EMAILS[sample_name]
487
 
 
489
  load_structured_btn.click(fn=load_structured, outputs=system_prompt)
490
  load_advanced_btn.click(fn=load_advanced, outputs=system_prompt)
491
  load_advanced_tool_btn.click(fn=load_advanced_tool, outputs=system_prompt)
492
+ load_reference_btn.click(fn=load_reference, outputs=system_prompt)
493
 
494
  btn_customer.click(fn=lambda: load_email("Customer Complaint"), outputs=email)
495
  btn_sales.click(fn=lambda: load_email("Sales Inquiry"), outputs=email)