Skip to content

Impl

pipelines.extraction.llama.impl

Summary

Concrete llama-family implementations.


ImplLlamaObjectsReaderPort receives the list of already-structured statement objects (the equivalent of the LlamaCloud extract result) and applies the row-level bucket filter — B/F marker rows and any rows before the first marker are dropped, mirroring OG domain.extraction.adaptors.txn_blocks.BucketFinderAdaptor.filter_txn_rows. The downstream chain (objects → txn dicts → raw expenses) is the shared core: ImplTxnDictsObjectsPort (stated balances trusted) + ImplRawExpensePort.

Classes

ImplLlamaExtractionPipeline

Bases: LlamaExtractionPipeline

Concrete llama graph root.

Attributes:

Name Type Description
ingest ImplIngestPort

Ingest stage.

objects_reader ImplLlamaObjectsReaderPort

Objects-reading stage.

txn_dicts ImplObjectsTxnDictsPort

Objects-to-txn-dicts stage.

raw_expense ImplRawExpensePort

Terminal raw-expense stage.

Functions
run
run(source) -> List[Any]

Run the llama objects extraction chain.

Parameters:

Name Type Description Default
source

Raw extraction source.

required

Returns:

Type Description
List[Any]

List[Any]: Raw expense records.

ImplLlamaObjectsReaderPort

Bases: LlamaObjectsReaderPort

Drop B/F marker rows + pre-marker header rows from a statement list.

Mirrors the OG bucket finder contract exactly: markers are B/F / BIF / B|F matched against each object's description (upper-cased). With limit_first only the first (primary) bucket is kept (default False, like the OG lama service; the icici bank module overrides it to True to match the icici OG CONFIG). Statements without a marker row pass through.

Attributes:

Name Type Description
bf_markers tuple

Marker tokens identifying bucket boundaries.

limit_first bool

Keep only the first bucket.

Functions
filter_objects
1
2
3
filter_objects(
    objects: List[Any], *, limit_first: bool = False
) -> List[dict]

Filter objects to rows between balance-forward marker rows.

Parameters:

Name Type Description Default
objects List[Any]

Structured statement objects.

required
limit_first bool

Keep only the first bucket. Defaults to False.

False

Returns:

Type Description
List[dict]

List[dict]: Records between (and after) marker rows.

read
read(objects) -> List[dict]

Read structured objects, applying the row-level bucket filter.

Parameters:

Name Type Description Default
objects

List of structured statement objects.

required

Returns:

Type Description
List[dict]

List[dict]: Filtered records in order.