text2sql-eval-toolkit 1.3.0__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. {text2sql_eval_toolkit-1.3.0/src/text2sql_eval_toolkit.egg-info → text2sql_eval_toolkit-1.4.0}/PKG-INFO +43 -28
  2. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/README.md +32 -27
  3. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/BenchmarkDetail-DQVQUBUE.js → text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/BenchmarkDetail-gEcRuzmW.js +1 -1
  4. text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/ComboBox-BActzty7.js +1 -0
  5. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/ErrorAnalysis-ho3kmDX5.js → text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/ErrorAnalysis-BpplWvLW.js +1 -1
  6. text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/LLMJudgeConfigView-DXZQKioY.js +10 -0
  7. text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/MyKeysView-C2Rv1Cl-.js +1 -0
  8. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/PipelineCompareView-DMBvJ9fJ.js → text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/PipelineCompareView-DCWeNB6f.js +1 -1
  9. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/PipelineDetailView-C0cISSC5.js → text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/PipelineDetailView-CJ47IIYR.js +1 -1
  10. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/ProfileCompareView-cDVUz-M5.js → text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/ProfileCompareView-Duatpnp_.js +1 -1
  11. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/ResultTableView-Dq7hZwq5.js → text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/ResultTableView-C-syf-qW.js +1 -1
  12. text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/RunEvaluationView-BlDUxpfZ.js +57 -0
  13. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/ToolkitInsightsView-D3K_ufFW.js → text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/ToolkitInsightsView-aJzjMILB.js +1 -1
  14. text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/UsersView-NPDbJBVn.js +1 -0
  15. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/defaultItemToString-BtCahKYf.js → text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/defaultItemToString-ClUBp4QC.js +1 -1
  16. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/index-CcHG1DIP.css → text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/index-BIrgjfvi.css +1 -1
  17. text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/index-DLyduwv0.js +97 -0
  18. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/metricInsightsSelect-B46SO2Wy.js → text2sql_eval_toolkit-1.4.0/dashboard/dist/assets/metricInsightsSelect-unZgHJkx.js +1 -1
  19. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/dashboard/dist/index.html +2 -2
  20. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/pyproject.toml +21 -2
  21. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/__init__.py +4 -0
  22. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/evaluation/evaluation_tools.py +232 -1
  23. text2sql_eval_toolkit-1.4.0/src/text2sql_eval_toolkit/evaluation/llm_as_judge.py +187 -0
  24. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/execution/execution_tools.py +58 -0
  25. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/indexing/__init__.py +1 -1
  26. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/indexing/scanner.py +1 -1
  27. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/indexing/store.py +1 -1
  28. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/inference/agentic_pipeline.py +13 -23
  29. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/inference/baseline_llm_pipeline.py +64 -40
  30. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/inference/inference_tools.py +89 -44
  31. text2sql_eval_toolkit-1.4.0/src/text2sql_eval_toolkit/inference/model_clients.py +341 -0
  32. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/metrics/text2sql_utils.py +241 -4
  33. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/results/_hub.py +8 -3
  34. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/aliases.py +1 -1
  35. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/auth.py +1 -1
  36. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/capabilities.py +65 -9
  37. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/judge_budget.py +87 -0
  38. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/middleware.py +22 -3
  39. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/models.py +13 -0
  40. text2sql_eval_toolkit-1.4.0/src/text2sql_eval_toolkit/ui/roles.py +230 -0
  41. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/routers_auth.py +6 -2
  42. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/routers_benchmarks.py +5 -9
  43. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/routers_judge.py +97 -11
  44. text2sql_eval_toolkit-1.4.0/src/text2sql_eval_toolkit/ui/routers_judge_configs.py +171 -0
  45. text2sql_eval_toolkit-1.4.0/src/text2sql_eval_toolkit/ui/routers_keys.py +106 -0
  46. text2sql_eval_toolkit-1.4.0/src/text2sql_eval_toolkit/ui/routers_users.py +174 -0
  47. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/runtime.py +54 -8
  48. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/server.py +89 -16
  49. text2sql_eval_toolkit-1.4.0/src/text2sql_eval_toolkit/ui/user_keys.py +322 -0
  50. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/utils.py +235 -10
  51. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0/src/text2sql_eval_toolkit.egg-info}/PKG-INFO +43 -28
  52. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit.egg-info/SOURCES.txt +30 -15
  53. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit.egg-info/requires.txt +8 -0
  54. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_auth_google.py +10 -3
  55. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_capability_tiers.py +58 -15
  56. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_dashboard_spa_routing.py +7 -0
  57. text2sql_eval_toolkit-1.4.0/tests/test_documented_defect_fixes.py +184 -0
  58. text2sql_eval_toolkit-1.4.0/tests/test_judge_config_storage.py +147 -0
  59. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_judge_endpoint.py +69 -0
  60. text2sql_eval_toolkit-1.4.0/tests/test_library_internals.py +287 -0
  61. text2sql_eval_toolkit-1.4.0/tests/test_model_client_dispatch.py +217 -0
  62. text2sql_eval_toolkit-1.4.0/tests/test_public_api.py +141 -0
  63. text2sql_eval_toolkit-1.4.0/tests/test_public_api_behaviour.py +428 -0
  64. text2sql_eval_toolkit-1.4.0/tests/test_public_api_signatures.py +127 -0
  65. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_route_table.py +11 -0
  66. text2sql_eval_toolkit-1.4.0/tests/test_user_api_keys.py +294 -0
  67. text2sql_eval_toolkit-1.4.0/tests/test_user_management.py +219 -0
  68. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/ComboBox-Cz5Wuuu_.js +0 -1
  69. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/LLMJudgeConfigView-QUABvu1n.js +0 -1
  70. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/RunEvaluationView-DBFPVXhW.js +0 -1
  71. text2sql_eval_toolkit-1.3.0/dashboard/dist/assets/index-C9VP9iwL.js +0 -97
  72. text2sql_eval_toolkit-1.3.0/src/text2sql_eval_toolkit/evaluation/llm_as_judge.py +0 -138
  73. text2sql_eval_toolkit-1.3.0/src/text2sql_eval_toolkit/ui/routers_judge_configs.py +0 -112
  74. text2sql_eval_toolkit-1.3.0/tests/test_public_api.py +0 -39
  75. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/LICENSE +0 -0
  76. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/MANIFEST.in +0 -0
  77. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/dashboard/dist/assets/github-DKhhs9_z.png +0 -0
  78. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/dashboard/dist/assets/text2sql-eval-toolkit-logo-BPykp9hG.png +0 -0
  79. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/setup.cfg +0 -0
  80. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/setup.py +0 -0
  81. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/_version.py +0 -0
  82. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/analysis/__init__.py +0 -0
  83. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/analysis/error_analysis.py +0 -0
  84. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/analysis/report_tools.py +0 -0
  85. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/cli.py +0 -0
  86. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/config_args.py +0 -0
  87. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/data/__init__.py +0 -0
  88. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/data/benchmarks.json +0 -0
  89. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/data/test-benchmarks.json +0 -0
  90. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/env_loader.py +0 -0
  91. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/evaluation/__init__.py +0 -0
  92. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/evaluation/llm_judge_config/llm_judge_alt_config.yaml +0 -0
  93. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/evaluation/llm_judge_config/llm_judge_default_config.yaml +0 -0
  94. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/evaluation/llm_judge_config/llm_judge_no_gt_v1.yaml +0 -0
  95. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/evaluation/llm_judge_config/llm_judge_no_gt_v2.yaml +0 -0
  96. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/evaluation/metric_definitions.py +0 -0
  97. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/execution/__init__.py +0 -0
  98. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/execution/replace_select_tool.py +0 -0
  99. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/indexing/builder.py +0 -0
  100. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/inference/__init__.py +0 -0
  101. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/inference/base_pipeline.py +0 -0
  102. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/logging.py +0 -0
  103. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/metrics/__init__.py +0 -0
  104. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/profiling/profiling_tools.py +0 -0
  105. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/results/__init__.py +0 -0
  106. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/__init__.py +0 -0
  107. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/dataframes.py +0 -0
  108. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/indexes.py +0 -0
  109. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/jobs.py +0 -0
  110. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/paths.py +0 -0
  111. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/registry.py +0 -0
  112. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/routers_compare.py +0 -0
  113. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/routers_errors.py +0 -0
  114. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/routers_execution.py +0 -0
  115. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/routers_jobs.py +0 -0
  116. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/routers_results.py +0 -0
  117. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit/ui/static_files.py +0 -0
  118. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit.egg-info/dependency_links.txt +0 -0
  119. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit.egg-info/entry_points.txt +0 -0
  120. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/src/text2sql_eval_toolkit.egg-info/top_level.txt +0 -0
  121. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_category_summary_differential.py +0 -0
  122. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_copilot_review_fixes.py +0 -0
  123. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_dashboard_api_index.py +0 -0
  124. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_dataframe_previews.py +0 -0
  125. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_error_analysis.py +0 -0
  126. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_evaluate_prediction.py +0 -0
  127. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_index_concurrency.py +0 -0
  128. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_indexing_builder.py +0 -0
  129. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_indexing_differential.py +0 -0
  130. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_indexing_scanner.py +0 -0
  131. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_inference_tools.py +0 -0
  132. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_logging_setup.py +0 -0
  133. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_pipeline_aliases.py +0 -0
  134. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_proxy_forwarding.py +0 -0
  135. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_registry_sync.py +0 -0
  136. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_report_tools.py +0 -0
  137. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_run_experiment_behavior.py +0 -0
  138. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_run_experiment_integration.py +0 -0
  139. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_security_hardening.py +0 -0
  140. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_sql_analysis.py +0 -0
  141. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_sqlite_db_resolution.py +0 -0
  142. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_sqlite_readonly.py +0 -0
  143. {text2sql_eval_toolkit-1.3.0 → text2sql_eval_toolkit-1.4.0}/tests/test_text2sql_metrics.py +0 -0
@@ -1,10 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: text2sql-eval-toolkit
3
- Version: 1.3.0
3
+ Version: 1.4.0
4
4
  Summary: A toolkit for evaluating text-to-SQL pipelines
5
5
  Author-email: Oktie Hassanzadeh <lastname@us.ibm.com>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/IBM/text2sql-eval-toolkit
8
+ Project-URL: Documentation, https://text2sql-eval-toolkit.readthedocs.io/
9
+ Project-URL: Repository, https://github.com/IBM/text2sql-eval-toolkit
10
+ Project-URL: Changelog, https://github.com/IBM/text2sql-eval-toolkit/blob/main/CHANGELOG.md
11
+ Project-URL: Issues, https://github.com/IBM/text2sql-eval-toolkit/issues
8
12
  Classifier: Programming Language :: Python :: 3
9
13
  Classifier: License :: OSI Approved :: MIT License
10
14
  Classifier: Operating System :: OS Independent
@@ -30,6 +34,12 @@ Requires-Dist: langchain-core>=0.3.0
30
34
  Requires-Dist: openai>=1.0.0
31
35
  Requires-Dist: google-genai>=1.0.0
32
36
  Requires-Dist: huggingface_hub<1.0,>=0.30
37
+ Provides-Extra: litellm
38
+ Requires-Dist: litellm>=1.50; extra == "litellm"
39
+ Provides-Extra: docs
40
+ Requires-Dist: mkdocs>=1.6; extra == "docs"
41
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
42
+ Requires-Dist: mkdocstrings[python]>=0.26; extra == "docs"
33
43
  Provides-Extra: db2
34
44
  Requires-Dist: ibm-db>=3.2.6; extra == "db2"
35
45
  Requires-Dist: ibm-db-sa>=0.4.0; extra == "db2"
@@ -71,7 +81,7 @@ Dynamic: license-file
71
81
  > Supports execution-based metrics, multiple ground truths, LLM-as-judge, and rich error analysis.
72
82
 
73
83
  <p align="center">
74
- <img src="dashboard-screenshot.png" alt="Text2SQL Evaluation Dashboard: benchmark overview with tiles for each dataset" width="560"/>
84
+ <img src="https://raw.githubusercontent.com/IBM/text2sql-eval-toolkit/main/dashboard-screenshot.png" alt="Text2SQL Evaluation Dashboard: benchmark overview with tiles for each dataset" width="560"/>
75
85
  </p>
76
86
 
77
87
  Text-to-SQL systems aim to translate natural language questions into executable SQL queries, enabling intuitive access to structured data. While recent advances in large language models have significantly improved generation quality, evaluating these systems remains a complex and critical challenge.
@@ -101,26 +111,31 @@ Whether you're building new models, comparing existing ones, or diagnosing perfo
101
111
 
102
112
  ## Documentation
103
113
 
