fastrag.ingestion.events#
Events emitted during pipeline execution.
Two families live here: step lifecycle events (Step*), emitted by the
evaluator around every step regardless of what it does, and domain events
(Document*, ItemFailed), emitted by a step itself through its
ExecutionContext to describe what it did to one
item. Both are propagated to whatever sink a Pipeline context manager
installs.
Every event carries two names for the step that produced it, and they answer different questions:
stepis the instance name — by default the producing class’s own name (ChunkerRouter,SitemapCrawler,MilvusVectorStore.save). It identifies which object in the graph emitted this, and two differently configured instances of the same family are told apart by it.event_nameis the stage name — the labelevent_nameresolves to for that class (Fetching,Parsing,Chunking,Embedding,Indexing, …). It identifies what kind of work this was, so a consumer can group every chunker in a graph under one heading without knowing any concrete class. A step whose family declares noevent_namefalls back to its own class name, so this is never empty for an event a real step emitted.
Both are plain strings with an empty default, so an event constructed by hand (a test double, a consumer replaying a stream) stays valid without naming either.
Classes
|
Emitted when a document has been split into chunks. |
|
Emitted when a document or chunk receives vector embeddings. |
|
Emitted when a source item has been fetched. |
|
Emitted when a document has been parsed. |
|
Emitted when a document is persisted into a vector store. |
|
Emitted once by a vector store's sync step, after its upstream is exhausted. |
|
Emitted when a single item fails within a step. |
|
Emitted when a step is done with one item, successfully or not. |
|
Emitted when a transient failure or timeout is about to be retried. |
|
Emitted when a step starts working on one item. |
Base class for all events emitted during pipeline execution. |
|
|
Emitted when a step completes processing all items. |
|
Emitted when a step encounters an unrecoverable error. |
|
Emitted incrementally as items process through a step. |
|
Emitted when a pipeline step begins processing. |
- class fastrag.ingestion.events.PipelineEvent[source]#
Bases:
objectBase class for all events emitted during pipeline execution.
- class fastrag.ingestion.events.StepStarted(step, event_name='')[source]#
Bases:
PipelineEventEmitted when a pipeline step begins processing.
- class fastrag.ingestion.events.StepProgress(step, processed_count=0, event_name='')[source]#
Bases:
PipelineEventEmitted incrementally as items process through a step.
- class fastrag.ingestion.events.StepCompleted(step, event_name='')[source]#
Bases:
PipelineEventEmitted when a step completes processing all items.
- class fastrag.ingestion.events.StepFailed(step, error=<factory>, event_name='')[source]#
Bases:
PipelineEventEmitted when a step encounters an unrecoverable error.
- class fastrag.ingestion.events.DocumentFetched(source, step='', event_name='')[source]#
Bases:
PipelineEventEmitted when a source item has been fetched.
- source#
The fetched item.
source.cachedisTruewhen it was served from the cache rather than freshly fetched.
- class fastrag.ingestion.events.DocumentParsed(document, step='', event_name='')[source]#
Bases:
PipelineEventEmitted when a document has been parsed.
- document#
The parsed document.
document.cachedisTruewhen it was served from the cache rather than freshly parsed.- Type:
- class fastrag.ingestion.events.DocumentChunked(document, chunks=<factory>, step='', event_name='')[source]#
Bases:
PipelineEventEmitted when a document has been split into chunks.
- document#
The parent document that was split.
- Type:
- chunks#
The chunks produced from
document— retained (rather than just a count) so a consumer can inspect each chunk’s owncached/id/metadataindividually.- Type:
- class fastrag.ingestion.events.DocumentEmbedded(document, step='', event_name='')[source]#
Bases:
PipelineEventEmitted when a document or chunk receives vector embeddings.
- document#
The embedded document.
document.cachedisTruewhen its embedding was served from the cache rather than freshly computed, or whenskip_existingbypassed embedding for an already indexed document. In the latter case, its embedding may beNone.- Type:
- class fastrag.ingestion.events.DocumentSaved(document, step='', event_name='')[source]#
Bases:
PipelineEventEmitted when a document is persisted into a vector store.
- document#
The saved document.
- Type:
- class fastrag.ingestion.events.DocumentsPruned(step='', stale=0, deleted=0, failures=0, event_name='')[source]#
Bases:
PipelineEventEmitted once by a vector store’s sync step, after its upstream is exhausted.
- deleted#
How many of them were deleted: all of them after a clean run, none after a run with
failures.- Type:
- failures#
ItemFailedevents the run emitted. Any failure keeps the stale documents, since a failed item’s documents are missing from the run without being gone from the source.- Type:
- class fastrag.ingestion.events.ItemFailed(step='', uri='', error=<factory>, source_id='', event_name='')[source]#
Bases:
PipelineEventEmitted when a single item fails within a step.
- step#
Name of the step the failing item was being processed by. The first field (rather than an afterthought default), so every caller names it — a consumer (e.g.
ConsoleLogger) can always attribute the failure to the stage it came from.- Type:
- source_id#
The originating
Sourceid the failing item traces back to (its ownidfor aSource, or.source_idfor aDocument) — empty when the failing item carries neither (e.g. a whole childSourceStepfailing insideSources). Lets a consumer attribute a failure to the row a multi-source table’sstepname alone cannot identify (a parser/chunker/ embedder/sink step is shared by every source; only the item it was processing says which one).- Type:
- class fastrag.ingestion.events.ItemStarted(item_id, uri='', step='', event_name='', source_id='')[source]#
Bases:
PipelineEventEmitted when a step starts working on one item.
- class fastrag.ingestion.events.ItemRetrying(item_id, attempt=1, delay=0.0, error=<factory>)[source]#
Bases:
PipelineEventEmitted when a transient failure or timeout is about to be retried.
- class fastrag.ingestion.events.ItemFinished(item_id, elapsed=0.0, error=None)[source]#
Bases:
PipelineEventEmitted when a step is done with one item, successfully or not.