Phase Component Reference¶
Injected extractors, linkers, rerankers, and classifiers used across Phases 2–4. As injected computational
units they are recursively discovered by find_components and their state is fingerprinted for run invalidation
and phase reuse.
Entity Linkers & NER (Phase 2)¶
DenseEntityLinker¶
Dense retrieval based entity linker.
Bases: EntityLinker
Entity linker using dense retrieval (bi-encoder) and structural reranking (cross-encoder).
Parameters¶
embedding_model : EmbeddingModel | str | None, optional
Bi-encoder used to embed the mention envelope and candidate envelopes.
Must satisfy :class:EmbeddingModel. If None, defaults to :class:HuggingFaceEmbeddingModel.
cross_encoder : CrossEncoder | None, optional
Reranker scoring (mention envelope, candidate structural envelope) pairs. Must
satisfy :class:CrossEncoder and return probability-like scores.
tau : float, default 0.85
Acceptance threshold on the cross-encoder score in [0, 1].
top_k : int, default 10
Number of bi-encoder candidates forwarded to the cross-encoder.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/sota_entity_linker.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |
fingerprint()
¶
Return deterministic dense entity linker configuration.
Returns¶
dict of str to Any Dictionary containing tau threshold, top_k, and fingerprints of embedding model and cross encoder.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/sota_entity_linker.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
JevEntityLinker¶
Bases: EntityLinker
Entity linker backed by TypeSafe Jev / Laya calibrated decision engine.
Performs bi-encoder candidate retrieval from the active graph store followed by Jev categorical choice disambiguation with conformal prediction guarantees and explicit Out-of-Ontology (OoO) detection.
Parameters¶
decision_engine : DecisionEngine
Calibrated decision engine supporting evaluate_choice.
embedding_model : EmbeddingModel or str or None, default None
Bi-encoder used to embed mentions and candidate nodes. If None,
defaults to HuggingFaceEmbeddingModel.
alpha : float, default 0.05
Conformal significance level providing 1 - alpha prediction set coverage.
top_k : int, default 5
Maximum number of candidate entities evaluated in the Jev choice prompt.
Bounded to 5 by default to prevent context window saturation.
ooo_threshold : float, default 0.75
Confidence threshold fallback for Out-of-Ontology decisions.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/jev_entity_linker.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
event_emitter
property
¶
Return the bound domain event emitter.
fingerprint()
¶
Return deterministic Jev entity linker configuration.
Returns¶
dict of str to Any Dictionary containing alpha, top_k, ooo_threshold, and fingerprints of embedding model and decision engine.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/jev_entity_linker.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
link(mention, graph_store, *, top_k=None, threshold=None)
async
¶
Link an extracted entity mention to an existing canonical graph node.
Parameters¶
mention : L2Entity The extracted entity mention. graph_store : GraphReader Active graph store. top_k : int or None, default None Optional override for candidate retrieval count. threshold : float or None, default None Optional override for confidence threshold.
Returns¶
L2Entity or None The matched canonical entity, or None if novel or ambiguous.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/jev_entity_linker.py
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 | |
link_with_decision(mention, graph_store, *, top_k=None, threshold=None, alpha=None)
async
¶
Link a mention to a canonical entity and return detailed decision telemetry.
Parameters¶
mention : L2Entity The extracted entity mention to link. graph_store : GraphReader Active graph store holding canonical entities. top_k : int or None, default None Optional override for candidate retrieval count (bounded to 5). threshold : float or None, default None Optional override for acceptance threshold. alpha : float or None, default None Optional override for conformal significance level.
Returns¶
tuple of (L2Entity or None, DecisionScore or None, bool)
- Matched canonical entity, or None if novel/ambiguous.
- Decision score telemetry from the DecisionEngine.
- is_ambiguous flag indicating whether decision escalated (e.g.
conformal set size > 1 or empty).
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/jev_entity_linker.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
CascadingEntityLinker¶
Bases: EntityLinker
Cascading entity linker combining System 1 triage with System 2 verification.
Routes mentions first to a primary linker (typically :class:JevEntityLinker).
If the primary decision is ambiguous (e.g. conformal prediction set contains
multiple candidates or is uncertain), the mention cascades to a fallback
linker (typically :class:DenseEntityLinker using cross-encoder reranking).
Parameters¶
primary : EntityLinker
Primary fast triage linker (typically :class:JevEntityLinker).
fallback : EntityLinker
Secondary fallback linker (typically :class:DenseEntityLinker).
audit_rate : float, default 0.0
Stochastic rate at which mentions bypass the primary linker and run
directly through the fallback linker for calibration auditing.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/jev_entity_linker.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
fingerprint()
¶
Return deterministic cascading entity linker configuration.
Returns¶
dict of str to Any Dictionary containing audit rate and fingerprints of primary and fallback linkers.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/jev_entity_linker.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |
link(mention, graph_store, *, top_k=None, threshold=None)
async
¶
Link mention via cascading triage with fallback.
Parameters¶
mention : L2Entity The extracted entity mention. graph_store : GraphReader Active graph store. top_k : int or None, default None Optional override for candidate retrieval count. threshold : float or None, default None Optional override for confidence threshold.
Returns¶
L2Entity or None The matched canonical entity, or None to mint a novel entity.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/jev_entity_linker.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
LLMNERExtractor¶
Bases: NERExtractor
Default NERExtractor using LlamaIndex LLM structured prediction.
Accepts any LlamaIndex BaseLLM (LiteLLM, OpenAI, Ollama, etc.).
Parameters¶
llm : Any Underlying LLM instance. prompts : StructuredPromptBundle or None, default None Prompt bundle for direct, reasoning, format, and gleaning templates. max_gleanings : int, default 0 Maximum extraction iterations if no dynamic stopping oracle is supplied. mention_context_injector : Any, default None Textual context injector for mentions. strategy : Any, default "direct_constrained" Decoding strategy. stopping_oracle : GleaningStoppingOracle or None, default None Stopping oracle evaluating whether additional passes are warranted.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/ner_extractor.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
fingerprint()
¶
Return deterministic NER extractor configuration.
Returns¶
dict of str to Any Dictionary containing class identifier, max gleanings, strategy, and fingerprints of stopping oracle and language model.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/ner_extractor.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
from_config(llm, config, decision_engine=None, mention_context_injector=None)
classmethod
¶
Construct LLMNERExtractor with dependencies wired from Phase2Config.
Parameters¶
llm : Any LlamaIndex BaseLLM instance. config : Phase2Config Phase 2 configuration. decision_engine : DecisionEngine or None, default None Optional decision engine for stopping oracle. mention_context_injector : Any, default None Optional custom mention context injector.
Returns¶
LLMNERExtractor Configured extractor instance.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase2_entity_discovery/ner_extractor.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
Rerankers & Global Relation Extractors (Phase 3)¶
DenseRetrievalGlobalRelationExtractor¶
Bases: GlobalRelationExtractor
SOTA GlobalRelationExtractor leveraging dense embeddings for candidate generation and a cross-encoder for relational reranking prior to LLM extraction.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/dense_retrieval_extractor.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | |
candidate_pairs(entities)
async
¶
Generate candidate entity pairs via dense embedding retrieval.
Parameters¶
entities : list[L2Entity] Entities considered for candidate pairing.
Returns¶
list[CandidatePair] Dense candidate pairs above configured similarity threshold.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/dense_retrieval_extractor.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
extract_pair(pair, graph_store, schema)
async
¶
Extract a relation triple for a single candidate pair.
Parameters¶
pair : CandidatePair Candidate entity pair to evaluate. graph_store : GraphReader Graph reader for envelope retrieval. schema : SchemaConfig Schema configuration defining valid relation types.
Returns¶
L2Triple | None Extracted triple if validated, otherwise None.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/dense_retrieval_extractor.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | |
filter_candidate_pairs(pairs)
async
¶
Fast Cartesian pair pre-gating using Decision Engine.
Filters candidate entity pairs using fast binary decision evaluation before heavy cross-encoder reranking or LLM extraction.
Parameters¶
pairs : list of CandidatePair The candidate entity pairs to filter.
Returns¶
list of CandidatePair The filtered candidate pairs surviving gating or stochastic audit.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/dense_retrieval_extractor.py
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 | |
fingerprint()
¶
Return deterministic dense retrieval global relation extractor configuration.
Returns¶
dict of str to Any Dictionary containing class identifier and fingerprints of injected reranker, decision engine, embedding model, and language model.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/dense_retrieval_extractor.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
JevRelationReranker¶
Bases: RelationReranker
Relation reranker backed by the TypeSafe Jev Decision Engine.
Evaluates relation plausibility and returns the empirical accuracy score.
Parameters¶
decision_engine : DecisionEngine The calibrated decision engine instance. prompts : StructuredPromptBundle or None, default None Optional prompt bundle carrying the decision question template.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/rerankers.py
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 | |
fingerprint()
¶
Return deterministic Jev relation reranker configuration.
Returns¶
dict of str to Any Dictionary containing class identifier, decision template, and decision engine fingerprint.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/rerankers.py
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | |
CrossEncoderRelationReranker¶
Bases: RelationReranker
Lift a text :class:CrossEncoder into the :class:RelationReranker interface.
The two interfaces are deliberately distinct — a RelationReranker scores
domain objects and may be structural (e.g. a GNN), a CrossEncoder scores
text pairs. When the caller only has a text cross-encoder, this adapter
makes the conversion explicit and visible at the composition root instead of
relying on one concrete class happening to implement both.
Parameters¶
cross_encoder
Any object satisfying the CrossEncoder protocol.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/rerankers.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
fingerprint()
¶
Return deterministic cross-encoder relation reranker configuration.
Returns¶
dict of str to Any Dictionary containing class identifier and wrapped cross encoder fingerprint.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/rerankers.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
SentenceTransformerCrossEncoderReranker¶
Bases: RelationReranker
Relation reranker backed by a sentence-transformers cross encoder.
The heavy sentence_transformers and torch dependencies are imported
lazily so importing the pipeline package never loads a model or touches the
Hugging Face cache.
Parameters¶
model_name
Hugging Face model identifier passed to CrossEncoder when model
is not provided.
prompts
Optional prompt mapping for reranker models that use named prompts.
default_prompt_name
Optional default prompt name passed to CrossEncoder.
model
Preconstructed cross encoder. This is primarily useful for tests or
callers that want to own model loading.
activation_fn
Optional activation function passed to CrossEncoder.predict. When
omitted, torch.nn.Sigmoid() is used.
max_length
Maximum input sequence length forwarded to the cross-encoder.
cache_model
Whether to cache the loaded model in memory for subsequent instances.
When True, the model is cached using the model configuration as key.
This can significantly reduce loading time when creating multiple
reranker instances.
device
Target device for model inference (e.g., "cuda", "mps", "cpu").
trust_remote_code
Whether to allow execution of custom modeling code hosted on Hugging Face.
model_kwargs
Keyword arguments passed down to AutoModelForSequenceClassification.from_pretrained.
tokenizer_args
Keyword arguments passed down to AutoTokenizer.from_pretrained.
config_args
Keyword arguments passed down to AutoConfig.from_pretrained.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/rerankers.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
describe_relation_input(entity_a, env_a, entity_b, env_b)
¶
Summarize the current reranker input without executing inference.
Parameters¶
entity_a Query-side entity. env_a Query-side envelope. entity_b Document-side entity. env_b Document-side envelope.
Returns¶
dict[str, object] Size metadata for the reranker query/document pair.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/rerankers.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
fingerprint()
¶
Return deterministic sentence transformer reranker configuration.
Returns¶
dict of str to Any Dictionary containing model name, prompt name, sequence length, and model arguments.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/rerankers.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
predict(pairs, batch_size=32, show_progress_bar=None, activation_fn=None, apply_softmax=None, convert_to_numpy=True, convert_to_tensor=False)
¶
Predict cross-encoder similarity scores for a list of text pairs.
Implements the CrossEncoder protocol signature directly.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/rerankers.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | |
score_relation(entity_a, env_a, entity_b, env_b)
async
¶
Score whether two entities likely participate in a relation.
Parameters¶
entity_a
First entity, represented as the query side of the pair.
env_a
Context envelope for entity_a.
entity_b
Second entity, represented as the document side of the pair.
env_b
Context envelope for entity_b.
Returns¶
float Cross-encoder score normalized by the configured activation function.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase3_global_relations/rerankers.py
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 | |
Argument Classifiers (Phase 4)¶
LLMACCClassifier¶
Anti-contribution claim (ACC) classifier.
Bases: ACCClassifier
Default ACCClassifier using LlamaIndex LLM structured prediction. Accepts any LlamaIndex BaseLLM.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase4_argument_mining/acc_classifier.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
fingerprint()
¶
Return deterministic ACC classifier configuration.
Returns¶
dict of str to Any Dictionary containing strategy and LLM fingerprint.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase4_argument_mining/acc_classifier.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
TAGARCClassifier¶
Anti-research claim (ARC) classifier.
Bases: ARCClassifier
Default ARCClassifier using TAG subgraph retrieval and LLM stance decoding.
This class orchestrates the classification of cross-chunk argument relations by pairing theory atoms and predicting relations via an LLM.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase4_argument_mining/arc_classifier.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
__init__(llm, embedding_model=None, prompts=None, strategy='direct_constrained', confidence_threshold=0.65, subgraph_depth=2, max_candidates_per_component=10, use_priority_rank=False)
¶
Initialize the TAGARCClassifier.
Parameters¶
llm : Any The language model used for structural prediction. embedding_model : Any, optional The embedding model for computing dense representations, by default None. prompts : Any, optional The prompt template configuration, by default None. strategy : str, optional The prediction strategy, by default "direct_constrained". confidence_threshold : float, optional The minimum LLM confidence to accept a relation, by default 0.65. subgraph_depth : int, optional The depth of structural neighborhood to retrieve, by default 2. max_candidates_per_component : int, optional The max number of cross-chunk partners per component, by default 10. use_priority_rank : bool, optional If True, falls back to epistemic rank instead of embeddings, by default False.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase4_argument_mining/arc_classifier.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
classify_global(local_components, local_relations, graph_store, global_extractor, schema)
async
¶
Predict cross-chunk argument relations using the LLM.
Parameters¶
local_components : list[TheoryAtom] The list of theory atoms to pair up. local_relations : list[TheoryRelation] The relations already extracted locally. graph_store : GraphReader The graph database reader to fetch subgraph neighborhoods. global_extractor : GlobalRelationExtractor The extractor used to fetch the structural context. schema : SchemaConfig The pipeline schema definitions.
Returns¶
list[TheoryRelation] A list of successfully predicted global relations.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase4_argument_mining/arc_classifier.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
fingerprint()
¶
Return deterministic TAG ARC classifier configuration.
Returns¶
dict of str to Any Dictionary containing thresholds, subgraph depth, strategy, and fingerprints of LLM and embedding model.
Source code in packages/episteme-pipeline/episteme_pipeline/phases/phase4_argument_mining/arc_classifier.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |