Spaces:
Sleeping
Sleeping
Tan Hong Ming commited on
Commit ·
4c1b4d9
1
Parent(s): 0559e8e
instructor tools and reference prompt
Browse files86 unmodified lines878889909192258 unmodified lines35135235335435535635735835936036136236336436536636754 unmodified lines4224234244254264271 unmodified line42943043143243343486 unmodified lines- Do not call the tool unless it is genuinely needed"""SAMPLE_EMAILS = {"Customer Complaint": """Subject: Delayed shipment SG-18427258 unmodified linesload_advanced_tool_btn = gr.Button("Load Advanced (Tool)")with gr.Accordion("What makes a good agent prompt?", open=False):gr.Markdown("""- role- task- decision criteria- routing rules- output format- tone- handling ambiguity- when to use the tool and when not to use it""")with gr.Column(scale=1):gr.Markdown("## Test Input")gr.Markdown("Load a sample email or paste your own.")54 unmodified linesdef load_advanced_tool():return ADVANCED_TOOL_CALLING_PROMPTdef load_email(sample_name):return SAMPLE_EMAILS[sample_name]1 unmodified lineload_structured_btn.click(fn=load_structured, outputs=system_prompt)load_advanced_btn.click(fn=load_advanced, outputs=system_prompt)load_advanced_tool_btn.click(fn=load_advanced_tool, outputs=system_prompt)btn_customer.click(fn=lambda: load_email("Customer Complaint"), outputs=email)btn_sales.click(fn=lambda: load_email("Sales Inquiry"), outputs=email)86 unmodified lines87888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133258 unmodified lines39239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342454 unmodified lines4794804814824834844854864871 unmodified line48949049149249349449586 unmodified lines- Do not call the tool unless it is genuinely needed"""YOUR_REFERENCE_PROMPT = """You are an enterprise email triage agent.Your job is to analyze incoming emails and decide how they should be handled.You have access to one tool:lookup_status(reference_id)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.If you decide to use the tool, respond with exactly this format and nothing else:CALL_TOOL: lookup_status <reference_id>Examples:CALL_TOOL: lookup_status SG-18427CALL_TOOL: lookup_status INC-2041If you call the tool, do not include any explanation or answer. Only return the tool call.If no tool is needed, then provide your final answer directly.With no tool call the Final output format should be:Intent:Priority:Owner:Action:Reasoning:Draft Reply:With tool call the Final output format should be:CALL_TOOL: lookup_status <reference_id>Rules:- Be concise and practical- If the email is ambiguous, say so clearly- If there is urgency, reflect that in both priority and action- Keep the draft reply professional and appropriate for business use- Do not call the tool unless it is genuinely needed"""SAMPLE_EMAILS = {"Customer Complaint": """Subject: Delayed shipment SG-18427258 unmodified linesload_advanced_tool_btn = gr.Button("Load Advanced (Tool)")with gr.Accordion("What makes a good agent prompt?", open=False):gr.Markdown("""- role- task- decision criteria- routing rules- output format- tone- handling ambiguity- when to use the tool and when not to use it""")with gr.Accordion("Instructor Tools", open=False):gr.Markdown("""### How to use this app in a session1. Ask participants to start with Basic / Structured prompts2. Let them test and struggle with outputs3. Introduce tool calling concept4. Have them refine prompts to trigger tool correctly5. Only then reveal the reference promptKey teaching point:Participants are designing agent behavior, not just prompting.""")load_reference_btn = gr.Button("Load Reference Prompt")with gr.Column(scale=1):gr.Markdown("## Test Input")gr.Markdown("Load a sample email or paste your own.")54 unmodified linesdef load_advanced_tool():return ADVANCED_TOOL_CALLING_PROMPTdef load_reference():return YOUR_REFERENCE_PROMPTdef load_email(sample_name):return SAMPLE_EMAILS[sample_name]1 unmodified lineload_structured_btn.click(fn=load_structured, outputs=system_prompt)load_advanced_btn.click(fn=load_advanced, outputs=system_prompt)load_advanced_tool_btn.click(fn=load_advanced_tool, outputs=system_prompt)load_reference_btn.click(fn=load_reference, outputs=system_prompt)btn_customer.click(fn=lambda: load_email("Customer Complaint"), outputs=email)btn_sales.click(fn=lambda: load_email("Sales Inquiry"), outputs=email)
app.py+70-9