Spaces:
Running
Running
File size: 52,167 Bytes
8664fba 5f9c44d 8664fba 0b3117f 47280b7 ca89148 1783518 5f9c44d 07044da ca89148 066588c e59dbdb e24146f e59dbdb 066588c 575c750 eb2a754 575c750 bb94aa7 5f9c44d 8664fba 0b3117f eb2a754 0b3117f 8664fba f9140ad e59dbdb 0b3117f 5a7e21a e59dbdb 5a7e21a ca89148 066588c ca89148 0b3117f ca89148 066588c 0b3117f ca89148 0b3117f f9140ad ca89148 0b3117f ca89148 066588c 0b3117f 066588c ca89148 0b3117f f9140ad ca89148 0b3117f ca89148 e59dbdb 066588c 0b3117f 596cb18 e59dbdb 0b3117f e59dbdb 0b3117f ca89148 0b3117f 575c750 ca89148 07044da e24146f 07044da e24146f 07044da e24146f 07044da e24146f 07044da e24146f 07044da e24146f 07044da 19bb306 5a7e21a e24146f 5a7e21a e24146f 5a7e21a e24146f c50a008 6dcfa1f c50a008 596cb18 c50a008 e24146f 596cb18 e24146f 596cb18 e24146f 596cb18 e24146f 596cb18 e24146f 596cb18 e24146f 596cb18 e24146f 596cb18 e24146f 596cb18 e24146f 596cb18 e24146f 596cb18 e24146f 596cb18 e24146f 596cb18 e24146f 8664fba e24146f 8664fba 066588c 8664fba ca89148 f5fc72d 8664fba e24146f 066588c e59dbdb e24146f 47280b7 ca89148 596cb18 07044da e24146f 596cb18 221fb8a 22fef14 4e68e9f 22fef14 b7d1f08 22fef14 fd35772 f5fc72d 22fef14 e24146f 47280b7 e24146f 22fef14 e24146f 22fef14 596cb18 e24146f 22fef14 5a7e21a 4e68e9f 221fb8a eb2a754 221fb8a b7d1f08 066588c 221fb8a f5fc72d b7d1f08 221fb8a eb2a754 5a7e21a e24146f 47280b7 e24146f 5a7e21a 19bb306 5a7e21a e24146f e59dbdb 596cb18 e24146f 5a7e21a 22fef14 4e68e9f 5a7e21a 22fef14 5a7e21a b7d1f08 5a7e21a f5fc72d 22fef14 5a7e21a 22fef14 e24146f 5a7e21a 22fef14 5a7e21a 22fef14 5a7e21a e24146f e59dbdb 22fef14 e59dbdb 22fef14 e59dbdb 22fef14 e59dbdb 22fef14 596cb18 e24146f 5a7e21a 22fef14 5a7e21a 22fef14 5a7e21a 22fef14 5a7e21a 22fef14 5a7e21a 22fef14 0b3117f 8664fba 356b0eb 8664fba ca89148 596cb18 ca89148 f9140ad 47280b7 ff06039 47280b7 f9140ad 47280b7 9f9bed8 ca89148 47280b7 9f9bed8 5f9c44d ca89148 9f9bed8 5f9c44d ca89148 e59dbdb ca89148 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 |
import gradio as gr
from gradio_leaderboard import Leaderboard, SelectColumns, ColumnFilter
import config
from envs import RESULTS_REPO_ID, REPO_ID, API, HF_TOKEN
from pathlib import Path
import pandas as pd
import os
import json
from utils.viz import create_scatter_plot, create_flow_chart, create_bar_chart, create_task_success_heatmap
from utils.processing import check_and_process_uploads
from huggingface_hub import snapshot_download
from apscheduler.schedulers.background import BackgroundScheduler
from datetime import datetime
import json
import re
import markdown
import asyncio
from apscheduler.schedulers.asyncio import AsyncIOScheduler
import weave
from utils.db import TracePreprocessor
from gradio.themes.soft import Soft
preprocessor = TracePreprocessor()
from datetime import datetime
abs_path = Path(__file__).parent
def restart_space():
API.restart_space(repo_id=REPO_ID, token=HF_TOKEN)
# New function to download results
def download_latest_results():
print("Downloading latest results...")
snapshot_download(RESULTS_REPO_ID,
local_dir= "evals_upload",
repo_type='dataset',
tqdm_class=None,
etag_timeout=30,
max_workers=4,
)
print("Download complete.")
def get_analyzed_traces(agent_name, benchmark_name):
return preprocessor.get_analyzed_traces(agent_name, benchmark_name)
def get_failure_report(agent_name, benchmark_name):
return preprocessor.get_failure_report(agent_name, benchmark_name)
def parse_json_files(folder_path, benchmark_name):
return preprocessor.get_parsed_results(benchmark_name)
def update_agent_dropdown(benchmark_name, metric):
df = parse_json_files(os.path.join(abs_path, "evals_live"), benchmark_name)
agents = df['Agent Name'].tolist()
best_agent = get_best_agent(benchmark_name, metric)
return gr.Dropdown(choices=agents, value=best_agent, label="Select Agent")
def get_best_agent(benchmark_name, metric):
df = parse_json_files(os.path.join(abs_path, "evals_live"), benchmark_name)
return df.loc[df[metric].idxmax()]['Agent Name']
def update_task_analysis(benchmark_name, agent_name):
if not agent_name:
return "Please select an agent.", None, None, ""
analyzed_traces = get_analyzed_traces(agent_name, benchmark_name)
if not analyzed_traces:
return f"No analysis available for agent: {agent_name}", None, None, ""
task_ids = list(analyzed_traces.keys())
overview, flow_chart, _ = update_task_details(benchmark_name, agent_name, task_ids[0])
return overview, flow_chart, gr.Dropdown(choices=task_ids, value=task_ids[0], label="Select Task"), ""
def update_task_details(benchmark_name, agent_name, task_id):
if not task_id:
return "Please select a task.", None, ""
analyzed_traces = get_analyzed_traces(agent_name, benchmark_name)
if not analyzed_traces or task_id not in analyzed_traces:
return f"No analysis available for task: {task_id}", None, ""
analysis = analyzed_traces[task_id]
summary = analysis.get('task_analysis', {})
overview = f"### Summary\n\n{summary.get('overview', 'No overview available.')}\n\n"
# overview += f"### Successes\n{summary.get('key_successes', 'No successes listed.')}\n\n"
# overview += f"### Challenges\n{summary.get('main_challenges', 'No challenges listed.')}\n\n"
# overview += f"### Overall Assessment\n{summary.get('overall_assessment', 'No assessment available.')}\n\n"
if summary.get('overview', 'No overview available.') != "Not available":
flow_chart = create_flow_chart(analysis['steps'])
else:
flow_chart = None
return overview, flow_chart, ""
def format_call_info(step, step_index):
call_data = step['call_data']
analysis = step['analysis']
def format_json(obj):
# if isinstance(obj, dict) and 'choices' in obj:
# # Special handling for message content
# formatted_content = format_message_content(obj['choices'][0])
# return f'<div class="message-content">{formatted_content}</div>'
# else:
json_str = json.dumps(obj, indent=2)
json_str = json_str.replace(' ', ' ')
json_str = json_str.replace('\n', '<br>')
return f'<div class="json-wrapper">{json_str}</div>'
# Currently not used but we can enable it to format message content
def format_message_content(content):
# Convert Markdown to HTML
html_content = markdown.markdown(content)
# Replace ``` code blocks with styled pre blocks
html_content = re.sub(r'```python\n(.*?)```', lambda m: f'<pre class="code-block">{m.group(1)}</pre>', html_content, flags=re.DOTALL)
return html_content
formatted_info = f"""
<style>
.json-wrapper {{
white-space: pre-wrap;
word-wrap: break-word;
font-family: monospace;
max-height: 300px;
overflow-y: auto;
background-color: #f5f5f5;
padding: 10px;
border-radius: 5px;
}}
.message-content {{
white-space: normal;
word-wrap: break-word;
font-family: Arial, sans-serif;
max-height: 500px;
overflow-y: auto;
background-color: #ffffff;
padding: 10px;
border-radius: 5px;
border: 1px solid #e0e0e0;
}}
.code-block {{
background-color: #f0f0f0;
padding: 10px;
border-radius: 5px;
font-family: monospace;
white-space: pre-wrap;
word-wrap: break-word;
}}
</style>
<h3>Step {step_index + 1}: {analysis.get('headline', '')}</h3>
<h4>Call Metadata</h4>
<ul>
<li><strong>Weave Task ID:</strong> {call_data['weave_task_id']}</li>
<li><strong>Trace ID:</strong> {call_data['trace_id']}</li>
<li><strong>Project ID:</strong> {call_data['project_id']}</li>
<li><strong>Created Timestamp:</strong> {datetime.fromtimestamp(call_data['created_timestamp'])}</li>
<li><strong>Model:</strong> {call_data['inputs']['model']}</li>
</ul>
<h4>Inputs</h4>
{format_json(call_data['inputs'])}
<h4>Outputs</h4>
{format_json(call_data['outputs'])}
<h4>Usage</h4>
{format_json(call_data['summary'])}
<h4>Analysis</h4>
<ul>
<li><strong>Description:</strong> {analysis['description']}</li>
<li><strong>Assessment:</strong> {analysis['assessment']}</li>
<li><strong>Success:</strong> {analysis['success']}</li>
<li><strong>Action Type:</strong> {analysis['action_type']}</li>
</ul>
"""
return formatted_info
def update_failure_report(agent_name, benchmark_name):
failure_report = get_failure_report(agent_name, benchmark_name)
if not failure_report:
return "No failure report available for this agent.", None
# Create overview of failure categories
categories_overview = "### Failure Categories:\n\n"
for category in failure_report['failure_categories']:
categories_overview += f"#### {category['category_name']}\n"
categories_overview += f"{category['description']}\n\n"
# Count tasks affected by each category
category_counts = {}
for task, classification in failure_report['task_classifications'].items():
category_id = classification['category_id']
category_counts[category_id] = category_counts.get(category_id, 0) + 1
# Prepare data for bar chart
categories = [cat['category_name'] for cat in failure_report['failure_categories']]
counts = [category_counts.get(str(i+1), 0) for i in range(len(categories))]
# Create bar chart
chart = create_bar_chart(categories, counts, "Failure Categories", "Number of Affected Tasks", "Failure Categories Distribution")
return categories_overview, chart
from gradio.themes.utils import colors, fonts, sizes
from typing import Iterable
class MyTheme(Soft):
def __init__(
self,
*,
primary_hue: colors.Color | str = colors.blue,
text_size: sizes.Size | str = sizes.text_lg,
font: fonts.Font
| str
| Iterable[fonts.Font | str] = (
fonts.GoogleFont("Lato"),
"ui-sans-serif",
"sans-serif",
),
font_mono: fonts.Font
| str
| Iterable[fonts.Font | str] = (
fonts.GoogleFont("IBM Plex Mono"),
"ui-monospace",
"monospace",
),
):
super().__init__(
primary_hue=primary_hue,
text_size=text_size,
font=font,
font_mono=font_mono,
)
my_theme = MyTheme()
with gr.Blocks(theme=my_theme, css='css.css') as demo:
# gr.Markdown((Path(__file__).parent / "header.md").read_text(), elem_classes=["text-large"])
gr.HTML("""
<style>
.hal-header {
color: #ecf0f1;
border-radius: 10px;
padding: 40px 20px;
text-align: center;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.hal-title {
font-size: 2.5em;
font-weight: 700;
margin: 0;
letter-spacing: 2px;
text-transform: uppercase;
}
.hal-subtitle {
font-size: 1.2em;
font-weight: 300;
margin-top: 15px;
margin-left: auto;
margin-right: auto;
line-height: 1.6;
text-align: center;
}
.hal-highlight {
color: #3498db;
font-weight: 600;
}
</style>
<header class="hal-header">
<h1 class="hal-title">Holistic Agent Leaderboard (HAL)</h1>
<p class="hal-subtitle">
A standardized, cost-aware, and third-party leaderboard for evaluating agents.
</p>
</header>""")
gr.HTML("""
<style>
.feature-row {
display: flex;
justify-content: space-between;
margin-top: 20px;
margin-bottom: 20px;
}
.feature-column {
flex: 1;
padding: 25px;
background-color: #ffffff;
border-radius: 10px;
margin: 0 15px;
text-align: left;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
align-items: flex-start;
border-top: 5px solid #3498db;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.feature-column:hover {
transform: translateY(-5px);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}
.feature-keyword {
font-size: 1.2em;
font-weight: bold;
color: #1b9e77;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 1px;
}
.feature-content {
flex-grow: 1;
}
.feature-description {
font-size: 0.95em;
line-height: 1.6;
color: #333;
}
</style>
<div class="feature-row">
<div class="feature-column">
<div class="feature-keyword">Standardized</div>
<div class="feature-content">
<p class="feature-description">Evaluations across agent benchmarks are all recorded to a single leaderboard that evaluates every listed agent in the same way.</p>
</div>
</div>
<div class="feature-column">
<div class="feature-keyword">Cost-controlled</div>
<div class="feature-content">
<p class="feature-description">For downstream users, understanding the cost of running agents is a significant need for adoption. For agent developers, cost-controlled evaluations help develop accurate baselines.</p>
</div>
</div>
<div class="feature-column">
<div class="feature-keyword">Third-party</div>
<div class="feature-content">
<p class="feature-description">Agent developers clearly have competing objectives in reporting accuracy: they want to achieve state-of-the-art performance.</p>
</div>
</div>
</div>
<style>
.section-heading {
font-size: 1.8em;
font-weight: bold;
color: #2c3e50;
margin-top: 40px;
margin-bottom: 20px;
text-align: left;
}
.user-types-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20px;
margin-top: 20px;
}
.user-type {
background-color: #ffffff;
border-radius: 10px;
padding: 25px;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease, box-shadow 0.3s ease;
border-left: 5px solid #3498db;
}
.user-type:hover {
transform: translateY(-5px);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}
.user-type-title {
font-size: 1.2em;
font-weight: bold;
color: #3498db;
margin-bottom: 10px;
}
.user-type-description {
font-size: 0.95em;
line-height: 1.6;
color: #333;
}
.user-type-links a {
display: inline-block;
padding: 5px 12px;
background-color: #f0f4f8;
color: #2c3e50 !important; /* Force the color change */
text-decoration: none !important; /* Force remove underline */
border-radius: 15px;
font-size: 0.85em;
transition: all 0.3s ease;
border: 1px solid #e1e8ed;
}
.user-type-links a:hover {
background-color: #3498db;
color: white !important; /* Force the color change on hover */
transform: translateY(-2px);
box-shadow: 0 2px 5px rgba(52, 152, 219, 0.2);
text-decoration: none !important; /* Ensure no underline on hover */
}
.user-type-links a:visited {
color: #2c3e50 !important; /* Ensure visited links have the same color */
}
.user-type-links a::before {
content: "→";
margin-right: 5px;
font-size: 1.1em;
}
</style>
<h2 class="section-heading">Who is it for?</h2>
<p>We see HAL being useful for four types of users:</p>
<div class="user-types-container">
<div class="user-type">
<h3 class="user-type-title">Downstream Users & Procurers</h3>
<p class="user-type-description">Customers looking to deploy agents can get visibility into existing benchmarks, know developers building useful agents, and identify the state of the art for both cost and accuracy for their tasks of interest.</p>
<div class="user-type-links">
<a href="#leaderboards">Leaderboards</a>
</div>
</div>
<div class="user-type">
<h3 class="user-type-title">Agent Benchmark Developers</h3>
<p class="user-type-description">Reporting results on a centralized leaderboard could allow improved visibility into agent benchmarks that measure real-world utility.</p>
<div class="user-type-links">
<a href="#benchmark-submission">Add a Benchmark</a>
</div>
</div>
<div class="user-type">
<h3 class="user-type-title">Agent Developers</h3>
<p class="user-type-description">HAL allows for easy reproduction of past agents, clear comparison with past baselines, and a straightforward way to compete on a leaderboard.</p>
<div class="user-type-links">
<a href="#agent-submission">Submit an Agent</a>
<a href="#leaderboards">Leaderboards</a>
<a href="#reproduction-guide">Reproduction Guide</a>
</div>
</div>
<div class="user-type">
<h3 class="user-type-title">Safety Researchers</h3>
<p class="user-type-description">Understanding agent capabilities on real-world safety threats and their associated costs is crucial. For example, Cybench evaluations could provide insights into agent performance and affordability for potential adversaries.</p>
<div class="user-type-links">
<a href="#cybench-results">Cybench Leaderboard (coming soon)</a>
<a href="#agent-monitor">Agent Monitor</a>
</div>
</div>
</div>
</br>
<h2 class="section-heading" id="leaderboards">Leaderboards</h2>
<p>Select a benchmark to see the agent leaderboard. Verified results have been run by the HAL team:</p>
""")
with gr.Tabs():
with gr.Tab("USACO"):
gr.Markdown("""The USA Computing Olympiad (USACO) is a computer programming competition for pre-college students. This benchmark evaluates the performance of AI agents on a set of 307 USACO tasks. The agents are evaluated based on the number of tasks correctly solved.""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=parse_json_files(os.path.join(abs_path, "evals_live"), 'usaco'),
select_columns=SelectColumns(
default_selection=config.USACO_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
hide_columns=config.USACO_HIDE_COLUMNS,
search_columns=config.USACO_SEARCH_COLUMNS,
)
with gr.Row():
gr.Markdown("### Accuracy vs. Cost for USACO agents")
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'usaco'), "Total Cost", "Accuracy", "Total Cost (in USD)", "Accuracy", ["Agent Name"]))
gr.Markdown("")
gr.Markdown("")
gr.Markdown("## Task success heatmap")
gr.Markdown("The task success heatmap shows which agent can solve which tasks. Agents are sorted by total accuracy (higher is better); tasks in USACO are sorted by decreasing order of difficulty (tasks on the left are solved by the most agents; tasks on the right are solved by the least")
with gr.Row():
task_success_heatmap = gr.Plot()
demo.load(
lambda: create_task_success_heatmap(
preprocessor.get_task_success_data('usaco'),
'USACO'
),
outputs=[task_success_heatmap]
)
gr.HTML("""
<style>
.grouped-section {
border: 2px solid #dee2e6; /* Color matching unactivated tabs */
border-radius: 10px;
padding: 30px;
margin-top: 40px;
margin-bottom: 40px;
position: relative;
}
.grouped-section-title {
font-size: 1.7em;
font-weight: bold;
color: #2c3e50;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #dee2e6;
}
</style>
""")
with gr.Group(elem_classes=["grouped-section"]):
gr.Markdown("# Agent monitor", elem_classes=["grouped-section-title"], elem_id="agent-monitor")
gr.HTML('<div style="height: 10px;"></div>')
gr.Markdown("## Failure report for each agent")
gr.Markdown('Select an agent to see why the agent fails to solve tasks correctly. Note that these descriptions (and the failure categories) are generated by LLM-based evaluations of the agent logs and may contain inaccuracies.')
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
with gr.Column(scale=1):
failure_report_agent_dropdown = gr.Dropdown(label="Select Agent for Failure Report")
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
with gr.Column(scale=1):
failure_categories_overview = gr.Markdown()
with gr.Column(scale=1):
failure_categories_chart = gr.Plot()
# Initialize the failure report agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="usaco", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[failure_report_agent_dropdown])
# Update failure report when agent is selected
failure_report_agent_dropdown.change(update_failure_report,
inputs=[failure_report_agent_dropdown, gr.Textbox(value="usaco", visible=False)],
outputs=[failure_categories_overview, failure_categories_chart])
gr.HTML('<div style="height: 30px;"></div>')
gr.Markdown("## Task overview")
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
with gr.Column(scale=1):
agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
task_dropdown = gr.Dropdown(label="Select USACO Task")
gr.HTML('<div style="height: 10px;"></div>')
with gr.Row():
task_overview = gr.Markdown()
with gr.Row():
flow_chart = gr.Plot(label="Task Flow")
# Initialize the agent dropdown with the best agent
demo.load(update_agent_dropdown, inputs=[gr.Textbox(value="usaco", visible=False), gr.Textbox(value="Accuracy", visible=False)], outputs=[agent_dropdown])
demo.load(update_task_analysis, inputs=[gr.Textbox(value="usaco", visible=False), agent_dropdown], outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
agent_dropdown.change(update_task_analysis,
inputs=[gr.Textbox(value="usaco", visible=False), agent_dropdown],
outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
task_dropdown.change(update_task_details,
inputs=[gr.Textbox(value="usaco", visible=False), agent_dropdown, task_dropdown],
outputs=[task_overview, flow_chart, gr.Textbox(visible=False)])
gr.Markdown("## Raw predictions")
gr.Markdown('Select an agent to see the raw predictions made by the agent for each task. We also provide information on token usage for each call.')
with gr.Accordion("Expand to inspect raw predictions of agents...", open=False):
with gr.Row():
with gr.Column(scale=1):
raw_agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
raw_task_dropdown = gr.Dropdown(label="Select Task")
with gr.Column(scale=1):
raw_step_dropdown = gr.Dropdown(label="Select Step")
with gr.Row():
raw_call_details = gr.HTML()
def update_raw_task_dropdown(agent_name):
analyzed_traces = get_analyzed_traces(agent_name, "usaco")
if not analyzed_traces:
return gr.Dropdown(choices=[], label="Select Task"), gr.Dropdown(choices=[], label="Select Step"), f"No raw predictions data available for agent: {agent_name}."
task_ids = list(analyzed_traces.keys())
steps = analyzed_traces[task_ids[0]]['steps']
return gr.Dropdown(choices=task_ids, label="Select Task", value=task_ids[0]), gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(get_analyzed_traces(agent_name, "usaco")[task_ids[0]]['steps'][0], 0)
def update_raw_step_dropdown(agent_name, task_id):
analyzed_traces = get_analyzed_traces(agent_name, "usaco")
if not analyzed_traces or task_id not in analyzed_traces:
return gr.Dropdown(choices=[], label="Select Step", value="No data available.")
steps = analyzed_traces[task_id]['steps']
return gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(steps[0], 0)
def update_raw_call_details(agent_name, task_id, step_index):
analyzed_traces = get_analyzed_traces(agent_name, "usaco")
if not analyzed_traces or task_id not in analyzed_traces:
return "No data available for this selection."
steps = analyzed_traces[task_id]['steps']
if step_index is None:
return "Invalid step selection."
step = steps[step_index]
return format_call_info(step, step_index)
# Initialize the raw agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="usaco", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[raw_agent_dropdown])
demo.load(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown])
demo.load(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
raw_agent_dropdown.change(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown, raw_call_details])
raw_task_dropdown.change(update_raw_step_dropdown,
inputs=[raw_agent_dropdown, raw_task_dropdown],
outputs=[raw_step_dropdown, raw_call_details])
raw_step_dropdown.change(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
with gr.Tab("SWE-Bench Verified"):
gr.Markdown("""SWE-bench is a dataset that tests systems' ability to solve GitHub issues automatically. Verified is a human-validated subset of 500 problems reviewed by software engineers. The We are currently actively developing this platform and this benchmark is not fully implemented yet.""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=parse_json_files(os.path.join(abs_path, "evals_live"), 'swebench_verified'),
select_columns=SelectColumns(
default_selection=config.SWEBENCH_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
hide_columns=config.SWEBENCH_HIDE_COLUMNS,
search_columns=config.SWEBENCH_SEARCH_COLUMNS
)
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'swebench_verified'), "Total Cost", "Accuracy", "Total Cost (in USD)", "Accuracy", ["Agent Name"]))
gr.Markdown("")
gr.Markdown("")
gr.Markdown("## Task success heatmap")
with gr.Row():
task_success_heatmap = gr.Plot()
demo.load(
lambda: create_task_success_heatmap(
preprocessor.get_task_success_data('swebench_verified'),
'SWEBench Verified'
),
outputs=[task_success_heatmap]
)
gr.Markdown("")
gr.Markdown("")
gr.Markdown("## Failure report for each agent")
with gr.Row():
with gr.Column(scale=1):
failure_report_agent_dropdown = gr.Dropdown(label="Select Agent for Failure Report")
with gr.Row():
with gr.Column(scale=1):
failure_categories_overview = gr.Markdown()
with gr.Column(scale=1):
failure_categories_chart = gr.Plot()
# Initialize the failure report agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="swebench_verified", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[failure_report_agent_dropdown])
# Update failure report when agent is selected
failure_report_agent_dropdown.change(update_failure_report,
inputs=[failure_report_agent_dropdown, gr.Textbox(value="swebench_verified", visible=False)],
outputs=[failure_categories_overview, failure_categories_chart])
gr.Markdown("")
gr.Markdown("")
gr.Markdown("## Agent monitor")
with gr.Row():
with gr.Column(scale=1):
agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
task_dropdown = gr.Dropdown(label="Select SWE-Bench Task")
with gr.Row():
task_overview = gr.Markdown()
with gr.Row():
flow_chart = gr.Plot(label="Task Flow")
# Initialize the agent dropdown with the best agent
demo.load(update_agent_dropdown, inputs=[gr.Textbox(value="swebench_verified", visible=False), gr.Textbox(value="Accuracy", visible=False)], outputs=[agent_dropdown])
demo.load(update_task_analysis, inputs=[gr.Textbox(value="swebench_verified", visible=False), agent_dropdown], outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
agent_dropdown.change(update_task_analysis,
inputs=[gr.Textbox(value="swebench_verified", visible=False), agent_dropdown],
outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
task_dropdown.change(update_task_details,
inputs=[gr.Textbox(value="swebench_verified", visible=False), agent_dropdown, task_dropdown],
outputs=[task_overview, flow_chart, gr.Textbox(visible=False)])
gr.Markdown("## Raw predictions")
with gr.Row():
with gr.Column(scale=1):
raw_agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
raw_task_dropdown = gr.Dropdown(label="Select Task")
with gr.Column(scale=1):
raw_step_dropdown = gr.Dropdown(label="Select Step")
with gr.Row():
raw_call_details = gr.HTML()
def update_raw_task_dropdown(agent_name):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_verified")
if not analyzed_traces:
return gr.Dropdown(choices=[], label="Select Task"), gr.Dropdown(choices=[], label="Select Step"), f"No raw predictions data available for agent: {agent_name}."
task_ids = list(analyzed_traces.keys())
steps = analyzed_traces[task_ids[0]]['steps']
return gr.Dropdown(choices=task_ids, label="Select Task", value=task_ids[0]), gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), update_raw_call_details(agent_name, task_ids[0], 0)
def update_raw_step_dropdown(agent_name, task_id):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_verified")
if not analyzed_traces or task_id not in analyzed_traces:
return gr.Dropdown(choices=[], label="Select Step", value="No data available.")
steps = analyzed_traces[task_id]['steps']
return gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(steps[0], 0)
def update_raw_call_details(agent_name, task_id, step_index):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_verified")
if not analyzed_traces or task_id not in analyzed_traces:
return "No data available for this selection."
steps = analyzed_traces[task_id]['steps']
if step_index is None:
return "Invalid step selection."
step = steps[step_index]
return format_call_info(step, step_index)
# Initialize the raw agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="swebench_verified", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[raw_agent_dropdown])
demo.load(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown])
demo.load(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
raw_agent_dropdown.change(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown, raw_call_details])
raw_task_dropdown.change(update_raw_step_dropdown,
inputs=[raw_agent_dropdown, raw_task_dropdown],
outputs=[raw_step_dropdown, raw_call_details])
raw_step_dropdown.change(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
with gr.Tab("SWE-Bench Lite"):
gr.Markdown("""SWE-bench is a dataset that tests systems' ability to solve GitHub issues automatically. Lite is a subset of 300 tasks of the original SWE-bench. We are currently actively developing this platform and this benchmark is not fully implemented yet.""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=parse_json_files(os.path.join(abs_path, "evals_live"), 'swebench_lite'),
select_columns=SelectColumns(
default_selection=config.SWEBENCH_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
search_columns=config.SWEBENCH_SEARCH_COLUMNS,
hide_columns=config.SWEBENCH_HIDE_COLUMNS
)
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'swebench_lite'), "Total Cost", "Accuracy", "Total Cost (in USD)", "Accuracy", ["Agent Name"]))
gr.Markdown("")
gr.Markdown("")
gr.Markdown("## Task success heatmap")
with gr.Row():
task_success_heatmap = gr.Plot()
demo.load(
lambda: create_task_success_heatmap(
preprocessor.get_task_success_data('swebench_lite'),
'SWEBench Lite'
),
outputs=[task_success_heatmap]
)
gr.Markdown("")
gr.Markdown("")
gr.Markdown("## Failure report for each agent")
with gr.Row():
with gr.Column(scale=1):
failure_report_agent_dropdown = gr.Dropdown(label="Select Agent for Failure Report")
with gr.Row():
with gr.Column(scale=1):
failure_categories_overview = gr.Markdown()
with gr.Column(scale=1):
failure_categories_chart = gr.Plot()
# Initialize the failure report agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="swebench_lite", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[failure_report_agent_dropdown])
# Update failure report when agent is selected
failure_report_agent_dropdown.change(update_failure_report,
inputs=[failure_report_agent_dropdown, gr.Textbox(value="swebench_lite", visible=False)],
outputs=[failure_categories_overview, failure_categories_chart])
gr.Markdown("")
gr.Markdown("")
gr.Markdown("## Agent monitor")
with gr.Row():
with gr.Column(scale=1):
agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
task_dropdown = gr.Dropdown(label="Select SWE-Bench Task")
with gr.Row():
task_overview = gr.Markdown()
with gr.Row():
flow_chart = gr.Plot(label="Task Flow")
# Initialize the agent dropdown with the best agent
demo.load(update_agent_dropdown, inputs=[gr.Textbox(value="swebench_lite", visible=False), gr.Textbox(value="Accuracy", visible=False)], outputs=[agent_dropdown])
demo.load(update_task_analysis, inputs=[gr.Textbox(value="swebench_lite", visible=False), agent_dropdown], outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
agent_dropdown.change(update_task_analysis,
inputs=[gr.Textbox(value="swebench_lite", visible=False), agent_dropdown],
outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
task_dropdown.change(update_task_details,
inputs=[gr.Textbox(value="swebench_lite", visible=False), agent_dropdown, task_dropdown],
outputs=[task_overview, flow_chart, gr.Textbox(visible=False)])
gr.Markdown("## Raw predictions")
with gr.Row():
with gr.Column(scale=1):
raw_agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
raw_task_dropdown = gr.Dropdown(label="Select Task")
with gr.Column(scale=1):
raw_step_dropdown = gr.Dropdown(label="Select Step")
with gr.Row():
raw_call_details = gr.HTML()
def update_raw_task_dropdown(agent_name):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_lite")
if not analyzed_traces:
return gr.Dropdown(choices=[], label="Select Task"), gr.Dropdown(choices=[], label="Select Step"), f"No raw predictions data available for agent: {agent_name}."
task_ids = list(analyzed_traces.keys())
steps = analyzed_traces[task_ids[0]]['steps']
return gr.Dropdown(choices=task_ids, label="Select Task", value=task_ids[0]), gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), update_raw_call_details(agent_name, task_ids[0], 0)
def update_raw_step_dropdown(agent_name, task_id):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_lite")
if not analyzed_traces or task_id not in analyzed_traces:
return gr.Dropdown(choices=[], label="Select Step", value="No data available.")
steps = analyzed_traces[task_id]['steps']
return gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(steps[0], 0)
def update_raw_call_details(agent_name, task_id, step_index):
analyzed_traces = get_analyzed_traces(agent_name, "swebench_lite")
if not analyzed_traces or task_id not in analyzed_traces:
return "No data available for this selection."
steps = analyzed_traces[task_id]['steps']
if step_index is None:
return "Invalid step selection."
step = steps[step_index]
return format_call_info(step, step_index)
# Initialize the raw agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="swebench_lite", visible=False), gr.Textbox(value="Accuracy", visible=False)],
outputs=[raw_agent_dropdown])
demo.load(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown])
demo.load(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
raw_agent_dropdown.change(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown, raw_call_details])
raw_task_dropdown.change(update_raw_step_dropdown,
inputs=[raw_agent_dropdown, raw_task_dropdown],
outputs=[raw_step_dropdown, raw_call_details])
raw_step_dropdown.change(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
with gr.Tab("MLAgentBench"):
gr.Markdown("""MLAgentBench is a suite of end-to-end Machine Learning (ML) experimentation tasks, where the agent aims to take a given dataset and a machine learning task description and autonomously develop or improve an ML model. We are currently actively developing this platform and this benchmark is not fully implemented yet. In particular, we only include one agent and a subset of tasks for this benchmark.""")
with gr.Row():
with gr.Column(scale=2):
Leaderboard(
value=parse_json_files(os.path.join(abs_path, "evals_live"), 'mlagentbench'),
select_columns=SelectColumns(
default_selection=config.MLAGENTBENCH_ON_LOAD_COLUMNS + ["Verified"],
cant_deselect=["Agent Name"],
label="Select Columns to Display:",
),
search_columns=config.MLAGENTBENCH_SEARCH_COLUMNS,
hide_columns=config.MLAGENTBENCH_HIDE_COLUMNS,
)
with gr.Row():
scatter_plot = gr.Plot(create_scatter_plot(parse_json_files(os.path.join(abs_path, "evals_live"), 'mlagentbench'), "Total Cost", "Overall Score", "Total Cost (in USD)", "Overall Score", ["Agent Name"]))
gr.Markdown("")
gr.Markdown("")
gr.Markdown("## Failure report for each agent")
with gr.Row():
with gr.Column(scale=1):
failure_report_agent_dropdown = gr.Dropdown(label="Select Agent for Failure Report")
with gr.Row():
with gr.Column(scale=1):
failure_categories_overview = gr.Markdown()
with gr.Column(scale=1):
failure_categories_chart = gr.Plot()
# Initialize the failure report agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="mlagentbench", visible=False), gr.Textbox(value="Overall Score", visible=False)],
outputs=[failure_report_agent_dropdown])
# Update failure report when agent is selected
failure_report_agent_dropdown.change(update_failure_report,
inputs=[failure_report_agent_dropdown, gr.Textbox(value="mlagentbench", visible=False)],
outputs=[failure_categories_overview, failure_categories_chart])
gr.Markdown("")
gr.Markdown("")
gr.Markdown("## Agent monitor")
with gr.Row():
with gr.Column(scale=1):
agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
task_dropdown = gr.Dropdown(label="Select SWE-Bench Task")
with gr.Row():
task_overview = gr.Markdown()
with gr.Row():
flow_chart = gr.Plot(label="Task Flow")
# Initialize the agent dropdown with the best agent
demo.load(update_agent_dropdown, inputs=[gr.Textbox(value="mlagentbench", visible=False), gr.Textbox(value="Overall Score", visible=False)], outputs=[agent_dropdown])
demo.load(update_task_analysis, inputs=[gr.Textbox(value="mlagentbench", visible=False), agent_dropdown], outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
agent_dropdown.change(update_task_analysis,
inputs=[gr.Textbox(value="mlagentbench", visible=False), agent_dropdown],
outputs=[task_overview, flow_chart, task_dropdown, gr.Textbox(visible=False)])
task_dropdown.change(update_task_details,
inputs=[gr.Textbox(value="mlagentbench", visible=False), agent_dropdown, task_dropdown],
outputs=[task_overview, flow_chart, gr.Textbox(visible=False)])
gr.Markdown("## Raw predictions")
with gr.Row():
with gr.Column(scale=1):
raw_agent_dropdown = gr.Dropdown(label="Select Agent")
with gr.Column(scale=1):
raw_task_dropdown = gr.Dropdown(label="Select Task")
with gr.Column(scale=1):
raw_step_dropdown = gr.Dropdown(label="Select Step")
with gr.Row():
raw_call_details = gr.HTML()
def update_raw_task_dropdown(agent_name):
analyzed_traces = get_analyzed_traces(agent_name, "mlagentbench")
if not analyzed_traces:
return gr.Dropdown(choices=[], label="Select Task"), gr.Dropdown(choices=[], label="Select Step"), f"No raw predictions data available for agent: {agent_name}."
task_ids = list(analyzed_traces.keys())
steps = analyzed_traces[task_ids[0]]['steps']
return gr.Dropdown(choices=task_ids, label="Select Task", value=task_ids[0]), gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), update_raw_call_details(agent_name, task_ids[0], 0)
def update_raw_step_dropdown(agent_name, task_id):
analyzed_traces = get_analyzed_traces(agent_name, "mlagentbench")
if not analyzed_traces or task_id not in analyzed_traces:
return gr.Dropdown(choices=[], label="Select Step", value="No data available.")
steps = analyzed_traces[task_id]['steps']
return gr.Dropdown(choices=[(f"Step {i+1}", i) for i in range(len(steps))], label="Select Step", value=0), format_call_info(steps[0], 0)
def update_raw_call_details(agent_name, task_id, step_index):
analyzed_traces = get_analyzed_traces(agent_name, "mlagentbench")
if not analyzed_traces or task_id not in analyzed_traces:
return "No data available for this selection."
steps = analyzed_traces[task_id]['steps']
if step_index is None:
return "Invalid step selection."
step = steps[step_index]
return format_call_info(step, step_index)
# Initialize the raw agent dropdown with all agents
demo.load(update_agent_dropdown,
inputs=[gr.Textbox(value="mlagentbench", visible=False), gr.Textbox(value="Overall Score", visible=False)],
outputs=[raw_agent_dropdown])
demo.load(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown])
demo.load(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
raw_agent_dropdown.change(update_raw_task_dropdown,
inputs=[raw_agent_dropdown],
outputs=[raw_task_dropdown, raw_step_dropdown, raw_call_details])
raw_task_dropdown.change(update_raw_step_dropdown,
inputs=[raw_agent_dropdown, raw_task_dropdown],
outputs=[raw_step_dropdown, raw_call_details])
raw_step_dropdown.change(update_raw_call_details,
inputs=[raw_agent_dropdown, raw_task_dropdown, raw_step_dropdown],
outputs=[raw_call_details])
with gr.Tab("About"):
gr.Markdown((Path(__file__).parent / "about.md").read_text())
gr.HTML("""<h2 class="section-heading" id="agent-submission">How to add an agent?</h2>
<p>Below we provide a guide on how to add an agent to the leaderboard:</p>""")
gr.HTML("""<h2 class="section-heading" id="benchmark-submission">How to add a benchmark?</h2>
<p>Below we provide a guide on how to add a benchmark to the leaderboard:</p>""")
gr.HTML("""<h2 class="section-heading" id="reproduction-guide">How can I run evaluations?</h2>
<p>Below we provide a guide on how to reproduce evaluations:</p>""")
async def main():
# Preprocess traces
# preprocessor = TracePreprocessor()
# preprocessor.preprocess_traces('evals_live')
# preprocessor = TracePreprocessor()
# Download the results from the Hugging Face Hub
# await asyncio.to_thread(download_latest_results)
# Check for new uploads and process them
# await check_and_process_uploads()
scheduler = AsyncIOScheduler()
scheduler.add_job(restart_space, "interval", hours=1)
scheduler.add_job(download_latest_results, "interval", hours=1)
# scheduler.add_job(check_and_process_uploads, "interval", hours=1)
scheduler.start()
await demo.launch()
if __name__ == "__main__":
weave.init(f'leaderboard_{datetime.now().strftime("%Y%m%d%H%M%S")}')
asyncio.run(main()) |