Skip to content

Abc

pipelines.extraction.llama.abc

Summary

Abstract contracts for the llama (structured-objects) extraction graph.


The llama family is "tabular-like" but the front stage differs: instead of reading table rows it starts from a LIST OF ALREADY-STRUCTURED OBJECTS (one per transaction — what LlamaCloud returns, or the cached fixture CSV standing in for it). The downstream stages reuse the shared core:

  • LlamaObjectsReaderPort : list of objects -> filtered records (drops B/F marker rows + pre-marker header rows, port of OG BucketFinderAdaptor.filter_txn_rows).
  • LlamaExtractionPipeline: root matching the tabular run-driver shape, but routed through objects_reader instead of table_reader. It reuses ImplIngestPort (list pass-through), ObjectsTxnDictsPort (stated balances trusted) and ImplRawExpensePort.

Bank-specific wiring lives under banks/.

Classes

LlamaExtractionPipeline

Bases: ABC

Root — objects chain: ingest → objects_reader → txn_dicts → raw_expense.

Slot annotations

source: ExtractionSource ingest: IngestPort objects_reader: LlamaObjectsReaderPort txn_dicts: ObjectsTxnDictsPort raw_expense: RawExpensePort

Attributes:

Name Type Description
source ExtractionSource

The extraction source descriptor.

pipeline str

Pipeline tag ("llama").

ingest IngestPort

Ingest stage.

objects_reader LlamaObjectsReaderPort

Objects-reading stage.

txn_dicts ObjectsTxnDictsPort

Objects-to-txn-dicts stage.

raw_expense RawExpensePort

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.

LlamaObjectsReaderPort

Bases: ABC

list of structured objects → list of filtered records (in order).

Functions
read abstractmethod
read(objects) -> List[Dict[str, Any]]

Read structured objects, dropping marker and header rows.

Parameters:

Name Type Description Default
objects

List of structured statement objects.

required

Returns:

Type Description
List[Dict[str, Any]]

List[Dict[str, Any]]: Filtered records in order.