Llm Proposition Reviser
LLM-based implementation of PropositionReviser. Uses structured output to classify and revise propositions.
Example usage:
val reviser = LlmPropositionReviser
.withLlm(llmOptions)
.withAi(ai)
.withAutoMergeThreshold(0.95)
.withClassifyBatchSize(15)
.withClassifyLlm(cheaperLlmOptions) // optional: cheaper model for classificationParameters
LLM configuration
AI service for LLM calls
Number of similar propositions to retrieve for classification
Minimum similarity threshold - skip LLM if no candidates above this
Minimum LLM-reported similarity to accept SIMILAR classification (default 0.7)
Decay constant for time-based confidence reduction
Embedding similarity at or above which propositions are auto-merged without LLM. Set to 1.1 to disable.
Maximum number of propositions to classify in a single LLM call
When true, candidates that share no entity mentions with the new proposition are filtered out before LLM classification. This eliminates UNRELATED candidates cheaply via set intersection instead of an LLM call. Propositions with no entity mentions bypass this filter.
Optional separate LLM configuration for classification calls. When null (default), uses the main llmOptions. Classification is a structured categorization task that can often use a smaller/cheaper model than extraction without loss of quality.
optional policy that computes and caches an advisory trust score on retained propositions; when null, no score is computed and behaviour is identical to a reviser without trust scoring
optional policy that resolves a proposition's source-authority tier before scoring; only consulted when trustScorer is set
optional policy that classifies the nature of a contradiction; when set, the RevisionResult.Contradicted carries the detector's classification instead of the conservative default
Constructors
Functions
Classify the relationship between propositions.
Single-proposition revise — uses retrieveAndFastPath then falls back to single-proposition LLM classify for backward compatibility.
Deduplicate a batch of propositions by canonical text, then use fast-path (canonical match + auto-merge) where possible and batch the rest into as few LLM calls as possible.
Policy that resolves a proposition's source-authority tier before trust scoring. Only consulted when a trustScorer is also set.
Set the auto-merge threshold. Embedding similarity at or above this value causes automatic merging without an LLM call. Set to 1.1 to disable.
Set the batch size for LLM classification calls.
Set a separate LLM for classification calls. Classification is a structured categorization task (pick from 5 labels) that can use a cheaper/faster model than extraction without loss of quality.
Policy that classifies the nature of a contradiction. When set, a contradicted result carries the detector's ConflictType instead of the conservative default.
Set the decay constant for time-based confidence reduction.
Enable or disable the entity-overlap pre-filter. When enabled, candidates that share no entity mentions with the new proposition are filtered out before LLM classification, saving LLM calls.
Set the minimum similarity score for SIMILAR classifications to be accepted. If the LLM classifies as SIMILAR but with a score below this threshold, the classification is treated as UNRELATED.
Set the minimum similarity threshold. Candidates below this threshold are skipped (no LLM call).
Set the number of similar propositions to retrieve for classification.
Policy that computes and caches an advisory trust score on retained propositions (New, Merged, Reinforced). When unset, no trust score is computed.