Spaces:
Running
Running
Commit
Β·
ffe25f1
1
Parent(s):
b316f4f
feat: Add advanced quick action buttons for agent chat
Browse files- Add 'Multi-Tool Analysis' button: chains analyze_leaderboard β compare_runs β estimate_cost
- Add 'Generate Synthetic Data' button: chains generate_synthetic_dataset β generate_prompt_template β push_dataset_to_hub
- Organize quick actions into Basic and Advanced sections
- Demonstrates multi-step autonomous agent workflows
- app.py +12 -0
- screens/chat.py +8 -1
app.py
CHANGED
|
@@ -3812,6 +3812,18 @@ Result: {result}
|
|
| 3812 |
outputs=[chat_components['message']]
|
| 3813 |
)
|
| 3814 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3815 |
# Compare button handler
|
| 3816 |
compare_components['compare_button'].click(
|
| 3817 |
fn=lambda run_a, run_b: handle_compare_runs(run_a, run_b, leaderboard_df_cache, compare_components),
|
|
|
|
| 3812 |
outputs=[chat_components['message']]
|
| 3813 |
)
|
| 3814 |
|
| 3815 |
+
chat_components['quick_multi_tool'].click(
|
| 3816 |
+
fn=lambda: on_quick_action("multi_tool"),
|
| 3817 |
+
inputs=[],
|
| 3818 |
+
outputs=[chat_components['message']]
|
| 3819 |
+
)
|
| 3820 |
+
|
| 3821 |
+
chat_components['quick_synthetic'].click(
|
| 3822 |
+
fn=lambda: on_quick_action("synthetic"),
|
| 3823 |
+
inputs=[],
|
| 3824 |
+
outputs=[chat_components['message']]
|
| 3825 |
+
)
|
| 3826 |
+
|
| 3827 |
# Compare button handler
|
| 3828 |
compare_components['compare_button'].click(
|
| 3829 |
fn=lambda run_a, run_b: handle_compare_runs(run_a, run_b, leaderboard_df_cache, compare_components),
|
screens/chat.py
CHANGED
|
@@ -554,10 +554,15 @@ def create_chat_ui():
|
|
| 554 |
|
| 555 |
# Quick actions
|
| 556 |
gr.Markdown("### β‘ Quick Actions")
|
|
|
|
| 557 |
components['quick_analyze'] = gr.Button("π Analyze Leaderboard", size="sm")
|
| 558 |
components['quick_costs'] = gr.Button("π° Compare Costs", size="sm")
|
| 559 |
components['quick_recommend'] = gr.Button("π― Get Recommendations", size="sm")
|
| 560 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 561 |
return chat_screen, components
|
| 562 |
|
| 563 |
|
|
@@ -587,6 +592,8 @@ def on_quick_action(action_type):
|
|
| 587 |
prompts = {
|
| 588 |
"analyze": "Analyze the current leaderboard and show me the top performing models with their costs",
|
| 589 |
"costs": "Compare the costs of the top 3 models - which one offers the best value?",
|
| 590 |
-
"recommend": "Based on the leaderboard data, which model would you recommend for a production system that needs both good accuracy and reasonable cost?"
|
|
|
|
|
|
|
| 591 |
}
|
| 592 |
return prompts.get(action_type, "")
|
|
|
|
| 554 |
|
| 555 |
# Quick actions
|
| 556 |
gr.Markdown("### β‘ Quick Actions")
|
| 557 |
+
gr.Markdown("**Basic:**")
|
| 558 |
components['quick_analyze'] = gr.Button("π Analyze Leaderboard", size="sm")
|
| 559 |
components['quick_costs'] = gr.Button("π° Compare Costs", size="sm")
|
| 560 |
components['quick_recommend'] = gr.Button("π― Get Recommendations", size="sm")
|
| 561 |
|
| 562 |
+
gr.Markdown("**Advanced:**")
|
| 563 |
+
components['quick_multi_tool'] = gr.Button("π Multi-Tool Analysis", size="sm")
|
| 564 |
+
components['quick_synthetic'] = gr.Button("π§ͺ Generate Synthetic Data", size="sm")
|
| 565 |
+
|
| 566 |
return chat_screen, components
|
| 567 |
|
| 568 |
|
|
|
|
| 592 |
prompts = {
|
| 593 |
"analyze": "Analyze the current leaderboard and show me the top performing models with their costs",
|
| 594 |
"costs": "Compare the costs of the top 3 models - which one offers the best value?",
|
| 595 |
+
"recommend": "Based on the leaderboard data, which model would you recommend for a production system that needs both good accuracy and reasonable cost?",
|
| 596 |
+
"multi_tool": "Analyze the leaderboard with focus on cost and accuracy, identify the top 2 models, compare them, and estimate the cost of running 500 evaluations on the cheaper one",
|
| 597 |
+
"synthetic": "Generate a synthetic test dataset with 100 tasks for the food-delivery domain using these tools: search_restaurants, view_menu, place_order, track_delivery, apply_promo, rate_restaurant, contact_driver. Then create a prompt template for the same domain and tools, and push the dataset to MCP-1st-Birthday/smoltrace-food-delivery-tasks-v2"
|
| 598 |
}
|
| 599 |
return prompts.get(action_type, "")
|