pipeline
pipeline
¶
Composable pipeline for checklist generation and scoring.
This module provides a pipeline API for end-to-end checklist workflows: Generator → Refiners → Scorer.
Example
from autochecklist import pipeline pipe = pipeline("tick", generator_model="openai/gpt-4o-mini") result = pipe("Write a haiku", target="Leaves fall gently...") print(result.pass_rate) # 0.85
Split models¶
pipe = pipeline("tick", generator_model="gpt-4o", scorer_model="gpt-4o-mini")
Generate only (no target → no scoring)¶
checklists = pipe.generate_batch(inputs=["Write a haiku", "Write a poem"])
Resumable batch¶
result = pipe.run_batch(data, output_path="results.jsonl")
PipelineResult
dataclass
¶
Result from a single pipeline execution.
Attributes:
| Name | Type | Description |
|---|---|---|
checklist |
Checklist
|
Generated (and optionally refined) checklist |
score |
Optional[Score]
|
Score object if target was provided, None otherwise |
Source code in autochecklist/pipeline.py
BatchResult
dataclass
¶
Result from batch corpus evaluation.
Attributes:
| Name | Type | Description |
|---|---|---|
checklist |
Optional[Checklist]
|
The checklist used for evaluation (shared if provided, otherwise each score references its own checklist) |
scores |
List[Score]
|
List of Score objects, one per input |
data |
List[Dict[str, Any]]
|
Original input data |
checklists |
List[Checklist]
|
Individual checklists when not using shared checklist |
Source code in autochecklist/pipeline.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
macro_pass_rate
property
¶
Macro-averaged pass rate across all scored examples.
Computes pass_rate for each example independently, then averages. Each example contributes equally regardless of checklist size.
Example: If example A scores 2/4 (0.5) and example B scores 3/3 (1.0), macro_pass_rate = (0.5 + 1.0) / 2 = 0.75
micro_pass_rate
property
¶
Micro-averaged pass rate (DFPR: Decomposed Requirements Following Ratio).
Pools all checklist items across all examples into a single count. Examples with more checklist items have proportionally more influence.
Example: If example A scores 2/4 and example B scores 3/3, micro_pass_rate = (2 + 3) / (4 + 3) = 5/7 ≈ 0.714
mean_score
property
¶
Mean of Score.primary_score across all examples.
Respects each Score's primary_metric — averages weighted_score for weighted pipelines, normalized_score for normalized, pass_rate for pass.
per_category_pass_rates()
¶
Compute per-category pass rates for each example.
Uses the checklist(s) to map item IDs to categories, then computes pass rates per category for each scored example.
Returns:
| Type | Description |
|---|---|
List[Dict[str, float]]
|
List of dicts, one per example, mapping category -> pass_rate |
Source code in autochecklist/pipeline.py
to_dataframe()
¶
Export results to pandas DataFrame.
Source code in autochecklist/pipeline.py
to_jsonl(path)
¶
Export results to JSONL file.
Source code in autochecklist/pipeline.py
ChecklistPipeline
¶
Chains: Generator → Refiners → Scorer.
A composable pipeline for checklist-based evaluation. Three construction modes:
- Preset:
ChecklistPipeline(from_preset="tick")— resolves generator AND auto-attaches the preset's default scorer. - Explicit components:
ChecklistPipeline(generator="tick", scorer="batch")— resolves each component by name. No auto scorer. - Pre-configured instances:
ChecklistPipeline(generator=my_gen, scorer=my_scorer)
The :func:pipeline factory is equivalent to mode 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
generator
|
Optional[Any]
|
Generator name string (e.g., |
None
|
refiners
|
Optional[List[Union[str, Any]]]
|
Optional list of refiner instances or name strings. |
None
|
scorer
|
Optional[Union[str, Any]]
|
Optional scorer instance or name string (e.g., |
None
|
generator_model
|
Optional[str]
|
Model for the generator (used when generator is a string). |
None
|
scorer_model
|
Optional[str]
|
Model for the scorer (used when scorer is a string). |
None
|
provider
|
Optional[str]
|
LLM provider ("openrouter", "openai", "vllm"). |
None
|
base_url
|
Optional[str]
|
Override base URL for the LLM provider. |
None
|
client
|
Any
|
Injected LLM client instance. |
None
|
api_key
|
Optional[str]
|
API key for the provider. |
None
|
api_format
|
Optional[str]
|
API format ("chat" or "responses"). |
None
|
generator_kwargs
|
Optional[Dict[str, Any]]
|
Extra kwargs passed to generator constructor. |
None
|
scorer_kwargs
|
Optional[Dict[str, Any]]
|
Extra kwargs passed to scorer constructor. |
None
|
from_preset
|
Optional[str]
|
Pipeline preset name (e.g., |
None
|
Example
pipe = ChecklistPipeline(from_preset="tick", ... generator_model="gpt-4o", scorer_model="gpt-4o-mini")
pipe = ChecklistPipeline(generator="tick", scorer="batch")
gen = DirectGenerator(method_name="tick", model="gpt-4o") pipe = ChecklistPipeline(generator=gen, scorer="batch")
Source code in autochecklist/pipeline.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 | |
is_instance_level
property
¶
Check if the generator is instance-level.
is_corpus_level
property
¶
Check if the generator is corpus-level.
__call__(input=None, target=None, **kwargs)
¶
Run the full pipeline: generate → refine → score.
For instance-level generators, pass input and target. For corpus-level generators, pass the appropriate inputs via kwargs (e.g., feedback=..., dimensions=...).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
Optional[str]
|
Input instruction/query (for instance-level) |
None
|
target
|
Optional[str]
|
Target response to evaluate (optional for generation-only) |
None
|
**kwargs
|
Any
|
Additional arguments passed to generator |
{}
|
Returns:
| Type | Description |
|---|---|
PipelineResult
|
PipelineResult with checklist and optional score |
Source code in autochecklist/pipeline.py
generate(input=None, **kwargs)
¶
Generate a checklist (without scoring).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
Optional[str]
|
Input instruction/query (for instance-level) |
None
|
**kwargs
|
Any
|
Additional arguments for generator |
{}
|
Returns:
| Type | Description |
|---|---|
Checklist
|
Generated and refined checklist |
Source code in autochecklist/pipeline.py
refine(checklist)
¶
score(checklist, target, input=None)
¶
Score a target response against a checklist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checklist
|
Checklist
|
Checklist to evaluate against |
required |
target
|
str
|
Target response to score |
required |
input
|
Optional[str]
|
Optional input for context |
None
|
Returns:
| Type | Description |
|---|---|
Score
|
Score object |
Source code in autochecklist/pipeline.py
score_group(sub_checklists, target, input=None)
¶
Score a target against sub-checklists (one per category).
Typically used with checklist.by_category() output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sub_checklists
|
Dict[str, Checklist]
|
Dict mapping category name to sub-Checklist |
required |
target
|
str
|
Target response to score |
required |
input
|
Optional[str]
|
Optional input for context |
None
|
Returns:
| Type | Description |
|---|---|
GroupedScore
|
GroupedScore with per-category Score objects |
Source code in autochecklist/pipeline.py
score_batch(checklist, targets, inputs=None, show_progress=False, on_progress=None)
¶
Score multiple targets against a single checklist.
Source code in autochecklist/pipeline.py
generate_batch(data=None, inputs=None, show_progress=False, on_progress=None, output_path=None, overwrite=False)
¶
Generate checklists for a batch of inputs (no scoring).
Only works for instance-level generators (1:1 input → checklist). For corpus-level generators, call generator.generate() directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Optional[List[Dict[str, Any]]]
|
List of dicts with "input" key |
None
|
inputs
|
Optional[List[str]]
|
List of input strings (convenience alternative to data) |
None
|
show_progress
|
bool
|
Show progress bar |
False
|
on_progress
|
Optional[Callable[[int, int], None]]
|
Callback(completed, total) fired after each item |
None
|
output_path
|
Optional[str]
|
Path to JSONL file for incremental writes + resume |
None
|
overwrite
|
bool
|
If True, delete existing output_path before starting |
False
|
Returns:
| Type | Description |
|---|---|
List[Checklist]
|
List of Checklist objects |
Source code in autochecklist/pipeline.py
run_batch(data=None, checklist=None, inputs=None, targets=None, show_progress=False, on_progress=None, output_path=None, overwrite=False)
¶
Run batch evaluation on a corpus.
Can be called with either: 1. data: List of dicts with "input" and "target" keys 2. inputs + targets: Separate lists
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Optional[List[Dict[str, Any]]]
|
List of dicts with input/target pairs |
None
|
checklist
|
Optional[Checklist]
|
Optional shared checklist to use for all evaluations |
None
|
inputs
|
Optional[List[str]]
|
Optional list of inputs (alternative to data) |
None
|
targets
|
Optional[List[str]]
|
Optional list of targets (alternative to data) |
None
|
show_progress
|
bool
|
Show progress bar |
False
|
on_progress
|
Optional[Callable[[int, int], None]]
|
Optional callback |
None
|
output_path
|
Optional[str]
|
Path to JSONL file for incremental writes + resume |
None
|
overwrite
|
bool
|
If True, delete existing output_path before starting |
False
|
Returns:
| Type | Description |
|---|---|
BatchResult
|
BatchResult with scores and aggregated metrics |
Source code in autochecklist/pipeline.py
run_batch_from_file(path, checklist=None, input_key='input', target_key='target', show_progress=False)
¶
Run batch evaluation from a JSONL file.
Source code in autochecklist/pipeline.py
pipeline(task=None, generator_model=None, scorer_model=None, refiners=None, scorer=None, provider=None, base_url=None, client=None, api_key=None, api_format=None, reasoning_effort=None, generator_kwargs=None, scorer_kwargs=None, custom_prompt=None)
¶
Convenience factory that creates a ChecklistPipeline from a pipeline preset.
Equivalent to ChecklistPipeline(from_preset=task, ...). Resolves
both the generator and the preset's default scorer automatically.
Can also be called with custom_prompt= instead of a task name to
create a pipeline from a custom prompt without registration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
Optional[str]
|
Pipeline name or alias. Options: - Instance-level: "tick", "rlcf_direct", "rocketeval", "rlcf_candidate", "rlcf_candidates_only" - Corpus-level: "feedback", "checkeval", "interacteval" Can be None if custom_prompt is provided. |
None
|
generator_model
|
Optional[str]
|
Model for the generator |
None
|
scorer_model
|
Optional[str]
|
Model for the scorer |
None
|
refiners
|
Optional[List[Union[str, Any]]]
|
Optional list of refiner names or instances |
None
|
scorer
|
Optional[Union[str, Any]]
|
Optional scorer name or instance (overrides preset default) |
None
|
provider
|
Optional[str]
|
LLM provider ("openrouter", "openai", "vllm") |
None
|
base_url
|
Optional[str]
|
Override base URL (e.g., vLLM server URL) |
None
|
client
|
Any
|
Injected LLM client (e.g., VLLMOfflineClient) |
None
|
api_key
|
Optional[str]
|
API key for the provider |
None
|
api_format
|
Optional[str]
|
API format ("chat" or "responses") |
None
|
generator_kwargs
|
Optional[Dict[str, Any]]
|
Extra kwargs for generator (e.g., candidate config) |
None
|
scorer_kwargs
|
Optional[Dict[str, Any]]
|
Extra kwargs for scorer |
None
|
custom_prompt
|
Optional[Union[str, Path]]
|
Custom generator prompt. Pass a Path to load from file, or a str for raw prompt text. No registration needed. |
None
|
Returns:
| Type | Description |
|---|---|
ChecklistPipeline
|
Configured ChecklistPipeline |
Example
pipe = pipeline("tick", generator_model="gpt-4o-mini") pipe = pipeline("tick", generator_model="gpt-4o", scorer_model="gpt-4o-mini") pipe = pipeline(custom_prompt=Path("my_eval.md"), scorer_model="gpt-4o-mini")
Source code in autochecklist/pipeline.py
952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | |