classPipelineConfig(BaseModel):""" Top-level pipeline configuration. Each phase receives only its sub-config. Serialize to JSON/YAML for reproducible research runs: config.model_dump_json(indent=2) """models:ModelConfig=Field(default_factory=ModelConfig)graph_schema:SchemaConfig=Field(default_factory=lambda:DEFAULT_SCHEMA.model_copy())phase1:Phase1Config=Field(default_factory=Phase1Config)phase2:Phase2Config=Field(default_factory=Phase2Config)phase3:Phase3Config=Field(default_factory=Phase3Config)phase3b:Phase3bConfig=Field(default_factory=Phase3bConfig)phase4_maturation:Phase4EntityMaturationConfig=Field(default_factory=Phase4EntityMaturationConfig)phase4:Phase4Config=Field(default_factory=Phase4Config)phase5:Phase5Config=Field(default_factory=Phase5Config)phase6:Phase6Config=Field(default_factory=Phase6Config)theoretical_enrichment:TheoreticalEnrichmentConfig=Field(default_factory=TheoreticalEnrichmentConfig)execution:ExecutionConfig=Field(default_factory=ExecutionConfig)decision_engine:DecisionEngineConfig|None=Field(default=None)modal_resolver:ModalResolverConfig=Field(default_factory=ModalResolverConfig)@classmethoddeffrom_env(cls,**overrides:Any)->PipelineConfig:"""Build a config whose model selection is resolved from the environment. This is the one supported way to turn ambient environment state into a config. Call it once at the edge (CLI, example script, Studio) and pass the result down; do not read ``os.environ`` inside phases. """returncls(models=ModelConfig.from_env(),**overrides)@propertydefdefault_embedding_model(self)->str:"""Deprecated alias for ``config.models.embedding_model``."""returnself.models.embedding_model@propertydefdefault_reranker_model(self)->str:"""Deprecated alias for ``config.models.reranker_model``."""returnself.models.reranker_model
Build a config whose model selection is resolved from the environment.
This is the one supported way to turn ambient environment state into a
config. Call it once at the edge (CLI, example script, Studio) and pass
the result down; do not read os.environ inside phases.
Source code in packages/episteme-pipeline/episteme_pipeline/config.py
579580581582583584585586587
@classmethoddeffrom_env(cls,**overrides:Any)->PipelineConfig:"""Build a config whose model selection is resolved from the environment. This is the one supported way to turn ambient environment state into a config. Call it once at the edge (CLI, example script, Studio) and pass the result down; do not read ``os.environ`` inside phases. """returncls(models=ModelConfig.from_env(),**overrides)
classExecutionConfig(BaseModel):persist_run_manifests:bool=Truepersist_phase1_artifacts:bool=Truepersist_phase2_artifacts:bool=Truepersist_phase3_artifacts:bool=Truepersist_phase3b_artifacts:bool=Truepersist_phase4_maturation_artifacts:bool=Truepersist_phase4_artifacts:bool=Truepersist_phase5_artifacts:bool=Truepersist_phase6_artifacts:bool=Truepersist_theoretical_enrichment_artifacts:bool=Trueproject_artifacts_to_graph:bool=Falseallow_phase_reuse:bool=Field(default=True,description=("Permit phase-level reuse across runs when every fingerprint ""(schema, method, prompt, config, source) matches the parent run. ""Set False to force every phase to re-execute."),)allow_artifact_hydration:bool=Field(default=True,description=("Prefer reusing persisted artifacts over re-executing upstream phases. ""When True, the pipeline hydrates the prior phase's ArtifactCollection ""from the last successful run (artifact-native resume) and feeds it into ""the next phase instead of recomputing it. ""Requires persist_run_manifests=True and an artifacts_dir holding ""artifacts from a prior run over the same input. ""Trade-off: skips expensive LLM-heavy upstream work, but relies entirely ""on fingerprint invalidation for correctness — if a method or schema ""changed without changing its fingerprint, hydrated artifacts are stale."),)runs_dir:str=".pipeline_runs"artifacts_dir:str=".pipeline_artifacts"
enabled : bool, default True
Whether Phase 3b latent consolidation is enabled.
dense_similarity_threshold : float, default 0.85
The minimum cosine similarity between L2 entity embeddings to consider
them candidates for consolidation.
relation_overlap_threshold : float, default 0.8
The minimum Jaccard similarity of Phase 3 relation edges required to
commit a SAME_AS edge between candidates. A conservative default
ensures distinct but related entities are not incorrectly merged.
verification : ConsolidationVerificationConfig
Sub-configuration for calibrated borderline pair and cluster verification.
Source code in packages/episteme-pipeline/episteme_pipeline/config.py
classPhase3bConfig(BaseModel):"""Configuration for Phase 3b: Latent Graph Consolidation. Attributes ---------- enabled : bool, default True Whether Phase 3b latent consolidation is enabled. dense_similarity_threshold : float, default 0.85 The minimum cosine similarity between L2 entity embeddings to consider them candidates for consolidation. relation_overlap_threshold : float, default 0.8 The minimum Jaccard similarity of Phase 3 relation edges required to commit a SAME_AS edge between candidates. A conservative default ensures distinct but related entities are not incorrectly merged. verification : ConsolidationVerificationConfig Sub-configuration for calibrated borderline pair and cluster verification. """enabled:bool=Truedense_similarity_threshold:float=0.85relation_overlap_threshold:float=0.8verification:ConsolidationVerificationConfig=Field(default_factory=ConsolidationVerificationConfig)
maturation_top_k : int, default 5
The number of representative textual envelopes to retrieve closest to the
geometric centroid for LLM synthesis.
batch_size : int, default 10
The number of entities to synthesize concurrently via the LLM API.
entity_synthesis_prompts : StructuredPromptBundle
The prompt bundle used when calling the LLM to synthesize a mature
entity description.
entity_synthesis_decoding_strategy : StructuredDecodingStrategy
Which decoding strategy the synthesis call routes through.
Source code in packages/episteme-pipeline/episteme_pipeline/config.py
classPhase4EntityMaturationConfig(BaseModel):"""Configuration for Phase 4: Entity Maturation (epistemic synthesis). Attributes ---------- maturation_top_k : int, default 5 The number of representative textual envelopes to retrieve closest to the geometric centroid for LLM synthesis. batch_size : int, default 10 The number of entities to synthesize concurrently via the LLM API. entity_synthesis_prompts : StructuredPromptBundle The prompt bundle used when calling the LLM to synthesize a mature entity description. entity_synthesis_decoding_strategy : StructuredDecodingStrategy Which decoding strategy the synthesis call routes through. """maturation_top_k:int=5batch_size:int=10entity_synthesis_prompts:StructuredPromptBundle=Field(default_factory=lambda:StructuredPromptBundle(direct_template=ENTITY_SYNTHESIS_PROMPT,name="entity_synthesis",))entity_synthesis_decoding_strategy:StructuredDecodingStrategy=StructuredDecodingStrategy.DIRECT
Settings for alignment fusion including entity matching thresholds.
Bases: BaseModel
Configuration for Phase 5: Argument Web & Theory Fusion.
Source code in packages/episteme-pipeline/episteme_pipeline/config.py
373374375376377378379380
classPhase5Config(BaseModel):"""Configuration for Phase 5: Argument Web & Theory Fusion."""argument_clustering_enabled:bool=Truetheory_fusion_enabled:bool=Falsefusion_similarity_threshold:float=0.85cluster_layer:Literal["theory_atoms","l2_entities","both"]="theory_atoms"gating:FusionGatingConfig=Field(default_factory=FusionGatingConfig)
Defines the expected structure and constraints for the constructed theory graph.
Bases: BaseModel
Decoupled schema configuration — all node/edge types the pipeline uses.
Pass a custom instance to PipelineConfig to override the defaults for a
different domain. Prompt templates receive these lists as {entity_types}
and {relation_types} at runtime.
Source code in packages/episteme-pipeline/episteme_pipeline/schema/default_schema.py
classSchemaConfig(BaseModel):""" Decoupled schema configuration — all node/edge types the pipeline uses. Pass a custom instance to PipelineConfig to override the defaults for a different domain. Prompt templates receive these lists as {entity_types} and {relation_types} at runtime. """version:str="v1"node_types:list[str]=Field(default_factory=lambda:list(L2_NODE_TYPES))relation_types:list[str]=Field(default_factory=lambda:list(L2_RELATION_TYPES))node_definitions:dict[str,str]=Field(default_factory=lambda:dict(L2_NODE_DEFINITIONS))relation_definitions:dict[str,str]=Field(default_factory=lambda:dict(L2_RELATION_DEFINITIONS))component_types:list[str]=Field(default_factory=lambda:list(L3_COMPONENT_TYPES))argument_relation_types:list[str]=Field(default_factory=lambda:list(L3_RELATION_TYPES))component_definitions:dict[str,str]=Field(default_factory=lambda:dict(L3_COMPONENT_DEFINITIONS))argument_relation_definitions:dict[str,str]=Field(default_factory=lambda:dict(L3_RELATION_DEFINITIONS))relation_polarities:dict[str,int]=Field(default_factory=lambda:dict(RELATION_POLARITIES))component_partitions:dict[str,str]=Field(default_factory=lambda:dict(COMPONENT_PARTITIONS))scope_types:list[str]=Field(default_factory=lambda:list(SCOPE_TYPES))epistemic_statuses:list[str]=Field(default_factory=lambda:list(EPISTEMIC_STATUSES))defnode_types_str(self)->str:return", ".join(self.node_types)defrelation_types_str(self)->str:return", ".join(self.relation_types)defcomponent_types_str(self)->str:importjsonpayload={k:self.component_definitions.get(k,"No description provided.")forkinself.component_types}returnjson.dumps(payload,indent=2,ensure_ascii=False)defargument_relation_types_str(self)->str:importjsonpayload={k:self.argument_relation_definitions.get(k,"No description provided.")forkinself.argument_relation_types}returnjson.dumps(payload,indent=2,ensure_ascii=False)defget_relations_with_polarity(self,polarity:int|None=None)->list[str]:"""Return relation names filtered by epistemic polarity. Parameters ---------- polarity : int or None, default None +1 for positive (support/entailment), -1 for negative (attack/undercut), 0 for neutral/structural. If None, returns all non-zero dialectical relations (+1 and -1). Returns ------- list of str Relation type names matching the requested polarity. """ifpolarityisNone:return[rforr,pinself.relation_polarities.items()ifp!=0]return[rforr,pinself.relation_polarities.items()ifp==polarity]defget_support_relations(self)->list[str]:"""Return all relation names with positive support polarity (+1). Returns ------- list of str Relation types with polarity +1. """returnself.get_relations_with_polarity(1)defget_attack_relations(self)->list[str]:"""Return all relation names with negative attack polarity (-1). Returns ------- list of str Relation types with polarity -1. """returnself.get_relations_with_polarity(-1)defis_support_relation(self,relation_type:str)->bool:"""Check whether a relation type has positive support polarity (+1). Parameters ---------- relation_type : str Relation type to evaluate. Returns ------- bool True if relation has polarity +1. """returnself.relation_polarities.get(relation_type,self.relation_polarities.get(relation_type.upper(),0))>0defis_attack_relation(self,relation_type:str)->bool:"""Check whether a relation type has negative attack polarity (-1). Parameters ---------- relation_type : str Relation type to evaluate. Returns ------- bool True if relation has polarity -1. """returnself.relation_polarities.get(relation_type,self.relation_polarities.get(relation_type.upper(),0))<0defresolve_relation_type(self,candidate:str)->str|None:"""Resolve a candidate relation name or dialectical stance to a configured argument relation. Matches candidate names directly against argument_relation_types or dynamically maps positive/negative stance labels (e.g. 'SUPPORTS' -> 'SUPPORTS_ARG') based on identical polarity alignment. Parameters ---------- candidate : str Candidate relation or stance identifier. Returns ------- str or None Matching canonical relation type, or None if unmapped. """ifnotcandidate:returnNonecand_upper=candidate.upper()ifcandidateinself.argument_relation_types:returncandidateifcand_upperinself.argument_relation_types:returncand_uppercand_pol=self.relation_polarities.get(cand_upper,self.relation_polarities.get(candidate,0))ifcand_pol!=0:forrinself.argument_relation_types:ifself.relation_polarities.get(r)==cand_pol:returnrreturnNone
Source code in packages/episteme-pipeline/episteme_pipeline/schema/default_schema.py
192193194195196197198199200
defget_attack_relations(self)->list[str]:"""Return all relation names with negative attack polarity (-1). Returns ------- list of str Relation types with polarity -1. """returnself.get_relations_with_polarity(-1)
polarity : int or None, default None
+1 for positive (support/entailment), -1 for negative (attack/undercut),
0 for neutral/structural. If None, returns all non-zero dialectical relations (+1 and -1).
defget_relations_with_polarity(self,polarity:int|None=None)->list[str]:"""Return relation names filtered by epistemic polarity. Parameters ---------- polarity : int or None, default None +1 for positive (support/entailment), -1 for negative (attack/undercut), 0 for neutral/structural. If None, returns all non-zero dialectical relations (+1 and -1). Returns ------- list of str Relation type names matching the requested polarity. """ifpolarityisNone:return[rforr,pinself.relation_polarities.items()ifp!=0]return[rforr,pinself.relation_polarities.items()ifp==polarity]
Source code in packages/episteme-pipeline/episteme_pipeline/schema/default_schema.py
182183184185186187188189190
defget_support_relations(self)->list[str]:"""Return all relation names with positive support polarity (+1). Returns ------- list of str Relation types with polarity +1. """returnself.get_relations_with_polarity(1)
Source code in packages/episteme-pipeline/episteme_pipeline/schema/default_schema.py
217218219220221222223224225226227228229230
defis_attack_relation(self,relation_type:str)->bool:"""Check whether a relation type has negative attack polarity (-1). Parameters ---------- relation_type : str Relation type to evaluate. Returns ------- bool True if relation has polarity -1. """returnself.relation_polarities.get(relation_type,self.relation_polarities.get(relation_type.upper(),0))<0
Source code in packages/episteme-pipeline/episteme_pipeline/schema/default_schema.py
202203204205206207208209210211212213214215
defis_support_relation(self,relation_type:str)->bool:"""Check whether a relation type has positive support polarity (+1). Parameters ---------- relation_type : str Relation type to evaluate. Returns ------- bool True if relation has polarity +1. """returnself.relation_polarities.get(relation_type,self.relation_polarities.get(relation_type.upper(),0))>0
defresolve_relation_type(self,candidate:str)->str|None:"""Resolve a candidate relation name or dialectical stance to a configured argument relation. Matches candidate names directly against argument_relation_types or dynamically maps positive/negative stance labels (e.g. 'SUPPORTS' -> 'SUPPORTS_ARG') based on identical polarity alignment. Parameters ---------- candidate : str Candidate relation or stance identifier. Returns ------- str or None Matching canonical relation type, or None if unmapped. """ifnotcandidate:returnNonecand_upper=candidate.upper()ifcandidateinself.argument_relation_types:returncandidateifcand_upperinself.argument_relation_types:returncand_uppercand_pol=self.relation_polarities.get(cand_upper,self.relation_polarities.get(candidate,0))ifcand_pol!=0:forrinself.argument_relation_types:ifself.relation_polarities.get(r)==cand_pol:returnrreturnNone