LlmPropositionReviser

data class LlmPropositionReviser(llmOptions: <Error class: unknown class>, ai: <Error class: unknown class>, val topK: Int = 5, val similarityThreshold: Double = 0.5, minSimilarityForReinforce: Double = 0.7, decayK: Double = 2.0, autoMergeThreshold: Double = 0.95, classifyBatchSize: Int = 15, entityOverlapFilter: Boolean = true, classifyLlmOptions: <Error class: unknown class>? = null, trustScorer: TrustScorer? = null, authorityResolver: AuthorityResolver? = null, conflictDetector: ConflictDetector? = null) : PropositionReviser

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 classification

Parameters

llmOptions

LLM configuration

ai

AI service for LLM calls

topK

Number of similar propositions to retrieve for classification

similarityThreshold

Minimum similarity threshold - skip LLM if no candidates above this

minSimilarityForReinforce

Minimum LLM-reported similarity to accept SIMILAR classification (default 0.7)

decayK

Decay constant for time-based confidence reduction

autoMergeThreshold

Embedding similarity at or above which propositions are auto-merged without LLM. Set to 1.1 to disable.

classifyBatchSize

Maximum number of propositions to classify in a single LLM call

entityOverlapFilter

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.

classifyLlmOptions

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.

trustScorer

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

authorityResolver

optional policy that resolves a proposition's source-authority tier before scoring; only consulted when trustScorer is set

conflictDetector

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

Link copied to clipboard
constructor(llmOptions: <Error class: unknown class>, ai: <Error class: unknown class>, topK: Int = 5, similarityThreshold: Double = 0.5, minSimilarityForReinforce: Double = 0.7, decayK: Double = 2.0, autoMergeThreshold: Double = 0.95, classifyBatchSize: Int = 15, entityOverlapFilter: Boolean = true, classifyLlmOptions: <Error class: unknown class>? = null, trustScorer: TrustScorer? = null, authorityResolver: AuthorityResolver? = null, conflictDetector: ConflictDetector? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val similarityThreshold: Double = 0.5
Link copied to clipboard
open val topK: Int = 5

Functions

Link copied to clipboard
open override fun classify(newProposition: Proposition, candidates: List<Proposition>): List<ClassifiedProposition>

Classify the relationship between propositions.

Link copied to clipboard
open override fun revise(newProposition: Proposition, repository: PropositionRepository): RevisionResult

Single-proposition revise — uses retrieveAndFastPath then falls back to single-proposition LLM classify for backward compatibility.

Link copied to clipboard
open override fun reviseAll(propositions: List<Proposition>, repository: PropositionRepository): List<RevisionResult>

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.

Link copied to clipboard

Policy that resolves a proposition's source-authority tier before trust scoring. Only consulted when a trustScorer is also set.

Link copied to clipboard

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.

Link copied to clipboard

Set the batch size for LLM classification calls.

Link copied to clipboard
fun withClassifyLlm(llm: <Error class: unknown class>): LlmPropositionReviser

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.

Link copied to clipboard

Policy that classifies the nature of a contradiction. When set, a contradicted result carries the detector's ConflictType instead of the conservative default.

Link copied to clipboard

Set the decay constant for time-based confidence reduction.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard

Set the minimum similarity threshold. Candidates below this threshold are skipped (no LLM call).

Link copied to clipboard

Set the number of similar propositions to retrieve for classification.

Link copied to clipboard

Policy that computes and caches an advisory trust score on retained propositions (New, Merged, Reinforced). When unset, no trust score is computed.