File size: 1,788 Bytes
024c30a ab5ea78 024c30a ab5ea78 024c30a 7f47c61 024c30a ab5ea78 024c30a 6f5d619 024c30a ab5ea78 024c30a ab5ea78 024c30a 7f47c61 ab5ea78 024c30a ab5ea78 024c30a ab5ea78 024c30a 6f5d619 024c30a ab5ea78 024c30a ab5ea78 024c30a ab5ea78 024c30a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | """Knowledge-extraction pipeline: parsed document -> candidate knowledge entries.
Distinct from `src/knowledge/`, which is the existing OCR -> chunk -> pgvector
ingestion path for unstructured RAG. This package does not touch it.
Stage order, and which stages cost money:
adapter seam artifact -> internal Chunk free
filters cue / legend / span NER -> mentions free (CPU)
cluster normalise + cluster mentions free
rank evidence scoring, top-K selection free
extract one LLM call per TERM CLUSTER PAID
validate verbatim span check, escalation free
diff new / duplicate / conflicting free
queue frequency-sorted review queue free
`service.py` is the facade; `cli.py` is the operator entry point.
Design rationale: knowledge_pipeline_context.md
Calibrated constants and why: KNOWLEDGE_PIPELINE_CALIBRATION.md
"""
from .adapter import parsed_doc_from_artifact
from .models import (
AbbrevPair,
CallUsage,
Chunk,
ClusterResult,
DomainContext,
FilterResult,
FormulaEntry,
GlossaryEntry,
KeyParameter,
Mention,
ParsedDoc,
Provenance,
RuleCandidate,
RuleEntry,
TermCluster,
)
from .service import ExtractionResult, build_clusters, estimate_cost, extract_all, run_filters
__all__ = [
"AbbrevPair",
"DomainContext",
"CallUsage",
"Chunk",
"ClusterResult",
"ExtractionResult",
"FilterResult",
"FormulaEntry",
"GlossaryEntry",
"KeyParameter",
"Mention",
"ParsedDoc",
"Provenance",
"RuleCandidate",
"RuleEntry",
"TermCluster",
"build_clusters",
"estimate_cost",
"extract_all",
"parsed_doc_from_artifact",
"run_filters",
]
|