Pool
infra.llm.providers.llama_parser.pool
Summary
LlamaCloud statement parser adaptor.
Upload a statement PDF to LlamaCloud for extraction, or replay a cached CSV, returning normalized transaction dictionaries.
Classes
AsyncLlamaParserPool
Bases: LlamaParserAdaptor
LLM parser pool configured from the environment.
Initialize the pool with configuration defaults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs |
Overrides passed to the parser adaptor. |
{}
|
Attributes
client
property
Return the lazily initialized LlamaCloud client.
Returns:
| Name | Type | Description |
|---|---|---|
AsyncLlamaCloud |
AsyncLlamaCloud
|
Authenticated LlamaCloud client. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When no API key is configured. |
Functions
generate_statement
async
Extract transactions from a statement PDF.
When cached points to a CSV previously exported by
scripts/llama_txns_extractor.py, read it and validate each row into
RawExpense models instead of calling LlamaCloud.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath |
Union[str, PathLike]
|
Path to the statement PDF. |
required |
cached |
Optional[Union[str, PathLike]]
|
Path to a cached CSV export. |
None
|
Returns:
| Type | Description |
|---|---|
List[dict]
|
List[dict]: Extracted transaction dictionaries. |
LlamaParserAdaptor
Extract transactions through the LlamaCloud API.
Attributes:
| Name | Type | Description |
|---|---|---|
api_key |
str
|
LlamaCloud API key. |
extract_config |
dict
|
Extraction configuration payload. |
_client |
Optional[AsyncLlamaCloud]
|
Lazily created API client. |
Initialize the parser adaptor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs |
Configuration; |
{}
|
Attributes
client
property
Return the lazily initialized LlamaCloud client.
Returns:
| Name | Type | Description |
|---|---|---|
AsyncLlamaCloud |
AsyncLlamaCloud
|
Authenticated LlamaCloud client. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When no API key is configured. |
Functions
generate_statement
async
Extract transactions from a statement PDF.
When cached points to a CSV previously exported by
scripts/llama_txns_extractor.py, read it and validate each row into
RawExpense models instead of calling LlamaCloud.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath |
Union[str, PathLike]
|
Path to the statement PDF. |
required |
cached |
Optional[Union[str, PathLike]]
|
Path to a cached CSV export. |
None
|
Returns:
| Type | Description |
|---|---|
List[dict]
|
List[dict]: Extracted transaction dictionaries. |