Entity Incremental Analyzer
class EntityIncrementalAnalyzer<T>(pipeline: EntityPipeline, historyStore: ChunkHistoryStore, formatter: IncrementalSourceFormatter<T>, config: WindowConfig = WindowConfig()) : AbstractIncrementalAnalyzer<T, ChunkEntityResult>
Incremental analyzer that extracts entities (without propositions) using an EntityPipeline.
This is a simpler alternative to com.embabel.dice.incremental.proposition.PropositionIncrementalAnalyzer when you only need entity extraction from conversations or other incremental sources.
Example usage:
val entityExtractor = LlmEntityExtractor.withLlm(llmOptions).withAi(ai)
val pipeline = EntityPipeline.withExtractor(entityExtractor)
val analyzer = EntityIncrementalAnalyzer(
pipeline = pipeline,
historyStore = myHistoryStore,
formatter = MessageFormatter.INSTANCE,
)
val source = ConversationSource(conversation)
val result = analyzer.analyze(source, context)
// Persist extracted entities
result?.persist(entityRepository)Content copied to clipboard
Parameters
T
The type of items in the source
pipeline
The entity extraction pipeline
history Store
Tracks processing history
formatter
Formats source items to text
config
Window and trigger configuration
Constructors
Link copied to clipboard
constructor(pipeline: EntityPipeline, historyStore: ChunkHistoryStore, formatter: IncrementalSourceFormatter<T>, config: WindowConfig = WindowConfig())
Functions
Link copied to clipboard
open override fun analyze(source: IncrementalSource<T>, context: SourceAnalysisContext): ChunkEntityResult?
Analyze the source if enough new content has accumulated.
Link copied to clipboard
open override fun analyzeNow(source: IncrementalSource<T>, context: SourceAnalysisContext): ChunkEntityResult?
Force analysis regardless of trigger interval. Implementations may still skip if content was already processed.