104
- - **[docs/dashboard/](docs/dashboard/)** — the evaluation dashboard: features,
114
+ - **[Documentation site](https://text2sql-eval-toolkit.readthedocs.io/)** — the
115
+ guide (installation, the five stages, the data model, benchmarks, models,
116
+ LLM-as-judge, the CLI and configuration) and the
117
+ [API reference](https://text2sql-eval-toolkit.readthedocs.io/en/latest/reference/) for
118
+ every exported function and class.
119
+ - **[docs/dashboard/](https://github.com/IBM/text2sql-eval-toolkit/tree/main/docs/dashboard)** — the evaluation dashboard: features,
105
120
  shareable links, the query index, capability tiers, and deployment.
106
- - **[data/benchmarks/README.md](data/benchmarks/README.md)** — benchmark
121
+ - **[data/benchmarks/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks/README.md)** — benchmark
107
122
  definitions and configuration.
108
- - **[data/benchmarks/dbs/README.md](data/benchmarks/dbs/README.md)** — database
123
+ - **[data/benchmarks/dbs/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks/dbs/README.md)** — database
109
124
  setup for each benchmark.
110
- - **[CONTRIBUTING.md](CONTRIBUTING.md)** — toolchain, tests, and coding standards.
125
+ - **[CONTRIBUTING.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/CONTRIBUTING.md)** — toolchain, tests, and coding standards.
111
126
 
112
127
  ## Components
113
128
 
114
129
  <p align="center">
115
- <img src="toolkit.png" alt="Text-to-SQL Toolkit Components" width="500"/>
130
+ <img src="https://raw.githubusercontent.com/IBM/text2sql-eval-toolkit/main/toolkit.png" alt="Text-to-SQL Toolkit Components" width="500"/>
116
131
  </p>
117
132
 
118
- - **Evaluation** ([`scripts/evaluation`](scripts/evaluation)/`src/evaluation.py`): Includes a script and library for evaluating text-to-SQL model outputs using various metrics. See [`scripts/evaluation/README.md`](scripts/evaluation/README.md) for details.
119
- - **Text-to-SQL Inference** ([`scripts/inference`](scripts/inference)): Provides a simple LLM inference pipeline for generating SQL queries from natural language inputs. Run `python scripts/inference/run_inference.py -h` for more information.
120
- - **SQL Execution** ([`scripts/execution`](scripts/execution)): Runs the ground truth and predicted SQLs for a given benchmark and saves the dataframes for evaluation and error analysis. Run `python scripts/execution/run_execution.py -h` for more information.
121
- - **Results and Error Analysis** ([`scripts/analysis`](scripts/analysis)): Contains scripts and utilities for analyzing evaluation results, identifying common error patterns, and generating summary statistics and visualizations. Useful for debugging and improving model performance.
122
- - **SQL Profiling** ([`scripts/profiling`](scripts/profiling)) tools to profile SQL queries to gather query characteristics to facilitate better analysis of results and errors.
123
- - **Evaluation Dashboard** ([`dashboard`](dashboard)): Optional FastAPI + React web UI for browsing benchmarks and pipeline metrics, error analysis (search, filters, cross-pipeline disagreement), side-by-side comparison of result summaries, editing LLM-as-judge YAML, and launching evaluations with job status. See [docs/dashboard/](docs/dashboard/) for features, deployment, and development.
133
+ - **Evaluation** ([`scripts/evaluation`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/scripts/evaluation)/`src/evaluation.py`): Includes a script and library for evaluating text-to-SQL model outputs using various metrics. See [`scripts/evaluation/README.md`](https://github.com/IBM/text2sql-eval-toolkit/blob/main/scripts/evaluation/README.md) for details.
134
+ - **Text-to-SQL Inference** ([`scripts/inference`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/scripts/inference)): Provides a simple LLM inference pipeline for generating SQL queries from natural language inputs. Run `python scripts/inference/run_inference.py -h` for more information.
135
+ - **SQL Execution** ([`scripts/execution`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/scripts/execution)): Runs the ground truth and predicted SQLs for a given benchmark and saves the dataframes for evaluation and error analysis. Run `python scripts/execution/run_execution.py -h` for more information.
136
+ - **Results and Error Analysis** ([`scripts/analysis`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/scripts/analysis)): Contains scripts and utilities for analyzing evaluation results, identifying common error patterns, and generating summary statistics and visualizations. Useful for debugging and improving model performance.
137
+ - **SQL Profiling** ([`scripts/profiling`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/scripts/profiling)) tools to profile SQL queries to gather query characteristics to facilitate better analysis of results and errors.
138
+ - **Evaluation Dashboard** ([`dashboard`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/dashboard)): Optional FastAPI + React web UI for browsing benchmarks and pipeline metrics, error analysis (search, filters, cross-pipeline disagreement), side-by-side comparison of result summaries, editing LLM-as-judge YAML, and launching evaluations with job status. See [docs/dashboard/](https://github.com/IBM/text2sql-eval-toolkit/tree/main/docs/dashboard) for features, deployment, and development.
124
139
 
125
140
  ## Setup
126
141
 
@@ -155,7 +170,7 @@ text2sql-eval-toolkit results fetch
155
170
  ```
156
171
 
157
172
  After this completes, the dashboard and analysis scripts will work
158
- against the downloaded artefacts. See [docs/dashboard/](docs/dashboard/) to launch
173
+ against the downloaded artefacts. See [docs/dashboard/](https://github.com/IBM/text2sql-eval-toolkit/tree/main/docs/dashboard) to launch
159
174
  the UI.
160
175
 
161
176
  To fetch only a specific benchmark:
@@ -216,13 +231,13 @@ pip install -e .
216
231
 
217
232
  ## Additional Requirements
218
233
 
219
- To use features that rely on LLM inference, you need to set the required environment variables for the relevant services. For watsonx.ai, this includes setting the following environment variables: `WATSONX_APIKEY`, `WATSONX_API_BASE`, and `WATSONX_PROJECTID`. See [env.example](env.example) for all available configuration options.
234
+ To use features that rely on LLM inference, you need to set the required environment variables for the relevant services. For watsonx.ai, this includes setting the following environment variables: `WATSONX_APIKEY`, `WATSONX_API_BASE`, and `WATSONX_PROJECTID`. See [env.example](https://github.com/IBM/text2sql-eval-toolkit/blob/main/env.example) for all available configuration options.
220
235
 
221
236
  ### Benchmarks
222
237
 
223
238
  The toolkit comes with pre-defined public benchmarks including BIRD-SQL, Spider, Beaver, and Archer. These benchmarks require initial setup such as downloading databases or configuring connection strings. The toolkit also includes smaller test benchmarks (subsets of the full benchmarks) for quick validation and CI/CD pipelines.
224
239
 
225
- **📚 See [data/benchmarks/README.md](data/benchmarks/README.md) for complete benchmark details, setup instructions, and configuration.**
240
+ **📚 See [data/benchmarks/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks/README.md) for complete benchmark details, setup instructions, and configuration.**
226
241
 
227
242
  ## Usage
228
243
 
@@ -301,7 +316,7 @@ agentic.run_pipeline(
301
316
  )
302
317
  ```
303
318
 
304
- See the docstrings of the exported functions/classes in `text2sql_eval_toolkit.__init__` for the full list of public APIs.
319
+ Every exported function and class is documented in the **[API reference](https://text2sql-eval-toolkit.readthedocs.io/en/latest/reference/)**, generated from the docstrings.
305
320
 
306
321
  ### Running Experiments
307
322
 
@@ -310,7 +325,7 @@ See the docstrings of the exported functions/classes in `text2sql_eval_toolkit._
310
325
  python scripts/run_experiment.py [benchmark_name]
311
326
  ```
312
327
 
313
- This will initialize a pipeline, perform inference to generate SQLs and output dataframes, and run the evaluation script to gather accuracy metrics. Benchmark names and configurations are defined in [`data/benchmarks.json`](data/benchmarks.json) (for full benchmarks) or [`data/test-benchmarks.json`](data/test-benchmarks.json) (for test benchmarks). See [data/benchmarks/README.md](data/benchmarks/README.md) for more details. Run `python scripts/run_experiment.py -h` for details on how to set different input arguments for the script.
328
+ This will initialize a pipeline, perform inference to generate SQLs and output dataframes, and run the evaluation script to gather accuracy metrics. Benchmark names and configurations are defined in [`data/benchmarks.json`](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks.json) (for full benchmarks) or [`data/test-benchmarks.json`](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/test-benchmarks.json) (for test benchmarks). See [data/benchmarks/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks/README.md) for more details. Run `python scripts/run_experiment.py -h` for details on how to set different input arguments for the script.
314
329
 
315
330
  **Multiple Benchmarks:**
316
331
  ```bash
@@ -324,7 +339,7 @@ python scripts/run_all_benchmarks.py
324
339
  python scripts/run_all_benchmarks.py --test --run_all_baselines
325
340
  ```
326
341
 
327
- The `run_all_benchmarks.py` script supports separate model configurations for standard and agentic baselines to optimize runtime. See [data/benchmarks/README.md](data/benchmarks/README.md#model-configuration) for detailed configuration options.
342
+ The `run_all_benchmarks.py` script supports separate model configurations for standard and agentic baselines to optimize runtime. See [data/benchmarks/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks/README.md#model-configuration) for detailed configuration options.
328
343
 
329
344
  ### Running Individual Components
330
345
 
@@ -334,7 +349,7 @@ To run evaluation only:
334
349
  python scripts/evaluation/run_evaluation.py [-h] [--output_file OUTPUT_FILE] [--summary_file SUMMARY_FILE] [--csv_summary_file CSV_SUMMARY_FILE] [--use_llm_judge] input_file
335
350
  ```
336
351
 
337
- See [`scripts/evaluation/README.md`](scripts/evaluation/README.md) for details.
352
+ See [`scripts/evaluation/README.md`](https://github.com/IBM/text2sql-eval-toolkit/blob/main/scripts/evaluation/README.md) for details.
338
353
 
339
354
  To run inference only:
340
355
 
@@ -371,7 +386,7 @@ To produce the results dashboard along with results summary and error analysis M
371
386
  python scripts/analysis/make_summary_report.py
372
387
  ```
373
388
 
374
- The output will be written to [data/results/README.md](data/results/README.md).
389
+ The output will be written to [data/results/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/results/README.md).
375
390
 
376
391
  ### Evaluation dashboard
377
392
 
@@ -387,7 +402,7 @@ individual record can be linked to directly.
387
402
 
388
403
  The dashboard runs as a local tool with every capability enabled, or as a
389
404
  shared read-only site with optional sign-in for a small allowlist. See
390
- **[docs/dashboard/](docs/dashboard/)** for features, the URL scheme, the query
405
+ **[docs/dashboard/](https://github.com/IBM/text2sql-eval-toolkit/tree/main/docs/dashboard)** for features, the URL scheme, the query
391
406
  index, capability tiers, and deployment.
392
407
 
393
408
  ## Project Structure
@@ -441,7 +456,7 @@ A good way to familiarize yourself with the codebase and contribution process is
441
456
 
442
457
  **Note: We appreciate your effort, and want to avoid a situation where a contribution requires extensive rework (by you or by us), sits in backlog for a long time, or cannot be accepted at all!**
443
458
 
444
- For detailed contribution guidelines, please see [CONTRIBUTING.md](CONTRIBUTING.md).
459
+ For detailed contribution guidelines, please see [CONTRIBUTING.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/CONTRIBUTING.md).
445
460
 
446
461
  ### Pull Request Process
447
462
 
@@ -453,7 +468,7 @@ For detailed contribution guidelines, please see [CONTRIBUTING.md](CONTRIBUTING.
453
468
 
454
469
  ## License
455
470
 
456
- This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for more details.
471
+ This project is licensed under the Apache License 2.0. See the [LICENSE](https://github.com/IBM/text2sql-eval-toolkit/tree/main/LICENSE) file for more details.
457
472
 
458
473
  ## Citation
459
474
 
@@ -475,9 +490,9 @@ If you use this toolkit in research, please cite:
475
490
 
476
491
  ## Additional Resources
477
492
 
478
- - [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) - Community guidelines
479
- - [SECURITY.md](SECURITY.md) - Security policy and vulnerability reporting
480
- - [MAINTAINERS.md](MAINTAINERS.md) - Project maintainers
481
- - [CHANGELOG.md](CHANGELOG.md) - Project changelog
493
+ - [CODE_OF_CONDUCT.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/CODE_OF_CONDUCT.md) - Community guidelines
494
+ - [SECURITY.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/SECURITY.md) - Security policy and vulnerability reporting
495
+ - [MAINTAINERS.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/MAINTAINERS.md) - Project maintainers
496
+ - [CHANGELOG.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/CHANGELOG.md) - Project changelog
482
497
 
483
498
  [issues]: https://github.com/IBM/text2sql-eval-toolkit/issues/new
@@ -4,7 +4,7 @@
4
4
  > Supports execution-based metrics, multiple ground truths, LLM-as-judge, and rich error analysis.
5
5
 
6
6
  <p align="center">
7
- <img src="dashboard-screenshot.png" alt="Text2SQL Evaluation Dashboard: benchmark overview with tiles for each dataset" width="560"/>
7
+ <img src="https://raw.githubusercontent.com/IBM/text2sql-eval-toolkit/main/dashboard-screenshot.png" alt="Text2SQL Evaluation Dashboard: benchmark overview with tiles for each dataset" width="560"/>
8
8
  </p>
9
9
 
10
10
  Text-to-SQL systems aim to translate natural language questions into executable SQL queries, enabling intuitive access to structured data. While recent advances in large language models have significantly improved generation quality, evaluating these systems remains a complex and critical challenge.
@@ -34,26 +34,31 @@ Whether you're building new models, comparing existing ones, or diagnosing perfo
34
34
 
35
35
  ## Documentation
36
36
 
37
- - **[docs/dashboard/](docs/dashboard/)** — the evaluation dashboard: features,
37
+ - **[Documentation site](https://text2sql-eval-toolkit.readthedocs.io/)** — the
38
+ guide (installation, the five stages, the data model, benchmarks, models,
39
+ LLM-as-judge, the CLI and configuration) and the
40
+ [API reference](https://text2sql-eval-toolkit.readthedocs.io/en/latest/reference/) for
41
+ every exported function and class.
42
+ - **[docs/dashboard/](https://github.com/IBM/text2sql-eval-toolkit/tree/main/docs/dashboard)** — the evaluation dashboard: features,
38
43
  shareable links, the query index, capability tiers, and deployment.
39
- - **[data/benchmarks/README.md](data/benchmarks/README.md)** — benchmark
44
+ - **[data/benchmarks/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks/README.md)** — benchmark
40
45
  definitions and configuration.
41
- - **[data/benchmarks/dbs/README.md](data/benchmarks/dbs/README.md)** — database
46
+ - **[data/benchmarks/dbs/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks/dbs/README.md)** — database
42
47
  setup for each benchmark.
43
- - **[CONTRIBUTING.md](CONTRIBUTING.md)** — toolchain, tests, and coding standards.
48
+ - **[CONTRIBUTING.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/CONTRIBUTING.md)** — toolchain, tests, and coding standards.
44
49
 
45
50
  ## Components
46
51
 
47
52
  <p align="center">
48
- <img src="toolkit.png" alt="Text-to-SQL Toolkit Components" width="500"/>
53
+ <img src="https://raw.githubusercontent.com/IBM/text2sql-eval-toolkit/main/toolkit.png" alt="Text-to-SQL Toolkit Components" width="500"/>
49
54
  </p>
50
55
 
51
- - **Evaluation** ([`scripts/evaluation`](scripts/evaluation)/`src/evaluation.py`): Includes a script and library for evaluating text-to-SQL model outputs using various metrics. See [`scripts/evaluation/README.md`](scripts/evaluation/README.md) for details.
52
- - **Text-to-SQL Inference** ([`scripts/inference`](scripts/inference)): Provides a simple LLM inference pipeline for generating SQL queries from natural language inputs. Run `python scripts/inference/run_inference.py -h` for more information.
53
- - **SQL Execution** ([`scripts/execution`](scripts/execution)): Runs the ground truth and predicted SQLs for a given benchmark and saves the dataframes for evaluation and error analysis. Run `python scripts/execution/run_execution.py -h` for more information.
54
- - **Results and Error Analysis** ([`scripts/analysis`](scripts/analysis)): Contains scripts and utilities for analyzing evaluation results, identifying common error patterns, and generating summary statistics and visualizations. Useful for debugging and improving model performance.
55
- - **SQL Profiling** ([`scripts/profiling`](scripts/profiling)) tools to profile SQL queries to gather query characteristics to facilitate better analysis of results and errors.
56
- - **Evaluation Dashboard** ([`dashboard`](dashboard)): Optional FastAPI + React web UI for browsing benchmarks and pipeline metrics, error analysis (search, filters, cross-pipeline disagreement), side-by-side comparison of result summaries, editing LLM-as-judge YAML, and launching evaluations with job status. See [docs/dashboard/](docs/dashboard/) for features, deployment, and development.
56
+ - **Evaluation** ([`scripts/evaluation`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/scripts/evaluation)/`src/evaluation.py`): Includes a script and library for evaluating text-to-SQL model outputs using various metrics. See [`scripts/evaluation/README.md`](https://github.com/IBM/text2sql-eval-toolkit/blob/main/scripts/evaluation/README.md) for details.
57
+ - **Text-to-SQL Inference** ([`scripts/inference`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/scripts/inference)): Provides a simple LLM inference pipeline for generating SQL queries from natural language inputs. Run `python scripts/inference/run_inference.py -h` for more information.
58
+ - **SQL Execution** ([`scripts/execution`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/scripts/execution)): Runs the ground truth and predicted SQLs for a given benchmark and saves the dataframes for evaluation and error analysis. Run `python scripts/execution/run_execution.py -h` for more information.
59
+ - **Results and Error Analysis** ([`scripts/analysis`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/scripts/analysis)): Contains scripts and utilities for analyzing evaluation results, identifying common error patterns, and generating summary statistics and visualizations. Useful for debugging and improving model performance.
60
+ - **SQL Profiling** ([`scripts/profiling`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/scripts/profiling)) tools to profile SQL queries to gather query characteristics to facilitate better analysis of results and errors.
61
+ - **Evaluation Dashboard** ([`dashboard`](https://github.com/IBM/text2sql-eval-toolkit/tree/main/dashboard)): Optional FastAPI + React web UI for browsing benchmarks and pipeline metrics, error analysis (search, filters, cross-pipeline disagreement), side-by-side comparison of result summaries, editing LLM-as-judge YAML, and launching evaluations with job status. See [docs/dashboard/](https://github.com/IBM/text2sql-eval-toolkit/tree/main/docs/dashboard) for features, deployment, and development.
57
62
 
58
63
  ## Setup
59
64
 
@@ -88,7 +93,7 @@ text2sql-eval-toolkit results fetch
88
93
  ```
89
94
 
90
95
  After this completes, the dashboard and analysis scripts will work
91
- against the downloaded artefacts. See [docs/dashboard/](docs/dashboard/) to launch
96
+ against the downloaded artefacts. See [docs/dashboard/](https://github.com/IBM/text2sql-eval-toolkit/tree/main/docs/dashboard) to launch
92
97
  the UI.
93
98
 
94
99
  To fetch only a specific benchmark:
@@ -149,13 +154,13 @@ pip install -e .
149
154
 
150
155
  ## Additional Requirements
151
156
 
152
- To use features that rely on LLM inference, you need to set the required environment variables for the relevant services. For watsonx.ai, this includes setting the following environment variables: `WATSONX_APIKEY`, `WATSONX_API_BASE`, and `WATSONX_PROJECTID`. See [env.example](env.example) for all available configuration options.
157
+ To use features that rely on LLM inference, you need to set the required environment variables for the relevant services. For watsonx.ai, this includes setting the following environment variables: `WATSONX_APIKEY`, `WATSONX_API_BASE`, and `WATSONX_PROJECTID`. See [env.example](https://github.com/IBM/text2sql-eval-toolkit/blob/main/env.example) for all available configuration options.
153
158
 
154
159
  ### Benchmarks
155
160
 
156
161
  The toolkit comes with pre-defined public benchmarks including BIRD-SQL, Spider, Beaver, and Archer. These benchmarks require initial setup such as downloading databases or configuring connection strings. The toolkit also includes smaller test benchmarks (subsets of the full benchmarks) for quick validation and CI/CD pipelines.
157
162
 
158
- **📚 See [data/benchmarks/README.md](data/benchmarks/README.md) for complete benchmark details, setup instructions, and configuration.**
163
+ **📚 See [data/benchmarks/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks/README.md) for complete benchmark details, setup instructions, and configuration.**
159
164
 
160
165
  ## Usage
161
166
 
@@ -234,7 +239,7 @@ agentic.run_pipeline(
234
239
  )
235
240
  ```
236
241
 
237
- See the docstrings of the exported functions/classes in `text2sql_eval_toolkit.__init__` for the full list of public APIs.
242
+ Every exported function and class is documented in the **[API reference](https://text2sql-eval-toolkit.readthedocs.io/en/latest/reference/)**, generated from the docstrings.
238
243
 
239
244
  ### Running Experiments
240
245
 
@@ -243,7 +248,7 @@ See the docstrings of the exported functions/classes in `text2sql_eval_toolkit._
243
248
  python scripts/run_experiment.py [benchmark_name]
244
249
  ```
245
250
 
246
- This will initialize a pipeline, perform inference to generate SQLs and output dataframes, and run the evaluation script to gather accuracy metrics. Benchmark names and configurations are defined in [`data/benchmarks.json`](data/benchmarks.json) (for full benchmarks) or [`data/test-benchmarks.json`](data/test-benchmarks.json) (for test benchmarks). See [data/benchmarks/README.md](data/benchmarks/README.md) for more details. Run `python scripts/run_experiment.py -h` for details on how to set different input arguments for the script.
251
+ This will initialize a pipeline, perform inference to generate SQLs and output dataframes, and run the evaluation script to gather accuracy metrics. Benchmark names and configurations are defined in [`data/benchmarks.json`](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks.json) (for full benchmarks) or [`data/test-benchmarks.json`](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/test-benchmarks.json) (for test benchmarks). See [data/benchmarks/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks/README.md) for more details. Run `python scripts/run_experiment.py -h` for details on how to set different input arguments for the script.
247
252
 
248
253
  **Multiple Benchmarks:**
249
254
  ```bash
@@ -257,7 +262,7 @@ python scripts/run_all_benchmarks.py
257
262
  python scripts/run_all_benchmarks.py --test --run_all_baselines
258
263
  ```
259
264
 
260
- The `run_all_benchmarks.py` script supports separate model configurations for standard and agentic baselines to optimize runtime. See [data/benchmarks/README.md](data/benchmarks/README.md#model-configuration) for detailed configuration options.
265
+ The `run_all_benchmarks.py` script supports separate model configurations for standard and agentic baselines to optimize runtime. See [data/benchmarks/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/benchmarks/README.md#model-configuration) for detailed configuration options.
261
266
 
262
267
  ### Running Individual Components
263
268
 
@@ -267,7 +272,7 @@ To run evaluation only:
267
272
  python scripts/evaluation/run_evaluation.py [-h] [--output_file OUTPUT_FILE] [--summary_file SUMMARY_FILE] [--csv_summary_file CSV_SUMMARY_FILE] [--use_llm_judge] input_file
268
273
  ```
269
274
 
270
- See [`scripts/evaluation/README.md`](scripts/evaluation/README.md) for details.
275
+ See [`scripts/evaluation/README.md`](https://github.com/IBM/text2sql-eval-toolkit/blob/main/scripts/evaluation/README.md) for details.
271
276
 
272
277
  To run inference only:
273
278
 
@@ -304,7 +309,7 @@ To produce the results dashboard along with results summary and error analysis M
304
309
  python scripts/analysis/make_summary_report.py
305
310
  ```
306
311
 
307
- The output will be written to [data/results/README.md](data/results/README.md).
312
+ The output will be written to [data/results/README.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/data/results/README.md).
308
313
 
309
314
  ### Evaluation dashboard
310
315
 
@@ -320,7 +325,7 @@ individual record can be linked to directly.
320
325
 
321
326
  The dashboard runs as a local tool with every capability enabled, or as a
322
327
  shared read-only site with optional sign-in for a small allowlist. See
323
- **[docs/dashboard/](docs/dashboard/)** for features, the URL scheme, the query
328
+ **[docs/dashboard/](https://github.com/IBM/text2sql-eval-toolkit/tree/main/docs/dashboard)** for features, the URL scheme, the query
324
329
  index, capability tiers, and deployment.
325
330
 
326
331
  ## Project Structure
@@ -374,7 +379,7 @@ A good way to familiarize yourself with the codebase and contribution process is
374
379
 
375
380
  **Note: We appreciate your effort, and want to avoid a situation where a contribution requires extensive rework (by you or by us), sits in backlog for a long time, or cannot be accepted at all!**
376
381
 
377
- For detailed contribution guidelines, please see [CONTRIBUTING.md](CONTRIBUTING.md).
382
+ For detailed contribution guidelines, please see [CONTRIBUTING.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/CONTRIBUTING.md).
378
383
 
379
384
  ### Pull Request Process
380
385
 
@@ -386,7 +391,7 @@ For detailed contribution guidelines, please see [CONTRIBUTING.md](CONTRIBUTING.
386
391
 
387
392
  ## License
388
393
 
389
- This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for more details.
394
+ This project is licensed under the Apache License 2.0. See the [LICENSE](https://github.com/IBM/text2sql-eval-toolkit/tree/main/LICENSE) file for more details.
390
395
 
391
396
  ## Citation
392
397
 
@@ -408,9 +413,9 @@ If you use this toolkit in research, please cite:
408
413
 
409
414
  ## Additional Resources
410
415
 
411
- - [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) - Community guidelines
412
- - [SECURITY.md](SECURITY.md) - Security policy and vulnerability reporting
413
- - [MAINTAINERS.md](MAINTAINERS.md) - Project maintainers
414
- - [CHANGELOG.md](CHANGELOG.md) - Project changelog
416
+ - [CODE_OF_CONDUCT.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/CODE_OF_CONDUCT.md) - Community guidelines
417
+ - [SECURITY.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/SECURITY.md) - Security policy and vulnerability reporting
418
+ - [MAINTAINERS.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/MAINTAINERS.md) - Project maintainers
419
+ - [CHANGELOG.md](https://github.com/IBM/text2sql-eval-toolkit/blob/main/CHANGELOG.md) - Project changelog
415
420
 
416
421
  [issues]: https://github.com/IBM/text2sql-eval-toolkit/issues/new
@@ -1,4 +1,4 @@
1
- import{R as p,u as Ne,a as Be,r as l,b as Oe,F as Ke,c as We,d as ee,m as He,i as qe,_ as te,W as Ue,e as Ve,C as Qe,f as Xe,s as Ge,g as Je,h as Ye,A as Ze,P as i,j as ue,k as s,I as ve,l as et,D as tt,B as se,n as st,T as at,o as it,p as nt,q as je,t as rt,v as lt,w as ot,x as dt,y as ct,z as ut}from"./index-C9VP9iwL.js";import{d as _e,u as $e,L as ae,a as mt,b as pt}from"./defaultItemToString-BtCahKYf.js";const{ItemMouseMove:ht,MenuMouseLeave:ft,ToggleButtonBlur:gt,FunctionCloseMenu:bt}=$e.stateChangeTypes;function Ie(o,E){const{changes:h,type:S}=E;switch(S){case ht:return o;case ft:return h.highlightedIndex===o.highlightedIndex?o:h;case gt:case bt:return{...h,selectedItem:o.selectedItem};default:return h}}const ie=p.forwardRef(({autoAlign:o=!1,className:E,decorator:h,disabled:S=!1,direction:z="bottom",items:R,label:A,["aria-label"]:I,ariaLabel:Q,itemToString:b=_e,itemToElement:L=null,renderSelectedItem:N,type:X="default",size:D,onChange:y,id:F,titleText:B="",hideLabel:m,helperText:O="",translateWithId:M,light:K,invalid:G,invalidText:$,warn:ne,warnText:P,initialSelectedItem:W,selectedItem:H,downshiftProps:J,readOnly:w,slug:v,...re},Y)=>{const C=Ne("enable-v12-dynamic-floating-styles"),{refs:j,floatingStyles:q,middlewareData:le}=Be(C||o?{placement:z,strategy:"fixed",middleware:[Ge({apply({rects:a,elements:c}){Object.assign(c.floating.style,{width:`${a.reference.width}px`})}}),o&&Je(),o&&Ye()],whileElementsMounted:Xe}:{});l.useEffect(()=>{var a;if(C||o){const c={...q,visibility:(a=le.hide)!=null&&a.referenceHidden?"hidden":"visible"};Object.keys(c).forEach(_=>{j.floating.current&&(j.floating.current.style[_]=c[_])})}},[q,o,j.floating]);const e=Oe(),{isFluid:t}=l.useContext(Ke),n=l.useCallback(({selectedItem:a})=>{y&&y({selectedItem:a??null})},[y]),u=l.useCallback((a,c)=>a!==null&&typeof a=="object"&&"disabled"in a&&a.disabled===!0,[]),d=l.useCallback(a=>{const{highlightedIndex:c}=a;if(c!==void 0&&c>-1){const Z=document.querySelectorAll(`li.${e}--list-box__menu-item[role="option"]`)[c];Z&&Z.scrollIntoView({behavior:"smooth",block:"nearest"})}},[e]),f=l.useMemo(()=>R,[R]),k=l.useMemo(()=>({items:f,itemToString:b,initialSelectedItem:W,onSelectedItemChange:n,stateReducer:Ie,isItemDisabled:u,onHighlightedIndexChange:d,...J}),[f,b,W,n,Ie,u,d,J]);H!==void 0&&(k.selectedItem=H);const{isOpen:g,getToggleButtonProps:Ce,getLabelProps:ke,getMenuProps:me,getItemProps:Te,selectedItem:x,highlightedIndex:Ee}=$e(k),T=X==="inline",r=We({id:F,readOnly:w,disabled:S??!1,invalid:G??!1,invalidText:$,warn:ne??!1,warnText:P}),[Se,oe]=l.useState(!1),De=ee(`${e}--dropdown`,{[`${e}--dropdown--invalid`]:r.invalid,[`${e}--dropdown--warning`]:r.warn,[`${e}--dropdown--open`]:g,[`${e}--dropdown--focus`]:Se,[`${e}--dropdown--inline`]:T,[`${e}--dropdown--disabled`]:r.disabled,[`${e}--dropdown--light`]:K,[`${e}--dropdown--readonly`]:w,[`${e}--dropdown--${D}`]:D,[`${e}--list-box--up`]:z==="top",[`${e}--autoalign`]:o}),Fe=ee(`${e}--label`,{[`${e}--label--disabled`]:r.disabled,[`${e}--visually-hidden`]:m}),Me=ee(`${e}--form__helper-text`,{[`${e}--form__helper-text--disabled`]:r.disabled}),Pe=ee(`${e}--dropdown__wrapper`,`${e}--list-box__wrapper`,E,{[`${e}--dropdown__wrapper--inline`]:T,[`${e}--list-box__wrapper--inline`]:T,[`${e}--dropdown__wrapper--inline--invalid`]:T&&r.invalid,[`${e}--list-box__wrapper--inline--invalid`]:T&&r.invalid,[`${e}--list-box__wrapper--fluid--invalid`]:t&&r.invalid,[`${e}--list-box__wrapper--slug`]:v,[`${e}--list-box__wrapper--decorator`]:h}),U=Ce({"aria-label":I||Q}),pe=O&&!t?p.createElement("div",{id:r.helperId,className:Me},O):null,he=a=>{oe(a.type==="focus"&&!x)},fe=l.useRef(null),ze=He(U.ref,Y,fe),[V,ge]=l.useState(),[be,de]=l.useState(!1),xe=l.useCallback(a=>{["ArrowDown","ArrowUp"," ","Enter"].includes(a.key)?be&&a.key===" "&&(V&&clearTimeout(V),ge(setTimeout(()=>{de(!1)},3e3))):(de(!0),V&&clearTimeout(V),ge(setTimeout(()=>{de(!1)},3e3))),["ArrowDown"].includes(a.key)&&oe(!1),["Enter"].includes(a.key)&&!x&&!g&&oe(!0),U.onKeyDown&&(a.key!=="ArrowUp"||g&&a.key==="ArrowUp")&&U.onKeyDown(a)},[be,V,U]),Re=l.useMemo(()=>w?{onClick:a=>{var c;a.preventDefault(),(c=fe.current)==null||c.focus()},onKeyDown:a=>{["ArrowDown","ArrowUp"," ","Enter"].includes(a.key)&&a.preventDefault()}}:{onKeyDown:xe},[w,xe]),Ae=l.useMemo(()=>me({ref:C||o?j.setFloating:null}),[o,me,j.setFloating,C]),ce=v??h,ye=qe(ce,Ze)?l.cloneElement(ce,{size:"mini"}):ce,we=ke(),Le=l.isValidElement(B)?{id:we.id}:we;return p.createElement("div",te({className:Pe},re),B&&p.createElement("label",te({className:Fe},Le),B),p.createElement(ae,{onFocus:he,onBlur:he,size:D,className:De,invalid:r.invalid,invalidText:$,invalidTextId:r.invalidId,warn:r.warn,warnText:P,warnTextId:r.warnId,light:K,isOpen:g,ref:C||o?j.setReference:null,id:F},r.invalid&&p.createElement(Ue,{className:`${e}--list-box__invalid-icon`}),r.warn&&p.createElement(Ve,{className:`${e}--list-box__invalid-icon ${e}--list-box__invalid-icon--warning`}),p.createElement("button",te({type:"button",className:`${e}--list-box__field`,disabled:r.disabled,"aria-disabled":w?!0:void 0,"aria-describedby":!T&&!r.invalid&&!r.warn&&pe?r.helperId:r.invalid?r.invalidId:r.warn?r.warnId:void 0,title:x&&b!==void 0?b(x):_e(A)},U,Re,{ref:ze}),p.createElement("span",{className:`${e}--list-box__label`},x?N?N(x):b(x):A),p.createElement(ae.MenuIcon,{isOpen:g,translateWithId:M})),v?ye:h?p.createElement("div",{className:`${e}--list-box__inner-wrapper--decorator`},ye):"",p.createElement(ae.Menu,Ae,g&&f.map((a,c)=>{const _=Te({item:a,index:c}),Z=b(a);return p.createElement(ae.MenuItem,te({key:_.id,isActive:x===a,isHighlighted:Ee===c,title:Z,disabled:_["aria-disabled"]},_),L?L(a):b(a),x===a&&p.createElement(Qe,{className:`${e}--list-box__menu-item__selected-icon`}))}))),!T&&!t&&!r.validation&&pe)});ie.displayName="Dropdown";ie.propTypes={"aria-label":i.string,ariaLabel:ue(i.string),autoAlign:i.bool,className:i.string,decorator:i.node,direction:i.oneOf(["top","bottom"]),disabled:i.bool,downshiftProps:i.object,helperText:i.node,hideLabel:i.bool,id:i.string.isRequired,initialSelectedItem:i.oneOfType([i.object,i.string,i.number]),invalid:i.bool,invalidText:i.node,itemToElement:i.func,itemToString:i.func,items:i.array.isRequired,label:i.node.isRequired,light:ue(i.bool),onChange:i.func,readOnly:i.bool,renderSelectedItem:i.func,selectedItem:i.oneOfType([i.object,i.string,i.number]),size:pt,slug:ue(i.node),titleText:i.node.isRequired,translateWithId:i.func,type:mt,warn:i.bool,warnText:i.node};const vt=({benchmarkId:o,style:E,onSelectPipeline:h,onOpenToolkitInsights:S,onOpenPipelineCompare:z,onOpenProfileCompare:R,onOpenErrorAnalysis:A})=>{const[I,Q]=l.useState(null),[b,L]=l.useState(!0),[N,X]=l.useState(null),[D,y]=l.useState(1),[F,B]=l.useState(10),[m,O]=l.useState(null),[M,K]=l.useState("overall");if(l.useEffect(()=>{(async()=>{try{L(!0),X(null),Q(null);const n=await(await ct(ut(`/api/benchmarks/${o}/summary/by-category`))).json();Q(n),O(n.default_sort_metric),K("overall"),y(1)}catch(t){X(t.message||"Failed to load benchmark summary")}finally{L(!1)}})()},[o]),N)return s.jsx(ve,{kind:"error",title:`Error loading summary for ${o}`,subtitle:N,lowContrast:!0});if(b)return s.jsxs("div",{style:{...E,display:"flex",flexDirection:"column",gap:"1rem"},children:[s.jsxs("h3",{style:{margin:0},children:[o," – Summary"]}),s.jsx(et,{description:`Loading benchmark summary for ${o}…`,status:"active"}),s.jsx(tt,{role:"progressbar",columnCount:5,rowCount:8})]});if(!I)return null;const G=M==="overall"?I.overall:I.categories[M]||[],$=new Set;G.forEach(e=>{Object.keys(e.metrics).forEach(t=>{t!=="num_records"&&t!=="num_evaluated"&&$.add(t)})});const ne=[{key:"name",header:"Pipeline"},...Array.from($).map(e=>({key:e,header:e}))],P=[...G].sort((e,t)=>{var d,f,k,g;if(!m)return 0;const n=((f=(d=e.metrics)==null?void 0:d[m])==null?void 0:f.average)??0;return(((g=(k=t.metrics)==null?void 0:k[m])==null?void 0:g.average)??0)-n}),W=e=>{var n;if(!m)return 0;const t=(n=e.metrics)==null?void 0:n[m];return typeof t=="number"?t:t&&typeof t=="object"&&typeof t.average=="number"?t.average:0},H=e=>{var n;if(!m)return 0;const t=(n=e.metrics)==null?void 0:n[m];return t&&typeof t=="object"&&typeof t.stddev=="number"?Math.max(0,t.stddev):0},J=e=>{var d;if(!m)return{low:0,high:0,hasCI:!1};const t=(d=e.metrics)==null?void 0:d[m];if(t&&typeof t=="object"&&typeof t.ci95_low=="number"&&typeof t.ci95_high=="number")return{low:t.ci95_low,high:t.ci95_high,hasCI:!0};const n=W(e),u=H(e);return{low:Math.max(0,n-u),high:n+u,hasCI:!1}},w=P.map(e=>({name:e.name,value:W(e),stddev:H(e),ci:J(e)})),v=w.reduce((e,t)=>Math.max(e,t.value,t.ci.high),0)||1,re=P.length,Y=(D-1)*F,C=Y+F,j=P.slice(Y,C),q=Array.from($),le=["overall",...Object.keys(I.categories)];return s.jsxs("div",{style:{...E,display:"flex",flexDirection:"column",gap:"0.5rem"},children:[I.has_full_results===!1&&s.jsx(ve,{kind:"info",title:"Summary-only mode",subtitle:`The full evaluation results file (${o}-predictions_eval.json) was not found. Overall pipeline metrics are shown from the summary file, but category breakdown and error analysis are unavailable. Download pre-computed results with: text2sql-eval-toolkit results fetch --benchmarks ${o} or run the evaluation pipeline locally (or fix TEXT2SQL_DATA_ROOT to a directory that already contains this file).`,lowContrast:!0}),s.jsxs("div",{style:{display:"flex",gap:"1rem",alignItems:"center"},children:[s.jsxs("h3",{style:{margin:0},children:[o," – Summary"]}),s.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:"0.75rem",alignItems:"center"},children:[S&&s.jsx(se,{kind:"ghost",size:"sm",onClick:()=>S(),children:"Metric Insights"}),z&&s.jsx(se,{kind:"ghost",size:"sm",onClick:()=>z(),children:"Pipeline Compare"}),R&&s.jsx(se,{kind:"ghost",size:"sm",onClick:()=>R(),children:"Profile Compare"}),A&&s.jsx(se,{kind:"ghost",size:"sm",onClick:()=>A(),children:"Error Analysis"}),s.jsx("div",{style:{minWidth:"220px"},children:s.jsx(ie,{id:"category-dropdown",titleText:"Query Category",label:M,items:le,selectedItem:M,onChange:e=>{K(e.selectedItem),y(1)}})}),q.length>0&&s.jsx("div",{style:{minWidth:"260px"},children:s.jsx(ie,{id:"sort-metric-dropdown",titleText:"Sort by metric",label:m||"Select metric",items:q,selectedItem:m,onChange:e=>{O(e.selectedItem),y(1)}})})]})]}),s.jsxs("div",{style:{border:"1px solid rgba(255,255,255,0.12)",borderRadius:"6px",padding:"0.75rem",background:"rgba(255,255,255,0.02)"},children:[s.jsxs("div",{style:{marginBottom:"0.5rem",fontWeight:600},children:["Pipeline performance by ",m||"selected metric"]}),s.jsx("div",{style:{maxHeight:"260px",overflow:"auto",display:"flex",flexDirection:"column",gap:"0.45rem"},children:w.map(e=>{const t=Math.max(2,e.value/v*100),n=Math.max(0,e.ci.low),u=Math.min(v,e.ci.high),d=n/v*100,f=u/v*100,k=Math.max(0,f-d),g=f>=99.9;return s.jsxs("div",{title:e.ci.hasCI?`${e.name}
1
+ import{R as p,u as Ne,a as Be,r as l,b as Oe,F as Ke,c as We,d as ee,m as He,i as qe,_ as te,W as Ue,e as Ve,C as Qe,f as Xe,s as Ge,g as Je,h as Ye,A as Ze,P as i,j as ue,k as s,I as ve,l as et,D as tt,B as se,n as st,T as at,o as it,p as nt,q as je,t as rt,v as lt,w as ot,x as dt,y as ct,z as ut}from"./index-DLyduwv0.js";import{d as _e,u as $e,L as ae,a as mt,b as pt}from"./defaultItemToString-ClUBp4QC.js";const{ItemMouseMove:ht,MenuMouseLeave:ft,ToggleButtonBlur:gt,FunctionCloseMenu:bt}=$e.stateChangeTypes;function Ie(o,E){const{changes:h,type:S}=E;switch(S){case ht:return o;case ft:return h.highlightedIndex===o.highlightedIndex?o:h;case gt:case bt:return{...h,selectedItem:o.selectedItem};default:return h}}const ie=p.forwardRef(({autoAlign:o=!1,className:E,decorator:h,disabled:S=!1,direction:z="bottom",items:R,label:A,["aria-label"]:I,ariaLabel:Q,itemToString:b=_e,itemToElement:L=null,renderSelectedItem:N,type:X="default",size:D,onChange:y,id:F,titleText:B="",hideLabel:m,helperText:O="",translateWithId:M,light:K,invalid:G,invalidText:$,warn:ne,warnText:P,initialSelectedItem:W,selectedItem:H,downshiftProps:J,readOnly:w,slug:v,...re},Y)=>{const C=Ne("enable-v12-dynamic-floating-styles"),{refs:j,floatingStyles:q,middlewareData:le}=Be(C||o?{placement:z,strategy:"fixed",middleware:[Ge({apply({rects:a,elements:c}){Object.assign(c.floating.style,{width:`${a.reference.width}px`})}}),o&&Je(),o&&Ye()],whileElementsMounted:Xe}:{});l.useEffect(()=>{var a;if(C||o){const c={...q,visibility:(a=le.hide)!=null&&a.referenceHidden?"hidden":"visible"};Object.keys(c).forEach(_=>{j.floating.current&&(j.floating.current.style[_]=c[_])})}},[q,o,j.floating]);const e=Oe(),{isFluid:t}=l.useContext(Ke),n=l.useCallback(({selectedItem:a})=>{y&&y({selectedItem:a??null})},[y]),u=l.useCallback((a,c)=>a!==null&&typeof a=="object"&&"disabled"in a&&a.disabled===!0,[]),d=l.useCallback(a=>{const{highlightedIndex:c}=a;if(c!==void 0&&c>-1){const Z=document.querySelectorAll(`li.${e}--list-box__menu-item[role="option"]`)[c];Z&&Z.scrollIntoView({behavior:"smooth",block:"nearest"})}},[e]),f=l.useMemo(()=>R,[R]),k=l.useMemo(()=>({items:f,itemToString:b,initialSelectedItem:W,onSelectedItemChange:n,stateReducer:Ie,isItemDisabled:u,onHighlightedIndexChange:d,...J}),[f,b,W,n,Ie,u,d,J]);H!==void 0&&(k.selectedItem=H);const{isOpen:g,getToggleButtonProps:Ce,getLabelProps:ke,getMenuProps:me,getItemProps:Te,selectedItem:x,highlightedIndex:Ee}=$e(k),T=X==="inline",r=We({id:F,readOnly:w,disabled:S??!1,invalid:G??!1,invalidText:$,warn:ne??!1,warnText:P}),[Se,oe]=l.useState(!1),De=ee(`${e}--dropdown`,{[`${e}--dropdown--invalid`]:r.invalid,[`${e}--dropdown--warning`]:r.warn,[`${e}--dropdown--open`]:g,[`${e}--dropdown--focus`]:Se,[`${e}--dropdown--inline`]:T,[`${e}--dropdown--disabled`]:r.disabled,[`${e}--dropdown--light`]:K,[`${e}--dropdown--readonly`]:w,[`${e}--dropdown--${D}`]:D,[`${e}--list-box--up`]:z==="top",[`${e}--autoalign`]:o}),Fe=ee(`${e}--label`,{[`${e}--label--disabled`]:r.disabled,[`${e}--visually-hidden`]:m}),Me=ee(`${e}--form__helper-text`,{[`${e}--form__helper-text--disabled`]:r.disabled}),Pe=ee(`${e}--dropdown__wrapper`,`${e}--list-box__wrapper`,E,{[`${e}--dropdown__wrapper--inline`]:T,[`${e}--list-box__wrapper--inline`]:T,[`${e}--dropdown__wrapper--inline--invalid`]:T&&r.invalid,[`${e}--list-box__wrapper--inline--invalid`]:T&&r.invalid,[`${e}--list-box__wrapper--fluid--invalid`]:t&&r.invalid,[`${e}--list-box__wrapper--slug`]:v,[`${e}--list-box__wrapper--decorator`]:h}),U=Ce({"aria-label":I||Q}),pe=O&&!t?p.createElement("div",{id:r.helperId,className:Me},O):null,he=a=>{oe(a.type==="focus"&&!x)},fe=l.useRef(null),ze=He(U.ref,Y,fe),[V,ge]=l.useState(),[be,de]=l.useState(!1),xe=l.useCallback(a=>{["ArrowDown","ArrowUp"," ","Enter"].includes(a.key)?be&&a.key===" "&&(V&&clearTimeout(V),ge(setTimeout(()=>{de(!1)},3e3))):(de(!0),V&&clearTimeout(V),ge(setTimeout(()=>{de(!1)},3e3))),["ArrowDown"].includes(a.key)&&oe(!1),["Enter"].includes(a.key)&&!x&&!g&&oe(!0),U.onKeyDown&&(a.key!=="ArrowUp"||g&&a.key==="ArrowUp")&&U.onKeyDown(a)},[be,V,U]),Re=l.useMemo(()=>w?{onClick:a=>{var c;a.preventDefault(),(c=fe.current)==null||c.focus()},onKeyDown:a=>{["ArrowDown","ArrowUp"," ","Enter"].includes(a.key)&&a.preventDefault()}}:{onKeyDown:xe},[w,xe]),Ae=l.useMemo(()=>me({ref:C||o?j.setFloating:null}),[o,me,j.setFloating,C]),ce=v??h,ye=qe(ce,Ze)?l.cloneElement(ce,{size:"mini"}):ce,we=ke(),Le=l.isValidElement(B)?{id:we.id}:we;return p.createElement("div",te({className:Pe},re),B&&p.createElement("label",te({className:Fe},Le),B),p.createElement(ae,{onFocus:he,onBlur:he,size:D,className:De,invalid:r.invalid,invalidText:$,invalidTextId:r.invalidId,warn:r.warn,warnText:P,warnTextId:r.warnId,light:K,isOpen:g,ref:C||o?j.setReference:null,id:F},r.invalid&&p.createElement(Ue,{className:`${e}--list-box__invalid-icon`}),r.warn&&p.createElement(Ve,{className:`${e}--list-box__invalid-icon ${e}--list-box__invalid-icon--warning`}),p.createElement("button",te({type:"button",className:`${e}--list-box__field`,disabled:r.disabled,"aria-disabled":w?!0:void 0,"aria-describedby":!T&&!r.invalid&&!r.warn&&pe?r.helperId:r.invalid?r.invalidId:r.warn?r.warnId:void 0,title:x&&b!==void 0?b(x):_e(A)},U,Re,{ref:ze}),p.createElement("span",{className:`${e}--list-box__label`},x?N?N(x):b(x):A),p.createElement(ae.MenuIcon,{isOpen:g,translateWithId:M})),v?ye:h?p.createElement("div",{className:`${e}--list-box__inner-wrapper--decorator`},ye):"",p.createElement(ae.Menu,Ae,g&&f.map((a,c)=>{const _=Te({item:a,index:c}),Z=b(a);return p.createElement(ae.MenuItem,te({key:_.id,isActive:x===a,isHighlighted:Ee===c,title:Z,disabled:_["aria-disabled"]},_),L?L(a):b(a),x===a&&p.createElement(Qe,{className:`${e}--list-box__menu-item__selected-icon`}))}))),!T&&!t&&!r.validation&&pe)});ie.displayName="Dropdown";ie.propTypes={"aria-label":i.string,ariaLabel:ue(i.string),autoAlign:i.bool,className:i.string,decorator:i.node,direction:i.oneOf(["top","bottom"]),disabled:i.bool,downshiftProps:i.object,helperText:i.node,hideLabel:i.bool,id:i.string.isRequired,initialSelectedItem:i.oneOfType([i.object,i.string,i.number]),invalid:i.bool,invalidText:i.node,itemToElement:i.func,itemToString:i.func,items:i.array.isRequired,label:i.node.isRequired,light:ue(i.bool),onChange:i.func,readOnly:i.bool,renderSelectedItem:i.func,selectedItem:i.oneOfType([i.object,i.string,i.number]),size:pt,slug:ue(i.node),titleText:i.node.isRequired,translateWithId:i.func,type:mt,warn:i.bool,warnText:i.node};const vt=({benchmarkId:o,style:E,onSelectPipeline:h,onOpenToolkitInsights:S,onOpenPipelineCompare:z,onOpenProfileCompare:R,onOpenErrorAnalysis:A})=>{const[I,Q]=l.useState(null),[b,L]=l.useState(!0),[N,X]=l.useState(null),[D,y]=l.useState(1),[F,B]=l.useState(10),[m,O]=l.useState(null),[M,K]=l.useState("overall");if(l.useEffect(()=>{(async()=>{try{L(!0),X(null),Q(null);const n=await(await ct(ut(`/api/benchmarks/${o}/summary/by-category`))).json();Q(n),O(n.default_sort_metric),K("overall"),y(1)}catch(t){X(t.message||"Failed to load benchmark summary")}finally{L(!1)}})()},[o]),N)return s.jsx(ve,{kind:"error",title:`Error loading summary for ${o}`,subtitle:N,lowContrast:!0});if(b)return s.jsxs("div",{style:{...E,display:"flex",flexDirection:"column",gap:"1rem"},children:[s.jsxs("h3",{style:{margin:0},children:[o," – Summary"]}),s.jsx(et,{description:`Loading benchmark summary for ${o}…`,status:"active"}),s.jsx(tt,{role:"progressbar",columnCount:5,rowCount:8})]});if(!I)return null;const G=M==="overall"?I.overall:I.categories[M]||[],$=new Set;G.forEach(e=>{Object.keys(e.metrics).forEach(t=>{t!=="num_records"&&t!=="num_evaluated"&&$.add(t)})});const ne=[{key:"name",header:"Pipeline"},...Array.from($).map(e=>({key:e,header:e}))],P=[...G].sort((e,t)=>{var d,f,k,g;if(!m)return 0;const n=((f=(d=e.metrics)==null?void 0:d[m])==null?void 0:f.average)??0;return(((g=(k=t.metrics)==null?void 0:k[m])==null?void 0:g.average)??0)-n}),W=e=>{var n;if(!m)return 0;const t=(n=e.metrics)==null?void 0:n[m];return typeof t=="number"?t:t&&typeof t=="object"&&typeof t.average=="number"?t.average:0},H=e=>{var n;if(!m)return 0;const t=(n=e.metrics)==null?void 0:n[m];return t&&typeof t=="object"&&typeof t.stddev=="number"?Math.max(0,t.stddev):0},J=e=>{var d;if(!m)return{low:0,high:0,hasCI:!1};const t=(d=e.metrics)==null?void 0:d[m];if(t&&typeof t=="object"&&typeof t.ci95_low=="number"&&typeof t.ci95_high=="number")return{low:t.ci95_low,high:t.ci95_high,hasCI:!0};const n=W(e),u=H(e);return{low:Math.max(0,n-u),high:n+u,hasCI:!1}},w=P.map(e=>({name:e.name,value:W(e),stddev:H(e),ci:J(e)})),v=w.reduce((e,t)=>Math.max(e,t.value,t.ci.high),0)||1,re=P.length,Y=(D-1)*F,C=Y+F,j=P.slice(Y,C),q=Array.from($),le=["overall",...Object.keys(I.categories)];return s.jsxs("div",{style:{...E,display:"flex",flexDirection:"column",gap:"0.5rem"},children:[I.has_full_results===!1&&s.jsx(ve,{kind:"info",title:"Summary-only mode",subtitle:`The full evaluation results file (${o}-predictions_eval.json) was not found. Overall pipeline metrics are shown from the summary file, but category breakdown and error analysis are unavailable. Download pre-computed results with: text2sql-eval-toolkit results fetch --benchmarks ${o} or run the evaluation pipeline locally (or fix TEXT2SQL_DATA_ROOT to a directory that already contains this file).`,lowContrast:!0}),s.jsxs("div",{style:{display:"flex",gap:"1rem",alignItems:"center"},children:[s.jsxs("h3",{style:{margin:0},children:[o," – Summary"]}),s.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:"0.75rem",alignItems:"center"},children:[S&&s.jsx(se,{kind:"ghost",size:"sm",onClick:()=>S(),children:"Metric Insights"}),z&&s.jsx(se,{kind:"ghost",size:"sm",onClick:()=>z(),children:"Pipeline Compare"}),R&&s.jsx(se,{kind:"ghost",size:"sm",onClick:()=>R(),children:"Profile Compare"}),A&&s.jsx(se,{kind:"ghost",size:"sm",onClick:()=>A(),children:"Error Analysis"}),s.jsx("div",{style:{minWidth:"220px"},children:s.jsx(ie,{id:"category-dropdown",titleText:"Query Category",label:M,items:le,selectedItem:M,onChange:e=>{K(e.selectedItem),y(1)}})}),q.length>0&&s.jsx("div",{style:{minWidth:"260px"},children:s.jsx(ie,{id:"sort-metric-dropdown",titleText:"Sort by metric",label:m||"Select metric",items:q,selectedItem:m,onChange:e=>{O(e.selectedItem),y(1)}})})]})]}),s.jsxs("div",{style:{border:"1px solid rgba(255,255,255,0.12)",borderRadius:"6px",padding:"0.75rem",background:"rgba(255,255,255,0.02)"},children:[s.jsxs("div",{style:{marginBottom:"0.5rem",fontWeight:600},children:["Pipeline performance by ",m||"selected metric"]}),s.jsx("div",{style:{maxHeight:"260px",overflow:"auto",display:"flex",flexDirection:"column",gap:"0.45rem"},children:w.map(e=>{const t=Math.max(2,e.value/v*100),n=Math.max(0,e.ci.low),u=Math.min(v,e.ci.high),d=n/v*100,f=u/v*100,k=Math.max(0,f-d),g=f>=99.9;return s.jsxs("div",{title:e.ci.hasCI?`${e.name}
2
2
  Mean: ${e.value.toFixed(3)}
3
3
  95% CI: [${e.ci.low.toFixed(3)}, ${e.ci.high.toFixed(3)}]`:`${e.name}
4
4
  Mean: ${e.value.toFixed(3)}`,style:{display:"grid",gridTemplateColumns:"260px 1fr 56px",gap:"0.6rem",alignItems:"center"},children:[s.jsx("div",{title:e.name,style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:"0.82rem",opacity:.9},children:e.name}),s.jsxs("div",{style:{height:"12px",background:"rgba(255,255,255,0.1)",borderRadius:"999px",overflow:"hidden",position:"relative"},children:[s.jsx("div",{style:{width:`${t}%`,height:"100%",background:"linear-gradient(90deg, #0f62fe, #78a9ff)",borderRadius:"999px"}}),u>n&&s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{position:"absolute",left:`${d}%`,width:`${k}%`,top:"5.5px",height:"1px",background:"rgba(255,255,255,0.7)"}}),s.jsx("div",{style:{position:"absolute",left:`${d}%`,top:"3px",width:"1px",height:"6px",background:"rgba(255,255,255,0.7)"}}),s.jsx("div",{style:{position:"absolute",...g?{right:0}:{left:`${f}%`},top:"3px",width:"1px",height:"6px",background:"rgba(255,255,255,0.7)"}})]})]}),s.jsx("div",{style:{textAlign:"right",fontSize:"0.82rem"},children:e.value.toFixed(3)})]},`chart-${e.name}`)})})]}),s.jsxs("div",{style:{maxHeight:"360px",overflow:"auto"},children:[s.jsx("div",{style:{fontSize:"0.82rem",opacity:.85,marginBottom:"0.45rem"},children:"Tip: click a pipeline row in the table below for detailed pipeline analysis."}),s.jsx(st,{rows:j.map(e=>({id:e.name,name:e.name,...Object.fromEntries(Array.from($).map(t=>{const n=e.metrics[t];return n&&typeof n=="object"&&"average"in n?[t,n.average.toFixed(3)]:[t,n??""]}))})),headers:ne,size:"sm",children:({rows:e,headers:t,getHeaderProps:n})=>s.jsx(at,{children:s.jsxs(it,{"aria-label":"Pipeline summary",children:[s.jsx(nt,{children:s.jsx(je,{children:t.map(u=>{const{key:d,...f}=n({header:u});return s.jsx(rt,{...f,children:u.header},d)})})}),s.jsx(lt,{children:e.map(u=>s.jsx(je,{style:{cursor:h?"pointer":"default"},onClick:()=>h==null?void 0:h(u.id),children:u.cells.map(d=>s.jsx(ot,{children:d.value},d.id))},u.id))})]})})})]}),s.jsx(dt,{page:D,pageSize:F,pageSizes:[10,25,50],totalItems:re,onChange:({page:e,pageSize:t})=>{y(e),B(t)}})]})};export{vt as BenchmarkDetail};
@@ -0,0 +1 @@
1
+ import{b as Ce,d as M,R as r,ag as qe,_ as z,P as n,a6 as Vt,r as o,u as kt,a as Lt,F as Mt,Q as Ft,ah as j,c as Pt,i as At,X as Ue,ai as X,m as Wt,W as Ot,e as Bt,C as jt,f as zt,g as Ht,h as Kt,A as qt,a9 as Ut,a8 as Qt,aj as Xt,ak as Gt,al as Jt,j as xe}from"./index-DLyduwv0.js";import{d as tt,c as nt,L as we,b as Yt}from"./defaultItemToString-ClUBp4QC.js";var Qe,Xe;const Ge={"clear.all":"clear.all","clear.selection":"clear.selection"},Zt={[Ge["clear.all"]]:"Clear all selected items",[Ge["clear.selection"]]:"Clear selected item"},vt=d=>Zt[d];function lt({clearSelection:d,selectionCount:c,translateWithId:h=vt,disabled:f,readOnly:g,onClearSelection:_,...F}){const I=Ce(),H=M(`${I}--list-box__selection`,{[`${I}--tag--filter`]:c,[`${I}--list-box__selection--multi`]:c}),P=h(c?"clear.all":"clear.selection"),$=M(`${I}--tag`,`${I}--tag--filter`,`${I}--tag--high-contrast`,{[`${I}--tag--disabled`]:f});function K(C){C.stopPropagation(),!(f||g)&&(d(C),_&&_(C))}return c?r.createElement("div",{className:$},r.createElement("span",{className:`${I}--tag__label`,title:c==null?void 0:c.toString()},c),r.createElement("button",{"aria-label":P,className:`${I}--tag__close-icon`,disabled:f||g,onClick:K,tabIndex:-1,title:P,type:"button","aria-disabled":g?!0:void 0},Qe||(Qe=r.createElement(qe,null)))):r.createElement("button",z({},F,{"aria-label":P,className:H,disabled:f||g,onClick:K,tabIndex:-1,title:P,type:"button","aria-disabled":g?!0:void 0}),Xe||(Xe=r.createElement(qe,null)))}lt.propTypes={clearSelection:n.func.isRequired,disabled:n.bool,readOnly:n.bool,onClearSelection:n.func,onClick:n.func,onMouseUp:n.func,onKeyDown:n.func,selectionCount:n.number,translateWithId:n.func};var Je;const Ye={"close.menu":"close.menu","open.menu":"open.menu"},en={[Ye["close.menu"]]:"Close",[Ye["open.menu"]]:"Open"},tn=d=>en[d],at=r.forwardRef(({isOpen:d,translateWithId:c=tn,...h},f)=>{const g=Ce(),_=M({[`${g}--list-box__menu-icon`]:!0,[`${g}--list-box__menu-icon--open`]:d}),F=c(d?"close.menu":"open.menu");return r.createElement("button",z({},h,{"aria-label":F,title:F,className:_,type:"button",tabIndex:-1,ref:f}),Je||(Je=r.createElement(Vt,null)))});at.propTypes={isOpen:n.bool.isRequired,translateWithId:n.func};const{InputBlur:nn,InputKeyDownEnter:Ze,FunctionToggleMenu:ln,ToggleButtonClick:an,ItemMouseMove:sn,InputKeyDownArrowUp:rn,InputKeyDownArrowDown:on,MenuMouseLeave:cn,ItemClick:un,FunctionSelectItem:dn}=nt.stateChangeTypes,ve=()=>!0,ye=({item:d,inputValue:c})=>{if(c===null||c==="")return!0;const h=d.toLowerCase(),f=c.toLowerCase();return h.startsWith(f)},et=({initialSelectedItem:d,itemToString:c,selectedItem:h,prevSelectedItem:f})=>h!==null&&typeof h<"u"?c(h):typeof f>"u"&&d!==null&&typeof d<"u"?c(d):"",fn=({items:d,itemToString:c=tt},h)=>{if(!h)return-1;const f=h.toLowerCase();for(let g=0;g<d.length;g++){const _=c(d[g]).toLowerCase();if(!d[g].disabled&&_.indexOf(f)!==-1)return g}return-1},st=o.forwardRef((d,c)=>{var He,Ke;const h=o.useRef(0),f=o.useRef(null),{["aria-label"]:g="Choose an item",ariaLabel:_,autoAlign:F=!1,className:I,decorator:H,direction:P="bottom",disabled:$=!1,downshiftActions:K,downshiftProps:C,helperText:ee,id:Ee,initialSelectedItem:te,invalid:ne,invalidText:le,items:b,itemToElement:ae=null,itemToString:s=tt,light:it,onChange:R,onInputChange:se,onToggleClick:Te,placeholder:rt,readOnly:A,selectedItem:E,shouldFilterItem:_e=ve,size:ot,titleText:ie,translateWithId:$e,typeahead:G=!1,warn:ct,warnText:re,allowCustomValue:N=!1,slug:oe,inputProps:ut,...dt}=d,W=kt("enable-v12-dynamic-floating-styles")||F,{refs:x,floatingStyles:Se,middlewareData:ft}=Lt(W?{placement:P,strategy:"fixed",middleware:F?[Ht(),Kt()]:void 0,whileElementsMounted:zt}:{}),De=(He=x==null?void 0:x.reference)==null?void 0:He.current,ce=De instanceof HTMLElement?De.clientWidth:void 0;o.useEffect(()=>{var e;if(W){const t={...Se,visibility:(e=ft.hide)!=null&&e.referenceHidden?"hidden":"visible"};Object.keys(t).forEach(u=>{x.floating.current&&(x.floating.current.style[u]=t[u])}),ce&&x.floating.current&&(x.floating.current.style.width=ce+"px")}},[W,Se,x.floating,ce]);const[a,J]=o.useState(et({initialSelectedItem:te,itemToString:s,selectedItem:E})),[Y,Z]=o.useState("");o.useEffect(()=>{if(G){if(a.length>=h.current)if(a){const e=b.filter(t=>ye({item:s(t),inputValue:a}));if(e.length>0){const t=s(e[0]);Z(t.slice(a.length))}else Z("")}else Z("");else Z("");h.current=a.length}},[G,a,b,s,ye]);const Re=o.useRef(!1),O=o.useRef(""),[ue,de]=o.useState(!1),i=Ce(),{isFluid:fe}=o.useContext(Mt),w=o.useRef(null),me=Ft(),[Ne,mt]=o.useState(!1),Ve=o.useRef(a),pe=o.useRef(E);o.useEffect(()=>{Re.current=ue,ue&&de(!1)},[ue]),o.useEffect(()=>{if(pe.current!==E){const e=et({initialSelectedItem:te,itemToString:s,selectedItem:E,prevSelectedItem:pe.current});a!==e&&(J(e),R({selectedItem:E,inputValue:e})),pe.current=E}},[E]);const q=(e,t,u)=>e.filter(l=>G?ye({item:t(l),inputValue:u}):_e?_e({item:l,itemToString:t,inputValue:u}):ve());o.useEffect(()=>{Ve.current!==a&&(Ve.current=a,se==null||se(a))},[a]);const ke=()=>{w!=null&&w.current&&w.current.focus()},pt=e=>q(b,s,e||null),Le=e=>fn({...d,items:pt(e)},e),gt=o.useCallback((e,t)=>{const{type:u,changes:l}=t,{highlightedIndex:y}=l;switch(u){case nn:{if(N&&y===-1){const m=e.inputValue??"",p=typeof l.selectedItem>"u"?e.selectedItem:l.selectedItem;if(p!==null&&typeof p<"u"&&s(p)===m&&b.some(L=>j(L,p)))return l;const k=m===""?null:b.find(L=>s(L)===m)??m,Q=typeof k=="string"&&k!==""&&!b.some(L=>j(L,k));return!j(p,k)&&R&&(R({selectedItem:k,inputValue:m}),O.current=Q?m:""),{...l,selectedItem:k}}if(e.inputValue&&y===-1&&l.selectedItem)return{...l,inputValue:s(l.selectedItem)};if(!N){const m=e.inputValue??"";if(!(!!m&&b.some(D=>s(D)===m))){const D=e.selectedItem!==null?s(e.selectedItem):"";return{...l,inputValue:D}}}return l}case Ze:if(!N)if(e.highlightedIndex!==-1){const p=q(b,s,a)[e.highlightedIndex];if(p&&!p.disabled)return{...l,selectedItem:p,inputValue:s(p)}}else{const m=Le(a);if(m!==-1){const p=b[m];if(p&&!p.disabled)return{...l,selectedItem:p,inputValue:s(p)}}if(e.selectedItem!==null)return{...l,selectedItem:null,inputValue:a}}return{...l,isOpen:!0};case ln:case an:if(e.isOpen&&!l.isOpen&&!N){const m=e.inputValue??"";if(!(!!m&&b.some(D=>s(D)===m))){const D=e.selectedItem!==null?s(e.selectedItem):"";return{...l,inputValue:D}}}return l;case cn:return{...l,highlightedIndex:e.highlightedIndex};case rn:case on:return y===-1?{...l,highlightedIndex:0}:l;case sn:return{...l,highlightedIndex:e.highlightedIndex};default:return l}},[N,a,s,b,R]),ht=e=>t=>{var u,l;if(Te&&Te(t),A){t.preventDownshiftDefault=!0,(u=t==null?void 0:t.persist)==null||u.call(t);return}t.target===w.current&&e&&(t.preventDownshiftDefault=!0,(l=t==null?void 0:t.persist)==null||l.call(t))},S=Pt({id:Ee,readOnly:A,disabled:$||!1,invalid:ne||!1,invalidText:le,warn:ct||!1,warnText:re}),bt=M(`${i}--combo-box`,{[`${i}--combo-box--invalid--focused`]:ne&&Ne,[`${i}--list-box--up`]:P==="top",[`${i}--combo-box--warning`]:S.warn,[`${i}--combo-box--readonly`]:A,[`${i}--autoalign`]:W}),It=M(`${i}--label`,{[`${i}--label--disabled`]:$}),Me=`combobox-helper-text-${me}`,Fe=`combobox-warn-text-${me}`,Pe=`combobox-invalid-text-${me}`,xt=M(`${i}--form__helper-text`,{[`${i}--form__helper-text--disabled`]:$}),wt=M(`${i}--list-box__wrapper`,[I,{[`${i}--list-box__wrapper--fluid--invalid`]:fe&&ne,[`${i}--list-box__wrapper--slug`]:oe,[`${i}--list-box__wrapper--decorator`]:H}]),yt=M(`${i}--text-input`,{[`${i}--text-input--empty`]:!a,[`${i}--combo-box--input--focus`]:Ne}),ge=oe??H,Ae=At(ge,qt),he=Ae?o.cloneElement(ge,{size:"mini"}):ge,{getInputProps:Ct,getItemProps:Et,getLabelProps:Tt,getMenuProps:We,getToggleButtonProps:_t,isOpen:T,highlightedIndex:U,selectedItem:$t,closeMenu:Oe,openMenu:be,reset:Be,selectItem:V,setHighlightedIndex:Ie,setInputValue:v,toggleMenu:B}=nt({items:q(b,s,a),inputValue:a,itemToString:e=>s(e),onInputValueChange({inputValue:e}){const t=e||"";J(t),Ie(Le(t))},onHighlightedIndexChange:({highlightedIndex:e})=>{if(e>-1){const u=document.querySelectorAll(`li.${i}--list-box__menu-item[role="option"]`)[e];u&&u.scrollIntoView({behavior:"smooth",block:"nearest"})}},initialSelectedItem:te,inputId:Ee,stateReducer:gt,isItemDisabled(e,t){return e==null?void 0:e.disabled},...C,onStateChange:({type:e,selectedItem:t})=>{var u;(u=C==null?void 0:C.onStateChange)==null||u.call(C,{type:e,selectedItem:t}),!Re.current&&(e===un||e===dn||e===Ze)&&typeof t<"u"&&!j(E,t)&&(b.some(l=>j(l,t))&&(O.current=""),R({selectedItem:t}))}}),St=typeof E<"u"?E:$t;o.useEffect(()=>{K&&(K.current={closeMenu:Oe,openMenu:be,reset:Be,selectItem:V,setHighlightedIndex:Ie,setInputValue:v,toggleMenu:B})},[Oe,be,Be,V,Ie,v,B]);const Dt=_t({disabled:$||A,onClick:ht(T),onMouseUp(e){T&&e.stopPropagation()}}),je=e=>{var t;mt(e.type==="focus"),!((t=f.current)!=null&&t.value)&&e.type==="blur"&&V(null)},Rt=A?{onKeyDown:e=>{e.key!=="Tab"&&e.preventDefault()},onClick:e=>{e.preventDefault(),e.currentTarget.focus()}}:{},Nt=S.invalid&&le&&Pe||S.warn&&re&&Fe||ee&&!fe&&Me||void 0,ze=o.useMemo(()=>We({ref:W?x.setFloating:null}),[W,_,g,We,x.setFloating]);return o.useEffect(()=>{if(w.current&&f.current&&Y){const e=a.length,t=e+Y.length;f.current.value=a+Y,f.current.setSelectionRange(e,t)}},[a,Y]),r.createElement("div",{className:wt},ie&&r.createElement(Ue,z({as:"label",className:It},Tt()),ie),r.createElement(we,{onFocus:je,onBlur:je,className:bt,disabled:$,invalid:S.invalid,invalidText:le,invalidTextId:Pe,isOpen:T,light:it,size:ot,warn:S.warn,ref:W?x.setReference:null,warnText:re,warnTextId:Fe},r.createElement("div",{className:`${i}--list-box__field`},r.createElement("input",z({disabled:$,className:yt,type:"text",tabIndex:0,"aria-haspopup":"listbox",title:(Ke=w==null?void 0:w.current)==null?void 0:Ke.value},Ct({"aria-label":ie?void 0:_||g,"aria-controls":ze.id,placeholder:rt,value:a,...ut,onChange:e=>{const t=e.target.value,u=N&&O.current&&a===O.current&&t==="";J(t),v(t),u&&(de(!0),R({selectedItem:null,inputValue:""}),V(null),O.current="")},ref:Wt(w,c,f),onKeyDown:e=>{var t,u;if(X(e,Ut)&&e.stopPropagation(),X(e,Qt)&&(!a||N)&&(B(),U!==-1&&V(q(b,s,a)[U]),N&&T&&a&&U===-1&&(O.current=a,R({selectedItem:null,inputValue:a})),e.preventDownshiftDefault=!0,(t=e==null?void 0:e.persist)==null||t.call(e)),X(e,Xt)&&a&&e.target===w.current&&T&&(B(),e.preventDownshiftDefault=!0,(u=e==null?void 0:e.persist)==null||u.call(e)),X(e,Gt)&&e.code!=="Numpad7"&&e.target.setSelectionRange(0,0),X(e,Jt)&&e.code!=="Numpad1"&&e.target.setSelectionRange(e.target.value.length,e.target.value.length),e.altKey&&e.key=="ArrowDown"&&(e.preventDownshiftDefault=!0,T||B()),e.altKey&&e.key=="ArrowUp"&&(e.preventDownshiftDefault=!0,T&&B()),!a&&U==-1&&e.key=="Enter"&&(T||B(),V(null),e.preventDownshiftDefault=!0,e.currentTarget.ariaExpanded==="false"&&be()),G&&e.key==="Tab"){const l=b.find(y=>s(y).toLowerCase().startsWith(a.toLowerCase()));if(l){const y=s(l);v(y),V(l)}}}}),dt,Rt,{readOnly:A,"aria-describedby":Nt})),S.invalid&&r.createElement(Ot,{className:`${i}--list-box__invalid-icon`}),S.warn&&r.createElement(Bt,{className:`${i}--list-box__invalid-icon ${i}--list-box__invalid-icon--warning`}),a&&r.createElement(lt,{clearSelection:()=>{de(!0),J(""),R({selectedItem:null}),V(null),O.current="",ke()},translateWithId:$e,disabled:$||A,onClearSelection:ke,selectionCount:0}),r.createElement(at,z({},Dt,{isOpen:T,translateWithId:$e}))),oe?he:H?r.createElement("div",{className:`${i}--list-box__inner-wrapper--decorator`},Ae?he:r.createElement("span",null,he)):"",r.createElement(we.Menu,ze,T?q(b,s,a).map((e,t)=>{var L;const l=e!==null&&typeof e=="object"&&"text"in e&&ae?(L=e.text)==null?void 0:L.toString():s(e),y=Et({item:e,index:t}),m=y["aria-disabled"],{"aria-disabled":p,"aria-selected":D,...k}=y,Q=j(St,e);return r.createElement(we.MenuItem,z({key:y.id,isActive:Q,isHighlighted:U===t,title:l,disabled:m},k,{"aria-selected":Q}),ae?ae(e):s(e),Q&&r.createElement(jt,{className:`${i}--list-box__menu-item__selected-icon`}))}):null)),ee&&!S.invalid&&!S.warn&&!fe&&r.createElement(Ue,{as:"div",id:Me,className:xt},ee))});st.displayName="ComboBox";st.propTypes={allowCustomValue:n.bool,"aria-label":n.string,ariaLabel:xe(n.string),autoAlign:n.bool,className:n.string,decorator:n.node,direction:n.oneOf(["top","bottom"]),disabled:n.bool,downshiftProps:n.object,downshiftActions:n.exact({current:n.any}),helperText:n.node,id:n.string.isRequired,initialSelectedItem:n.oneOfType([n.object,n.string,n.number]),invalid:n.bool,invalidText:n.node,itemToElement:n.func,itemToString:n.func,items:n.array.isRequired,light:xe(n.bool),onChange:n.func.isRequired,onInputChange:n.func,onToggleClick:n.func,placeholder:n.string,readOnly:n.bool,selectedItem:n.oneOfType([n.object,n.string,n.number]),shouldFilterItem:n.func,size:Yt,slug:xe(n.node),titleText:n.node,translateWithId:n.func,typeahead:n.bool,warn:n.bool,warnText:n.node,inputProps:n.object};export{st as C};
@@ -1 +1 @@
1
- import{r,k as t,B as x,I as h,E as Ae,S as ne,G as y,l as ut,D as pt,n as ft,T as mt,o as xt,p as gt,q as Ge,t as ht,v as yt,w as jt,x as bt,H as St,y as le,z as R}from"./index-C9VP9iwL.js";import{C as Ve}from"./ComboBox-Cz5Wuuu_.js";import{b as Be,f as wt,S as He}from"./metricInsightsSelect-B46SO2Wy.js";import{R as be,h as We}from"./ResultTableView-Dq7hZwq5.js";import"./defaultItemToString-BtCahKYf.js";function _t(a,M,n){const $=M.find(ae=>ae.record_id===a),U=Object.keys(($==null?void 0:$.predictions)??{});return n&&U.includes(n)?n:U[0]??null}function Ue(a){if(a==null)return"N/A";if(typeof a=="number")return Number.isFinite(a)?String(a):"N/A";if(typeof a=="boolean")return a?"true":"false";if(typeof a=="string")return a;try{return JSON.stringify(a)}catch{return String(a)}}function Xe(a,M){const n=a.trim();return n?n.replaceAll("_"," "):M}const Rt=({benchmarkId:a,onBack:M,initialFilters:n,initialPage:$,initialPageSize:U,initialRecordId:ae,onStateChange:w})=>{const[L,Se]=r.useState([]),[Ye,Ke]=r.useState(0),_=$??1,k=U??25,[we,Ze]=r.useState(""),[u,D]=r.useState(()=>(n==null?void 0:n.pipeline)??""),[j,X]=r.useState(()=>(n==null?void 0:n.metric)??"execution_accuracy"),[P,ie]=r.useState(()=>(n==null?void 0:n.value)??"0"),[q,oe]=r.useState(()=>(n==null?void 0:n.op)??"eq"),[m,I]=r.useState(()=>(n==null?void 0:n.pipeline2)??""),[b,Y]=r.useState(()=>(n==null?void 0:n.metric2)??"subset_non_empty_execution_accuracy"),[C,ce]=r.useState(()=>(n==null?void 0:n.disagree)??!1),[_e,ke]=r.useState(!0),[Ce,Te]=r.useState(null),o=ae??null,[T,de]=r.useState(null),ue=r.useCallback((e,s)=>_t(e,s,u),[u]);r.useEffect(()=>{if(!o||T||L.length===0)return;const e=ue(o,L);e&&de(e)},[o,T,L,ue]);const ve=r.useMemo(()=>({pipeline:u,metric:j,value:P,op:q,pipeline2:m,metric2:b,disagree:C}),[u,j,P,q,m,b,C]),J=r.useCallback(e=>{w==null||w({filters:ve,page:e.page??_,pageSize:e.pageSize??k,record:e.record!==void 0?e.record:o})},[ve,w,_,k,o]),pe=r.useCallback(e=>J({page:e}),[J]),Ee=r.useCallback(e=>J({record:e}),[J]);r.useEffect(()=>{w==null||w({filters:{pipeline:u,metric:j,value:P,op:q,pipeline2:m,metric2:b,disagree:C},page:_,pageSize:k,record:o})},[w,u,j,P,q,m,b,C,_,k,o]);const[c,Re]=r.useState(null),[Fe,fe]=r.useState(!1),[Me,me]=r.useState(null),[O,Q]=r.useState("detail"),[xe,ge]=r.useState(null),[et,K]=r.useState(!1),[Le,Z]=r.useState(null),[tt,he]=r.useState(""),[v,F]=r.useState(""),[Pe,A]=r.useState(!1),[qe,G]=r.useState(null),[E,V]=r.useState(null),[st,B]=r.useState(!1),[ze,z]=r.useState(null),[Ne,N]=r.useState(null),[$e,rt]=r.useState([]),[S,De]=r.useState(null),[Ie,Je]=r.useState(null),ee=r.useMemo(()=>Be((S==null?void 0:S.metrics)??[]),[S]);r.useEffect(()=>{let e=!1;return(async()=>{try{Je(null);const d=await(await le(R("/api/evaluation-metric-definitions"))).json();e||De(d)}catch(l){e||(De(null),Je((l==null?void 0:l.message)||"Failed to load metric definitions"))}})(),()=>{e=!0}},[]),r.useEffect(()=>{var d;if(!((d=S==null?void 0:S.metrics)!=null&&d.length))return;const e=Be(S.metrics),s=wt(e);if(s.length===0)return;const l=new Set(s);X(i=>l.has(i)?i:s[0]),Y(i=>l.has(i)?i:s[1]??s[0])},[S]);const H=async e=>{const s=(e==null?void 0:e.page)??_,l=(e==null?void 0:e.pageSize)??k,d=(e==null?void 0:e.search)??we,i=(e==null?void 0:e.pipeline)??u,f=(e==null?void 0:e.metric)??j,g=(e==null?void 0:e.value)??P,te=(e==null?void 0:e.op)??q,se=(e==null?void 0:e.pipeline2)??m,ye=(e==null?void 0:e.metric2)??b,re=(e==null?void 0:e.disagree)??C;try{ke(!0),Te(null),Se([]);const p=new URLSearchParams;p.set("page",String(s)),p.set("page_size",String(l)),d&&p.set("q",d),i&&(p.set("pipeline",i),f&&p.set("metric",f),g&&p.set("value",g),te&&p.set("op",te)),i&&se&&re&&(p.set("pipeline2",se),ye&&p.set("metric2",ye),p.set("disagree","true"));const W=await(await le(R(`/api/benchmarks/${a}/errors?${p.toString()}`))).json();Se(W.items),Ke(W.total)}catch(p){Te(p.message||"Failed to load error records")}finally{ke(!1)}},[nt]=r.useState(()=>(n==null?void 0:n.pipeline)??"");r.useEffect(()=>{(async()=>{var s;try{const l=await fetch(R(`/api/benchmarks/${a}/summary/by-category`));if(!l.ok)return;const i=[...(await l.json()).overall??[]].sort((g,te)=>{var re,p,je,W;const se=Number(((p=(re=g.metrics)==null?void 0:re.subset_non_empty_execution_accuracy)==null?void 0:p.average)??-1);return Number(((W=(je=te.metrics)==null?void 0:je.subset_non_empty_execution_accuracy)==null?void 0:W.average)??-1)-se});rt(i.map(g=>g.name));const f=((s=i[0])==null?void 0:s.name)??"";if(!f)return;D(g=>g||f),I(g=>g||f),nt||H({pipeline:f})}catch{}})()},[a]);const lt=()=>{pe(1),H({page:1})};r.useEffect(()=>{H()},[a,_,k]);const at=[{key:"record_id",header:"Record ID"},{key:"question",header:"Question"},{key:"metric1_pipeline",header:"Pipeline 1"},{key:"metric1_score",header:Xe(j,"Metric 1")},{key:"metric2_pipeline",header:"Pipeline 2"},{key:"metric2_score",header:Xe(b,"Metric 2")}],it=r.useMemo(()=>L.map(e=>{var d,i;const s=u?(d=e.predictions)==null?void 0:d[u]:void 0,l=m?(i=e.predictions)==null?void 0:i[m]:void 0;return{id:e.record_id,record_id:e.record_id,question:e.question,metric1_pipeline:u||"—",metric1_score:u?Ue(s==null?void 0:s[j]):"—",metric2_pipeline:m||"—",metric2_score:m?Ue(l==null?void 0:l[b]):"—"}}),[L,j,b,u,m]);r.useEffect(()=>{if(!o||!T)return;(async()=>{try{fe(!0),me(null);const s=new URLSearchParams;s.set("pipeline",T);const l=await le(R(`/api/benchmarks/${a}/errors/${o}/detail?${s.toString()}`));Re(await l.json())}catch(s){me(s.message||"Failed to load record details")}finally{fe(!1)}})()},[a,o,T]);const Oe=()=>{Ee(null),de(null),Re(null),me(null),fe(!1),Q("detail"),ge(null),Z(null),K(!1),he(""),F(""),A(!1),G(null),V(null),B(!1),z(null),N(null)};r.useEffect(()=>{Q("detail"),ge(null),Z(null),K(!1),he(""),F(""),A(!1),G(null),V(null),B(!1),z(null),N(null)},[o]);const ot=async()=>{if(o&&(Q("raw"),!xe))try{K(!0),Z(null);const e=await le(R(`/api/benchmarks/${a}/errors/${o}`));ge(await e.json())}catch(e){Z(e.message||"Failed to load raw JSON")}finally{K(!1)}},Qe=(e,s)=>{he(s),F(e),A(!1),G(null),V(null),B(!1),z(null),N(null),Q("modify")},ct=async()=>{if(!(!o||!v.trim()))try{A(!0),G(null);const e=await fetch(R(`/api/benchmarks/${a}/execute`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:v,record_id:o,db_id:c==null?void 0:c.db_id})}),s=await e.json();if(!e.ok)throw new Error((s==null?void 0:s.detail)||`HTTP ${e.status}`);V(s),z(null),N(null)}catch(e){G(e.message||"Failed to execute SQL"),V(null)}finally{A(!1)}},dt=async()=>{if(!(!o||!v.trim()||!window.confirm("Are you confident this query should be added to benchmark ground truth SQLs?")))try{B(!0),z(null),N(null);const s=await fetch(R(`/api/benchmarks/${a}/ground-truth-sql`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({record_id:o,sql:v})}),l=await s.json();if(!s.ok)throw new Error((l==null?void 0:l.detail)||`HTTP ${s.status}`);N(l.message)}catch(s){z(s.message||"Failed to add query to benchmark ground truth")}finally{B(!1)}};return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsxs("h3",{style:{margin:0},children:["Error analysis – ",a]}),M&&t.jsx(x,{kind:"ghost",size:"sm",onClick:M,children:"Back"})]}),Ie&&t.jsx(h,{kind:"warning",title:"Metric list unavailable",subtitle:Ie,lowContrast:!0}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"0.5rem",alignItems:"end"},children:[t.jsx(Ae,{id:"error-search",labelText:"Search",placeholder:"Question text or record id",value:we,onChange:e=>Ze(e.target.value)}),t.jsx(Ve,{id:"pipeline-1",titleText:"Pipeline 1 (optional)",placeholder:"e.g. wxai:openai/gpt-oss-120b-greedy-zero-shot-chatapi",items:$e,itemToString:e=>e??"",selectedItem:u||null,onChange:({selectedItem:e})=>D(e??""),onInputChange:e=>D(e),allowCustomValue:!0}),t.jsx(ne,{id:"metric-select",labelText:"Metric",value:j,onChange:e=>X(e.target.value),disabled:ee.length===0,children:ee.map(e=>t.jsx(He,{label:e.label,children:e.metrics.map(s=>t.jsx(y,{value:s.name,text:s.name,title:s.description},s.name))},e.label))}),t.jsx(ne,{id:"metric2-select",labelText:"Metric 2 (for disagreement)",value:b,onChange:e=>Y(e.target.value),disabled:!C||ee.length===0,children:ee.map(e=>t.jsx(He,{label:e.label,children:e.metrics.map(s=>t.jsx(y,{value:s.name,text:s.name,title:s.description},`${s.name}-m2`))},`${e.label}-m2`))}),t.jsxs(ne,{id:"op-select",labelText:"Operator",value:q,onChange:e=>oe(e.target.value),children:[t.jsx(y,{value:"eq",text:"="}),t.jsx(y,{value:"ne",text:"≠"}),t.jsx(y,{value:"lt",text:"<"}),t.jsx(y,{value:"gt",text:">"}),t.jsx(y,{value:"le",text:"≤"}),t.jsx(y,{value:"ge",text:"≥"})]})]}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"flex-end",gap:"0.5rem",width:"100%"},children:[t.jsxs("div",{style:{flex:"1 1 400px",display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"0.5rem",alignItems:"end",minWidth:0},children:[t.jsx(Ae,{id:"metric-value",labelText:"Metric value",value:P,onChange:e=>ie(e.target.value)}),t.jsx(Ve,{id:"pipeline-2",titleText:"Pipeline 2 (for disagreement)",placeholder:"Second pipeline id",items:$e,itemToString:e=>e??"",selectedItem:m||null,onChange:({selectedItem:e})=>I(e??""),onInputChange:e=>I(e),allowCustomValue:!0}),t.jsxs(ne,{id:"disagree-select",labelText:"P1 vs P2 disagree?",value:C?"true":"false",onChange:e=>ce(e.target.value==="true"),children:[t.jsx(y,{value:"false",text:"No"}),t.jsx(y,{value:"true",text:"Yes"})]})]}),t.jsx(x,{kind:"primary",size:"sm",onClick:lt,disabled:_e,style:{flex:"0 0 auto",marginLeft:"auto"},children:"Apply filters"})]}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.5rem",padding:"0.65rem 0.75rem",borderRadius:"6px",border:"1px solid rgba(15, 98, 254, 0.15)",background:"rgba(15, 98, 254, 0.03)"},children:[t.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.02em",color:"var(--cds-text-secondary, #525252)",marginRight:"0.25rem"},children:"Quick presets"}),t.jsx(x,{kind:"secondary",size:"sm",disabled:!u,onClick:()=>{const e=u;e&&(D(e),I(e),X("execution_accuracy"),Y("subset_non_empty_execution_accuracy"),ie("0"),oe("eq"),ce(!0),pe(1),H({page:1,pipeline:e,pipeline2:e,metric:"execution_accuracy",metric2:"subset_non_empty_execution_accuracy",value:"0",op:"eq",disagree:!0}))},children:"Exec=0 & subset=1"}),t.jsx(x,{kind:"secondary",size:"sm",disabled:!u,onClick:()=>{const e=u;e&&(D(e),I(e),X("subset_non_empty_execution_accuracy"),Y("llm_score"),ie("0"),oe("eq"),ce(!0),pe(1),H({page:1,pipeline:e,pipeline2:e,metric:"subset_non_empty_execution_accuracy",metric2:"llm_score",value:"0",op:"eq",disagree:!0}))},children:"Subset=0 & llm=1"})]})]}),Ce&&t.jsx(h,{kind:"error",title:"Error loading error records",subtitle:Ce,lowContrast:!0}),_e?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[t.jsx(ut,{description:`Loading error records for ${a}…`,status:"active"}),t.jsx(pt,{role:"progressbar",columnCount:6,rowCount:10})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{maxHeight:"420px",overflow:"auto"},children:t.jsx(ft,{rows:it,headers:at,size:"sm",children:({rows:e,headers:s,getHeaderProps:l})=>t.jsx(mt,{children:t.jsxs(xt,{"aria-label":"Error records",children:[t.jsx(gt,{children:t.jsx(Ge,{children:s.map(d=>{const{key:i,...f}=l({header:d});return t.jsx(ht,{...f,children:d.header},i)})})}),t.jsx(yt,{children:e.map(d=>t.jsx(Ge,{style:{cursor:"pointer"},onClick:()=>{const i=String(d.id),f=ue(i,L);f&&(Ee(i),de(f))},children:d.cells.map(i=>t.jsx(jt,{children:i.value},i.id))},d.id))})]})})})}),t.jsx(bt,{page:_,pageSize:k,pageSizes:[10,25,50,100],totalItems:Ye,onChange:({page:e,pageSize:s})=>J({page:e,pageSize:s})})]}),o&&t.jsxs(t.Fragment,{children:[t.jsx("div",{onClick:Oe,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:7400}}),t.jsxs("div",{style:{position:"fixed",top:"3rem",right:0,bottom:0,width:"min(900px, 92vw)",zIndex:7500,background:"#ffffff",color:"#161616",borderLeft:"1px solid rgba(0,0,0,0.12)",padding:"0.85rem",overflow:"auto",display:"flex",flexDirection:"column",gap:"0.75rem"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[t.jsx("h3",{style:{margin:0},children:O==="raw"?`Raw JSON – ${o}`:O==="modify"?`Modify Query – ${o}`:`Record detail – ${o}${T?` (${T})`:""}`}),t.jsxs("div",{style:{display:"flex",gap:"0.35rem"},children:[O!=="detail"&&t.jsx(x,{kind:"ghost",size:"sm",onClick:()=>Q("detail"),children:"Back to detail"}),t.jsx(x,{kind:"ghost",size:"sm",onClick:Oe,children:"X"})]})]}),O==="raw"?t.jsxs(t.Fragment,{children:[et&&t.jsx(h,{kind:"info",title:"Loading raw JSON...",subtitle:"Fetching full record payload from predictions_eval",lowContrast:!0}),Le&&t.jsx(h,{kind:"error",title:"Failed to load raw JSON",subtitle:Le,lowContrast:!0}),xe&&t.jsx("section",{children:t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",border:"1px solid rgba(15,98,254,0.2)",color:"#161616"},children:JSON.stringify(xe,null,2)})})]}):O==="modify"?t.jsxs(t.Fragment,{children:[t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Source SQL"}),t.jsx("div",{style:{marginBottom:"0.35rem"},children:tt||"Custom query"})]}),t.jsx(St,{id:"error-analysis-modify-query-sql",labelText:"Editable SQL",rows:14,value:v,onChange:e=>F(e.target.value)}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(x,{kind:"secondary",size:"sm",disabled:Pe||!v.trim(),onClick:()=>void ct(),children:"Execute"})}),Pe&&t.jsx(h,{kind:"info",title:"Executing SQL...",subtitle:"Running query against the benchmark backend",lowContrast:!0}),qe&&t.jsx(h,{kind:"error",title:"SQL execution failed",subtitle:qe,lowContrast:!0}),ze&&t.jsx(h,{kind:"error",title:"Failed to update ground truth",subtitle:ze,lowContrast:!0}),Ne&&t.jsx(h,{kind:"success",title:"Ground truth updated",subtitle:Ne,lowContrast:!0}),E&&t.jsxs(t.Fragment,{children:[t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Execution summary"}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",color:"#161616"},children:JSON.stringify({db_type:E.db_type,db_id:E.db_id,execution_time_ms:E.execution_time_ms,row_count:E.row_count,column_count:E.column_count},null,2)})]}),t.jsx(be,{title:"Execution result",rawData:E.result}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(x,{kind:"primary",size:"sm",disabled:st||!v.trim(),onClick:()=>void dt(),children:"Add to benchmark ground truth"})})]})]}):t.jsxs(t.Fragment,{children:[Fe&&t.jsx(h,{kind:"info",title:"Loading details...",subtitle:"Fetching full record detail",lowContrast:!0}),Me&&t.jsx(h,{kind:"error",title:"Failed to load details",subtitle:Me,lowContrast:!0}),c&&t.jsxs(t.Fragment,{children:[t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Question"}),t.jsx("div",{style:{whiteSpace:"pre-wrap"},children:c.question||"N/A"})]}),t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Ground truth SQL"}),(c.ground_truth_sql||[]).map((e,s)=>t.jsxs("div",{style:{marginBottom:"0.55rem"},children:[t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",border:"1px solid rgba(15,98,254,0.2)",color:"#161616"},children:t.jsx("code",{dangerouslySetInnerHTML:{__html:We(e)}})}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(x,{kind:"ghost",size:"sm",onClick:()=>Qe(e,`Ground truth SQL ${s+1}`),children:"Modify Query"})})]},`gt-sql-${s}`))]}),t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Predicted SQL"}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",border:"1px solid rgba(15,98,254,0.2)",color:"#161616"},children:t.jsx("code",{dangerouslySetInnerHTML:{__html:We(c.predicted_sql||"N/A")}})}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(x,{kind:"ghost",size:"sm",disabled:!c.predicted_sql,onClick:()=>Qe(c.predicted_sql||"","Predicted SQL"),children:"Modify Query"})})]}),t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Evaluation metrics"}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",color:"#161616"},children:JSON.stringify(c.evaluation_metrics??{},null,2)})]}),(c.ground_truth_results||[]).map((e,s)=>{var l;return t.jsx(be,{title:`Ground truth result ${s+1}`,rawData:e,totalRows:(l=c.ground_truth_result_row_counts)==null?void 0:l[s]},`gt-result-table-${s}`)}),t.jsx(be,{title:"Predicted result",rawData:c.predicted_result,totalRows:c.predicted_result_row_count}),t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Prompt"}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",color:"#161616"},children:c.prompt||"N/A"})]}),t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"LLM judge"}),t.jsxs("div",{style:{marginBottom:"0.25rem"},children:["Score: ",c.llm_judge_score??"N/A"]}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",color:"#161616"},children:c.llm_judge_explanation||"N/A"})]}),(c.sql_execution_error||c.inference_error)&&t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Errors"}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",color:"#161616"},children:JSON.stringify({sql_execution_error:c.sql_execution_error,inference_error:c.inference_error},null,2)})]}),t.jsx("div",{style:{marginTop:"0.25rem",display:"flex",justifyContent:"flex-end"},children:t.jsx(x,{kind:"secondary",size:"sm",onClick:()=>void ot(),children:"View Raw JSON"})})]})]})]})]})]})};export{Rt as ErrorAnalysis};
1
+ import{r,k as t,B as x,I as h,E as Ae,S as ne,G as y,l as ut,D as pt,n as ft,T as mt,o as xt,p as gt,q as Ge,t as ht,v as yt,w as jt,x as bt,H as St,y as le,z as R}from"./index-DLyduwv0.js";import{C as Ve}from"./ComboBox-BActzty7.js";import{b as Be,f as wt,S as He}from"./metricInsightsSelect-unZgHJkx.js";import{R as be,h as We}from"./ResultTableView-C-syf-qW.js";import"./defaultItemToString-ClUBp4QC.js";function _t(a,M,n){const $=M.find(ae=>ae.record_id===a),U=Object.keys(($==null?void 0:$.predictions)??{});return n&&U.includes(n)?n:U[0]??null}function Ue(a){if(a==null)return"N/A";if(typeof a=="number")return Number.isFinite(a)?String(a):"N/A";if(typeof a=="boolean")return a?"true":"false";if(typeof a=="string")return a;try{return JSON.stringify(a)}catch{return String(a)}}function Xe(a,M){const n=a.trim();return n?n.replaceAll("_"," "):M}const Rt=({benchmarkId:a,onBack:M,initialFilters:n,initialPage:$,initialPageSize:U,initialRecordId:ae,onStateChange:w})=>{const[L,Se]=r.useState([]),[Ye,Ke]=r.useState(0),_=$??1,k=U??25,[we,Ze]=r.useState(""),[u,D]=r.useState(()=>(n==null?void 0:n.pipeline)??""),[j,X]=r.useState(()=>(n==null?void 0:n.metric)??"execution_accuracy"),[P,ie]=r.useState(()=>(n==null?void 0:n.value)??"0"),[q,oe]=r.useState(()=>(n==null?void 0:n.op)??"eq"),[m,I]=r.useState(()=>(n==null?void 0:n.pipeline2)??""),[b,Y]=r.useState(()=>(n==null?void 0:n.metric2)??"subset_non_empty_execution_accuracy"),[C,ce]=r.useState(()=>(n==null?void 0:n.disagree)??!1),[_e,ke]=r.useState(!0),[Ce,Te]=r.useState(null),o=ae??null,[T,de]=r.useState(null),ue=r.useCallback((e,s)=>_t(e,s,u),[u]);r.useEffect(()=>{if(!o||T||L.length===0)return;const e=ue(o,L);e&&de(e)},[o,T,L,ue]);const ve=r.useMemo(()=>({pipeline:u,metric:j,value:P,op:q,pipeline2:m,metric2:b,disagree:C}),[u,j,P,q,m,b,C]),J=r.useCallback(e=>{w==null||w({filters:ve,page:e.page??_,pageSize:e.pageSize??k,record:e.record!==void 0?e.record:o})},[ve,w,_,k,o]),pe=r.useCallback(e=>J({page:e}),[J]),Ee=r.useCallback(e=>J({record:e}),[J]);r.useEffect(()=>{w==null||w({filters:{pipeline:u,metric:j,value:P,op:q,pipeline2:m,metric2:b,disagree:C},page:_,pageSize:k,record:o})},[w,u,j,P,q,m,b,C,_,k,o]);const[c,Re]=r.useState(null),[Fe,fe]=r.useState(!1),[Me,me]=r.useState(null),[O,Q]=r.useState("detail"),[xe,ge]=r.useState(null),[et,K]=r.useState(!1),[Le,Z]=r.useState(null),[tt,he]=r.useState(""),[v,F]=r.useState(""),[Pe,A]=r.useState(!1),[qe,G]=r.useState(null),[E,V]=r.useState(null),[st,B]=r.useState(!1),[ze,z]=r.useState(null),[Ne,N]=r.useState(null),[$e,rt]=r.useState([]),[S,De]=r.useState(null),[Ie,Je]=r.useState(null),ee=r.useMemo(()=>Be((S==null?void 0:S.metrics)??[]),[S]);r.useEffect(()=>{let e=!1;return(async()=>{try{Je(null);const d=await(await le(R("/api/evaluation-metric-definitions"))).json();e||De(d)}catch(l){e||(De(null),Je((l==null?void 0:l.message)||"Failed to load metric definitions"))}})(),()=>{e=!0}},[]),r.useEffect(()=>{var d;if(!((d=S==null?void 0:S.metrics)!=null&&d.length))return;const e=Be(S.metrics),s=wt(e);if(s.length===0)return;const l=new Set(s);X(i=>l.has(i)?i:s[0]),Y(i=>l.has(i)?i:s[1]??s[0])},[S]);const H=async e=>{const s=(e==null?void 0:e.page)??_,l=(e==null?void 0:e.pageSize)??k,d=(e==null?void 0:e.search)??we,i=(e==null?void 0:e.pipeline)??u,f=(e==null?void 0:e.metric)??j,g=(e==null?void 0:e.value)??P,te=(e==null?void 0:e.op)??q,se=(e==null?void 0:e.pipeline2)??m,ye=(e==null?void 0:e.metric2)??b,re=(e==null?void 0:e.disagree)??C;try{ke(!0),Te(null),Se([]);const p=new URLSearchParams;p.set("page",String(s)),p.set("page_size",String(l)),d&&p.set("q",d),i&&(p.set("pipeline",i),f&&p.set("metric",f),g&&p.set("value",g),te&&p.set("op",te)),i&&se&&re&&(p.set("pipeline2",se),ye&&p.set("metric2",ye),p.set("disagree","true"));const W=await(await le(R(`/api/benchmarks/${a}/errors?${p.toString()}`))).json();Se(W.items),Ke(W.total)}catch(p){Te(p.message||"Failed to load error records")}finally{ke(!1)}},[nt]=r.useState(()=>(n==null?void 0:n.pipeline)??"");r.useEffect(()=>{(async()=>{var s;try{const l=await fetch(R(`/api/benchmarks/${a}/summary/by-category`));if(!l.ok)return;const i=[...(await l.json()).overall??[]].sort((g,te)=>{var re,p,je,W;const se=Number(((p=(re=g.metrics)==null?void 0:re.subset_non_empty_execution_accuracy)==null?void 0:p.average)??-1);return Number(((W=(je=te.metrics)==null?void 0:je.subset_non_empty_execution_accuracy)==null?void 0:W.average)??-1)-se});rt(i.map(g=>g.name));const f=((s=i[0])==null?void 0:s.name)??"";if(!f)return;D(g=>g||f),I(g=>g||f),nt||H({pipeline:f})}catch{}})()},[a]);const lt=()=>{pe(1),H({page:1})};r.useEffect(()=>{H()},[a,_,k]);const at=[{key:"record_id",header:"Record ID"},{key:"question",header:"Question"},{key:"metric1_pipeline",header:"Pipeline 1"},{key:"metric1_score",header:Xe(j,"Metric 1")},{key:"metric2_pipeline",header:"Pipeline 2"},{key:"metric2_score",header:Xe(b,"Metric 2")}],it=r.useMemo(()=>L.map(e=>{var d,i;const s=u?(d=e.predictions)==null?void 0:d[u]:void 0,l=m?(i=e.predictions)==null?void 0:i[m]:void 0;return{id:e.record_id,record_id:e.record_id,question:e.question,metric1_pipeline:u||"—",metric1_score:u?Ue(s==null?void 0:s[j]):"—",metric2_pipeline:m||"—",metric2_score:m?Ue(l==null?void 0:l[b]):"—"}}),[L,j,b,u,m]);r.useEffect(()=>{if(!o||!T)return;(async()=>{try{fe(!0),me(null);const s=new URLSearchParams;s.set("pipeline",T);const l=await le(R(`/api/benchmarks/${a}/errors/${o}/detail?${s.toString()}`));Re(await l.json())}catch(s){me(s.message||"Failed to load record details")}finally{fe(!1)}})()},[a,o,T]);const Oe=()=>{Ee(null),de(null),Re(null),me(null),fe(!1),Q("detail"),ge(null),Z(null),K(!1),he(""),F(""),A(!1),G(null),V(null),B(!1),z(null),N(null)};r.useEffect(()=>{Q("detail"),ge(null),Z(null),K(!1),he(""),F(""),A(!1),G(null),V(null),B(!1),z(null),N(null)},[o]);const ot=async()=>{if(o&&(Q("raw"),!xe))try{K(!0),Z(null);const e=await le(R(`/api/benchmarks/${a}/errors/${o}`));ge(await e.json())}catch(e){Z(e.message||"Failed to load raw JSON")}finally{K(!1)}},Qe=(e,s)=>{he(s),F(e),A(!1),G(null),V(null),B(!1),z(null),N(null),Q("modify")},ct=async()=>{if(!(!o||!v.trim()))try{A(!0),G(null);const e=await fetch(R(`/api/benchmarks/${a}/execute`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:v,record_id:o,db_id:c==null?void 0:c.db_id})}),s=await e.json();if(!e.ok)throw new Error((s==null?void 0:s.detail)||`HTTP ${e.status}`);V(s),z(null),N(null)}catch(e){G(e.message||"Failed to execute SQL"),V(null)}finally{A(!1)}},dt=async()=>{if(!(!o||!v.trim()||!window.confirm("Are you confident this query should be added to benchmark ground truth SQLs?")))try{B(!0),z(null),N(null);const s=await fetch(R(`/api/benchmarks/${a}/ground-truth-sql`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({record_id:o,sql:v})}),l=await s.json();if(!s.ok)throw new Error((l==null?void 0:l.detail)||`HTTP ${s.status}`);N(l.message)}catch(s){z(s.message||"Failed to add query to benchmark ground truth")}finally{B(!1)}};return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsxs("h3",{style:{margin:0},children:["Error analysis – ",a]}),M&&t.jsx(x,{kind:"ghost",size:"sm",onClick:M,children:"Back"})]}),Ie&&t.jsx(h,{kind:"warning",title:"Metric list unavailable",subtitle:Ie,lowContrast:!0}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"0.5rem",alignItems:"end"},children:[t.jsx(Ae,{id:"error-search",labelText:"Search",placeholder:"Question text or record id",value:we,onChange:e=>Ze(e.target.value)}),t.jsx(Ve,{id:"pipeline-1",titleText:"Pipeline 1 (optional)",placeholder:"e.g. wxai:openai/gpt-oss-120b-greedy-zero-shot-chatapi",items:$e,itemToString:e=>e??"",selectedItem:u||null,onChange:({selectedItem:e})=>D(e??""),onInputChange:e=>D(e),allowCustomValue:!0}),t.jsx(ne,{id:"metric-select",labelText:"Metric",value:j,onChange:e=>X(e.target.value),disabled:ee.length===0,children:ee.map(e=>t.jsx(He,{label:e.label,children:e.metrics.map(s=>t.jsx(y,{value:s.name,text:s.name,title:s.description},s.name))},e.label))}),t.jsx(ne,{id:"metric2-select",labelText:"Metric 2 (for disagreement)",value:b,onChange:e=>Y(e.target.value),disabled:!C||ee.length===0,children:ee.map(e=>t.jsx(He,{label:e.label,children:e.metrics.map(s=>t.jsx(y,{value:s.name,text:s.name,title:s.description},`${s.name}-m2`))},`${e.label}-m2`))}),t.jsxs(ne,{id:"op-select",labelText:"Operator",value:q,onChange:e=>oe(e.target.value),children:[t.jsx(y,{value:"eq",text:"="}),t.jsx(y,{value:"ne",text:"≠"}),t.jsx(y,{value:"lt",text:"<"}),t.jsx(y,{value:"gt",text:">"}),t.jsx(y,{value:"le",text:"≤"}),t.jsx(y,{value:"ge",text:"≥"})]})]}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"flex-end",gap:"0.5rem",width:"100%"},children:[t.jsxs("div",{style:{flex:"1 1 400px",display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"0.5rem",alignItems:"end",minWidth:0},children:[t.jsx(Ae,{id:"metric-value",labelText:"Metric value",value:P,onChange:e=>ie(e.target.value)}),t.jsx(Ve,{id:"pipeline-2",titleText:"Pipeline 2 (for disagreement)",placeholder:"Second pipeline id",items:$e,itemToString:e=>e??"",selectedItem:m||null,onChange:({selectedItem:e})=>I(e??""),onInputChange:e=>I(e),allowCustomValue:!0}),t.jsxs(ne,{id:"disagree-select",labelText:"P1 vs P2 disagree?",value:C?"true":"false",onChange:e=>ce(e.target.value==="true"),children:[t.jsx(y,{value:"false",text:"No"}),t.jsx(y,{value:"true",text:"Yes"})]})]}),t.jsx(x,{kind:"primary",size:"sm",onClick:lt,disabled:_e,style:{flex:"0 0 auto",marginLeft:"auto"},children:"Apply filters"})]}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.5rem",padding:"0.65rem 0.75rem",borderRadius:"6px",border:"1px solid rgba(15, 98, 254, 0.15)",background:"rgba(15, 98, 254, 0.03)"},children:[t.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.02em",color:"var(--cds-text-secondary, #525252)",marginRight:"0.25rem"},children:"Quick presets"}),t.jsx(x,{kind:"secondary",size:"sm",disabled:!u,onClick:()=>{const e=u;e&&(D(e),I(e),X("execution_accuracy"),Y("subset_non_empty_execution_accuracy"),ie("0"),oe("eq"),ce(!0),pe(1),H({page:1,pipeline:e,pipeline2:e,metric:"execution_accuracy",metric2:"subset_non_empty_execution_accuracy",value:"0",op:"eq",disagree:!0}))},children:"Exec=0 & subset=1"}),t.jsx(x,{kind:"secondary",size:"sm",disabled:!u,onClick:()=>{const e=u;e&&(D(e),I(e),X("subset_non_empty_execution_accuracy"),Y("llm_score"),ie("0"),oe("eq"),ce(!0),pe(1),H({page:1,pipeline:e,pipeline2:e,metric:"subset_non_empty_execution_accuracy",metric2:"llm_score",value:"0",op:"eq",disagree:!0}))},children:"Subset=0 & llm=1"})]})]}),Ce&&t.jsx(h,{kind:"error",title:"Error loading error records",subtitle:Ce,lowContrast:!0}),_e?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[t.jsx(ut,{description:`Loading error records for ${a}…`,status:"active"}),t.jsx(pt,{role:"progressbar",columnCount:6,rowCount:10})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{maxHeight:"420px",overflow:"auto"},children:t.jsx(ft,{rows:it,headers:at,size:"sm",children:({rows:e,headers:s,getHeaderProps:l})=>t.jsx(mt,{children:t.jsxs(xt,{"aria-label":"Error records",children:[t.jsx(gt,{children:t.jsx(Ge,{children:s.map(d=>{const{key:i,...f}=l({header:d});return t.jsx(ht,{...f,children:d.header},i)})})}),t.jsx(yt,{children:e.map(d=>t.jsx(Ge,{style:{cursor:"pointer"},onClick:()=>{const i=String(d.id),f=ue(i,L);f&&(Ee(i),de(f))},children:d.cells.map(i=>t.jsx(jt,{children:i.value},i.id))},d.id))})]})})})}),t.jsx(bt,{page:_,pageSize:k,pageSizes:[10,25,50,100],totalItems:Ye,onChange:({page:e,pageSize:s})=>J({page:e,pageSize:s})})]}),o&&t.jsxs(t.Fragment,{children:[t.jsx("div",{onClick:Oe,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:7400}}),t.jsxs("div",{style:{position:"fixed",top:"3rem",right:0,bottom:0,width:"min(900px, 92vw)",zIndex:7500,background:"#ffffff",color:"#161616",borderLeft:"1px solid rgba(0,0,0,0.12)",padding:"0.85rem",overflow:"auto",display:"flex",flexDirection:"column",gap:"0.75rem"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[t.jsx("h3",{style:{margin:0},children:O==="raw"?`Raw JSON – ${o}`:O==="modify"?`Modify Query – ${o}`:`Record detail – ${o}${T?` (${T})`:""}`}),t.jsxs("div",{style:{display:"flex",gap:"0.35rem"},children:[O!=="detail"&&t.jsx(x,{kind:"ghost",size:"sm",onClick:()=>Q("detail"),children:"Back to detail"}),t.jsx(x,{kind:"ghost",size:"sm",onClick:Oe,children:"X"})]})]}),O==="raw"?t.jsxs(t.Fragment,{children:[et&&t.jsx(h,{kind:"info",title:"Loading raw JSON...",subtitle:"Fetching full record payload from predictions_eval",lowContrast:!0}),Le&&t.jsx(h,{kind:"error",title:"Failed to load raw JSON",subtitle:Le,lowContrast:!0}),xe&&t.jsx("section",{children:t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",border:"1px solid rgba(15,98,254,0.2)",color:"#161616"},children:JSON.stringify(xe,null,2)})})]}):O==="modify"?t.jsxs(t.Fragment,{children:[t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Source SQL"}),t.jsx("div",{style:{marginBottom:"0.35rem"},children:tt||"Custom query"})]}),t.jsx(St,{id:"error-analysis-modify-query-sql",labelText:"Editable SQL",rows:14,value:v,onChange:e=>F(e.target.value)}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(x,{kind:"secondary",size:"sm",disabled:Pe||!v.trim(),onClick:()=>void ct(),children:"Execute"})}),Pe&&t.jsx(h,{kind:"info",title:"Executing SQL...",subtitle:"Running query against the benchmark backend",lowContrast:!0}),qe&&t.jsx(h,{kind:"error",title:"SQL execution failed",subtitle:qe,lowContrast:!0}),ze&&t.jsx(h,{kind:"error",title:"Failed to update ground truth",subtitle:ze,lowContrast:!0}),Ne&&t.jsx(h,{kind:"success",title:"Ground truth updated",subtitle:Ne,lowContrast:!0}),E&&t.jsxs(t.Fragment,{children:[t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Execution summary"}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",color:"#161616"},children:JSON.stringify({db_type:E.db_type,db_id:E.db_id,execution_time_ms:E.execution_time_ms,row_count:E.row_count,column_count:E.column_count},null,2)})]}),t.jsx(be,{title:"Execution result",rawData:E.result}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(x,{kind:"primary",size:"sm",disabled:st||!v.trim(),onClick:()=>void dt(),children:"Add to benchmark ground truth"})})]})]}):t.jsxs(t.Fragment,{children:[Fe&&t.jsx(h,{kind:"info",title:"Loading details...",subtitle:"Fetching full record detail",lowContrast:!0}),Me&&t.jsx(h,{kind:"error",title:"Failed to load details",subtitle:Me,lowContrast:!0}),c&&t.jsxs(t.Fragment,{children:[t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Question"}),t.jsx("div",{style:{whiteSpace:"pre-wrap"},children:c.question||"N/A"})]}),t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Ground truth SQL"}),(c.ground_truth_sql||[]).map((e,s)=>t.jsxs("div",{style:{marginBottom:"0.55rem"},children:[t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",border:"1px solid rgba(15,98,254,0.2)",color:"#161616"},children:t.jsx("code",{dangerouslySetInnerHTML:{__html:We(e)}})}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(x,{kind:"ghost",size:"sm",onClick:()=>Qe(e,`Ground truth SQL ${s+1}`),children:"Modify Query"})})]},`gt-sql-${s}`))]}),t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Predicted SQL"}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",border:"1px solid rgba(15,98,254,0.2)",color:"#161616"},children:t.jsx("code",{dangerouslySetInnerHTML:{__html:We(c.predicted_sql||"N/A")}})}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(x,{kind:"ghost",size:"sm",disabled:!c.predicted_sql,onClick:()=>Qe(c.predicted_sql||"","Predicted SQL"),children:"Modify Query"})})]}),t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Evaluation metrics"}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",color:"#161616"},children:JSON.stringify(c.evaluation_metrics??{},null,2)})]}),(c.ground_truth_results||[]).map((e,s)=>{var l;return t.jsx(be,{title:`Ground truth result ${s+1}`,rawData:e,totalRows:(l=c.ground_truth_result_row_counts)==null?void 0:l[s]},`gt-result-table-${s}`)}),t.jsx(be,{title:"Predicted result",rawData:c.predicted_result,totalRows:c.predicted_result_row_count}),t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Prompt"}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",color:"#161616"},children:c.prompt||"N/A"})]}),t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"LLM judge"}),t.jsxs("div",{style:{marginBottom:"0.25rem"},children:["Score: ",c.llm_judge_score??"N/A"]}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",color:"#161616"},children:c.llm_judge_explanation||"N/A"})]}),(c.sql_execution_error||c.inference_error)&&t.jsxs("section",{children:[t.jsx("h4",{style:{margin:"0.25rem 0",color:"#0f62fe"},children:"Errors"}),t.jsx("pre",{style:{margin:"0.3rem 0",padding:"0.6rem",background:"#f4f4f4",borderRadius:"4px",whiteSpace:"pre-wrap",color:"#161616"},children:JSON.stringify({sql_execution_error:c.sql_execution_error,inference_error:c.inference_error},null,2)})]}),t.jsx("div",{style:{marginTop:"0.25rem",display:"flex",justifyContent:"flex-end"},children:t.jsx(x,{kind:"secondary",size:"sm",onClick:()=>void ot(),children:"View Raw JSON"})})]})]})]})]})]})};export{Rt as ErrorAnalysis};
@@ -0,0 +1,10 @@
1
+ import{R as f,J as F,r as i,y as C,z as j,k as s,B as _,K as O,I as L,E as z,L as D,H as q}from"./index-DLyduwv0.js";import{C as B}from"./ComboBox-BActzty7.js";import"./defaultItemToString-ClUBp4QC.js";var b,A,I,M;const P=f.forwardRef(function({children:S,size:n=16,...c},h){return f.createElement(F,{width:n,height:n,ref:h,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...c},b||(b=f.createElement("path",{d:"M12 12H14V24H12z"})),A||(A=f.createElement("path",{d:"M18 12H20V24H18z"})),I||(I=f.createElement("path",{d:"M4,6V8H6V28a2,2,0,0,0,2,2H24a2,2,0,0,0,2-2V8h2V6ZM8,28V8H24V28Z"})),M||(M=f.createElement("path",{d:"M12 2H20V4H12z"})),S)}),R="llm_judge_default_config",G=/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/,Q={model:{id:"anthropic:claude-sonnet-4-5",max_tokens:1e3,temperature:0},prompt_template:`You are evaluating whether a predicted SQL query correctly answers a question.
2
+
3
+ Question: {question}
4
+ Ground truth SQL: {ground_truth_sql}
5
+ Predicted SQL: {predicted_sql}
6
+ Ground truth result: {ground_truth_df}
7
+ Predicted result: {predicted_df}
8
+
9
+ Answer Yes if the prediction correctly answers the question, No otherwise.
10
+ Start your reply with Yes or No, then explain.`},K=()=>{const[v,S]=i.useState([]),[n,c]=i.useState(null),[h,u]=i.useState(""),[N,a]=i.useState(null),[k,r]=i.useState(null),[p,g]=i.useState(!1),[d,w]=i.useState(null),y=i.useCallback(async()=>{const e=await(await C(j("/api/llm-judge/configs"))).json();return S(e.items),e.items},[]),x=i.useCallback(async t=>{try{g(!0),a(null),r(null);const l=await(await C(j(`/api/llm-judge/configs/${t.name}`))).json();u(JSON.stringify(l,null,2))}catch(e){a(e.message||"Failed to load config"),u("")}finally{g(!1)}},[]);i.useEffect(()=>{(async()=>{try{a(null);const l=(await y()).find(o=>o.name===R);l&&(c(l),await x(l))}catch(e){a(e.message||"Failed to load config list")}})()},[x,y]);const H=()=>{a(null),r(null),c(null),w(""),u(JSON.stringify(Q,null,2))},V=()=>{w(null),u(""),a(null)},$=async()=>{const t=d!==null,e=t?(d||"").trim():n==null?void 0:n.name;if(!e)return;if(t&&!G.test(e)){a("A config name must start with a letter or digit and contain only letters, digits, dots, dashes and underscores.");return}if(t&&v.some(o=>o.name===e)){a(`A config named "${e}" already exists. Pick another name.`);return}let l;try{l=JSON.parse(h)}catch(o){a(`The config is not valid JSON: ${o.message}`);return}try{g(!0),a(null),r(null),await C(j(`/api/llm-judge/configs/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});const m=(await y()).find(E=>E.name===e)||null;c(m),w(null),r(t?`Created "${e}". It is now selectable in the judge playground.`:`Saved "${e}".`)}catch(o){a(o.message||"Failed to save config")}finally{g(!1)}},J=async()=>{if(!(n!=null&&n.user_defined))return;const t=n.name;try{g(!0),a(null),r(null);const l=await(await C(j(`/api/llm-judge/configs/${t}`),{method:"DELETE"})).json(),m=(await y()).find(E=>E.name===t)||null;c(m),m?await x(m):u(""),r(l!=null&&l.reverted_to_packaged?`Deleted the edit to "${t}"; the packaged config is back in use.`:`Deleted "${t}".`)}catch(e){a(e.message||"Failed to delete config")}finally{g(!1)}},T=d!==null||n!==null;return s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"},children:[s.jsx("h3",{style:{margin:0},children:"LLM-as-judge configuration"}),s.jsx(_,{kind:"ghost",size:"sm",renderIcon:O,onClick:H,disabled:p,children:"New config"})]}),N&&s.jsx(L,{kind:"error",title:"Error",subtitle:N,lowContrast:!0,onCloseButtonClick:()=>a(null)}),k&&s.jsx(L,{kind:"success",title:"Saved",subtitle:k,lowContrast:!0,onCloseButtonClick:()=>r(null)}),d!==null?s.jsx(z,{id:"llm-config-new-name",labelText:"New config name",helperText:"Letters, digits, dots, dashes and underscores.",value:d,onChange:t=>w(t.target.value),placeholder:"llm_judge_claude_config"}):s.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:"0.5rem"},children:[s.jsx("div",{style:{flex:1},children:s.jsx(B,{id:"llm-config-select",titleText:"Select config",items:v,itemToString:t=>t?t.name:"",selectedItem:n,onChange:t=>{const e=t.selectedItem;c(e),r(null),e?x(e):u("")},placeholder:"Choose a YAML config"})}),(n==null?void 0:n.user_defined)&&s.jsx(D,{type:"blue",size:"md",children:"edited"})]}),s.jsx(q,{id:"llm-config-editor",labelText:"Config JSON (edit and save)",rows:20,value:h,onChange:t=>u(t.target.value),disabled:!T}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx(_,{kind:"primary",onClick:()=>void $(),disabled:!T||p,children:d!==null?"Create config":"Save config"}),d!==null&&s.jsx(_,{kind:"secondary",onClick:V,disabled:p,children:"Cancel"}),d===null&&(n==null?void 0:n.user_defined)&&s.jsx(_,{kind:"danger--tertiary",renderIcon:P,onClick:()=>void J(),disabled:p,children:"Delete"})]})]})};export{K as LLMJudgeConfigView};