Eval Runner Service¶
Batch evaluation execution via the Axion evaluation engine.
Classes¶
EvalRunnerError
¶
Bases: Exception
Base exception for eval runner errors.
MetricEvaluationError
¶
Bases: EvalRunnerError
Error during metric evaluation.
AgentConnectionError
¶
Bases: EvalRunnerError
Error connecting to agent API.
Functions¶
get_available_metrics()
¶
get_metric_by_key(key)
¶
evaluate_llm_metric(metric_key, item, model_name, llm_provider)
async
¶
Evaluate a single item using an LLM-based metric.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric_key
|
str
|
The metric to evaluate |
required |
item
|
dict[str, Any]
|
The item data with required fields |
required |
model_name
|
str
|
LLM model to use |
required |
llm_provider
|
str
|
Provider (openai, anthropic) |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, str]
|
Tuple of (score, reasoning) |
Source code in backend/app/services/eval_runner_service.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
evaluate_heuristic_metric(metric_key, item)
¶
Evaluate a single item using a heuristic (non-LLM) metric.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric_key
|
str
|
The metric to evaluate |
required |
item
|
dict[str, Any]
|
The item data with required fields |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, str]
|
Tuple of (score, reasoning) |
Source code in backend/app/services/eval_runner_service.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | |
call_agent_api(agent_config, query)
async
¶
Call an external agent API to generate output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_config
|
AgentConfig
|
Agent configuration |
required |
query
|
str
|
The query to send |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, float]
|
Tuple of (output, latency_ms) |
Source code in backend/app/services/eval_runner_service.py
prepare_evaluation_data(dataset_data, column_mapping, metrics)
¶
Validate data, build DatasetItems, and instantiate metrics.
Returns:
| Type | Description |
|---|---|
list[DatasetItem]
|
Tuple of (dataset_items, scoring_metrics, valid_metric_keys, warnings). |
list[Any]
|
Warnings are human-readable strings for surfacing to the user. |
Source code in backend/app/services/eval_runner_service.py
746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | |
run_evaluation_sync(evaluation_name, dataset_data, column_mapping, metrics, model_name, llm_provider, max_concurrent, thresholds, agent_config)
¶
Run evaluation using axion's evaluation_runner (synchronous).
Convenience wrapper that validates data and runs evaluation in one call.
Source code in backend/app/services/eval_runner_service.py
run_evaluation(evaluation_name, dataset_data, column_mapping, metrics, model_name, llm_provider, max_concurrent, thresholds, agent_config, on_progress=None, on_log=None)
async
¶
Run evaluation asynchronously using axion's evaluation_runner.
Runs the synchronous evaluation_runner in a thread pool to not block the async event loop while still showing progress in the terminal.
Source code in backend/app/services/eval_runner_service.py
run_evaluation_stream(evaluation_name, dataset_data, column_mapping, metrics, model_name, llm_provider, max_concurrent, thresholds, agent_config)
async
¶
Run evaluation with SSE streaming updates.
Yields SSE events for progress, logs, and completion. Runs validation in the async context for real progress tracking, then runs axion evaluation in a thread pool.
Source code in backend/app/services/eval_runner_service.py
1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 | |