EscalatingEntityResolver

class EscalatingEntityResolver(searchers: List<CandidateSearcher>, candidateBakeoff: CandidateBakeoff? = null, contextCompressor: ContextCompressor? = null, config: EscalatingEntityResolver.Config = Config()) : EntityResolver

Entity resolver that walks a chain of CandidateSearchers from cheapest to most expensive, stopping as soon as one returns a confident match. If no searcher is confident, the accumulated candidates go to an optional LLM bakeoff; if that also finds nothing, a new entity is minted (or vetoed if the schema forbids creation).

Default search order:

  1. Exact name match — instant, no LLM

  2. Full-text / heuristic match — fast, no LLM

  3. Embedding similarity — moderate cost, no LLM

  4. LLM arbitration — only for genuinely ambiguous cases

This is the recommended resolver for production. For dev/seed scenarios where you never need to match against existing nodes, AlwaysCreateEntityResolver is simpler. Use the create factory for the full chain (including vector search) or withoutVector for stores without a vector index.

Parameters

searchers

Candidate searchers in cheapest-first order

candidateBakeoff

Optional LLM selector used when no searcher is confident; if null, a new entity is created

contextCompressor

Optional compressor to trim source text before passing it to the bakeoff

config

Behavior toggles, e.g. forcing heuristic-only mode

Constructors

Link copied to clipboard
constructor(searchers: List<CandidateSearcher>, candidateBakeoff: CandidateBakeoff? = null, contextCompressor: ContextCompressor? = null, config: EscalatingEntityResolver.Config = Config())

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Config(val heuristicOnly: Boolean = false)

Behavior toggles for the escalating resolver.

Functions

Link copied to clipboard
open override fun resolve(suggestedEntities: SuggestedEntities, schema: <Error class: unknown class>): Resolutions<SuggestedEntityResolution>

For each of the given entities, resolve them to either an existing entity or a new entity.

Link copied to clipboard

Return a copy with the specified candidate bakeoff.