aeat.application.ledger._llm_suggestions module¶
LLM ledger classification suggestion/result contracts.
These strict frozen DTOs carry the reviewable output of the governed ledger
LLM workflow: stage-1 business classification suggestions, saturated IVA
category suggestions with system-derived tax substrate, evidence-driven split
proposals, provider availability rows, and explicit rejection receipts. They
are application-layer contracts only; classifier engines and prompt parsing live
in transactions, while persistence and audit events are handled
by the application services that consume these records.
The contracts preserve the review loop required by the LLM ADRs: a suggestion is not persisted until the operator applies it, a rejection records an audit event without mutating the transaction, and regulated euro amounts / IVA rates are derived by the system rather than emitted by the model.
See also
_llm_classificationApplication service that builds, applies, saturates, splits, and rejects these suggestions.
suggest_llm_classification()Stage-1 suggestion path that persists nothing.
saturate_llm_classification()Path that adds model-selected IVA category plus system-derived substrate.
suggest_evidence_split()Evidence-driven split/no-split proposal builder.
reject_llm_suggestion()Audit-trailed rejection terminal for any suggestion kind.
_ledger_llm_payloadsCLI JSON-envelope projections for suggest, saturate, and reject paths.
LLMClassificationResponseDomain classifier response projected into
LLMClassificationSuggestion.LLMSplitResponseDomain split response projected into
LLMSplitSuggestion.
- class LLMProvider(*values)[source]¶
Bases:
StrEnumSubprocess LLM provider names accepted by the classify surface.
- CLAUDE¶
- ANTIGRAVITY¶
- CODEX¶
- class LLMClassificationSuggestion(**data)[source]¶
Bases:
BaseModelOne LLM classification suggestion for a transaction, not yet persisted.
- Parameters:
transaction_id (str)
provider (LLMProvider | None)
provenance (str)
classification (BusinessClassification)
category (SpendingCategory | None)
confidence (Decimal)
reason (str)
evidence_id (str | None)
multiple_components (bool | None)
- transaction_id: str¶
- provider: LLMProvider | None¶
- provenance: str¶
- classification: BusinessClassification¶
- category: SpendingCategory | None¶
- confidence: Decimal¶
- reason: str¶
- evidence_id: str | None¶
- multiple_components: bool | None¶
True when the evidence read judged a split may be warranted.
- class LLMProviderAvailability(**data)[source]¶
Bases:
BaseModelWhether one subprocess LLM provider has a usable CLI on
PATH.- Parameters:
provider (LLMProvider)
cli_binary (str)
available (bool)
resolved_path (str | None)
- provider: LLMProvider¶
- cli_binary: str¶
- available: bool¶
- resolved_path: str | None¶
- class LLMSaturatedSuggestion(**data)[source]¶
Bases:
BaseModelA saturated LLM suggestion: business decision plus grounded tax substrate.
- Parameters:
transaction_id (str)
provider (LLMProvider | None)
provenance (str)
classification (BusinessClassification)
category (SpendingCategory | None)
confidence (Decimal)
reason (str)
iva_category (IvaCategory | None)
business_pct (Decimal | None)
iva_rate (Decimal | None)
taxable_base (Decimal | None)
iva_amount (Decimal | None)
rate_derivable (bool)
derivation_note (str)
evidence_id (str | None)
evidence_advisory (str)
multiple_components (bool | None)
- transaction_id: str¶
- provider: LLMProvider | None¶
- provenance: str¶
- classification: BusinessClassification¶
- category: SpendingCategory | None¶
- confidence: Decimal¶
- reason: str¶
- iva_category: IvaCategory | None¶
- business_pct: Decimal | None¶
- iva_rate: Decimal | None¶
- taxable_base: Decimal | None¶
- iva_amount: Decimal | None¶
- rate_derivable: bool¶
- derivation_note: str¶
- evidence_id: str | None¶
- evidence_advisory: str¶
- multiple_components: bool | None¶
True when the evidence read judged a split may be warranted.
- class OperatorIvaDerivationResult(**data)[source]¶
Bases:
BaseModelResult of an operator-initiated IVA derivation for one transaction.
- Parameters:
transaction_id (str)
iva_category (IvaCategory)
derivable (bool)
iva_rate (Decimal | None)
taxable_base (Decimal | None)
iva_amount (Decimal | None)
note (str)
result (ManualLedgerTransactionResult | None)
- transaction_id: str¶
- iva_category: IvaCategory¶
- derivable: bool¶
- iva_rate: Decimal | None¶
- taxable_base: Decimal | None¶
- iva_amount: Decimal | None¶
- note: str¶
- result: ManualLedgerTransactionResult | None¶
- class LLMSplitChildSuggestion(**data)[source]¶
Bases:
BaseModelOne reviewed child of an evidence-driven split, with derived numbers.
- Parameters:
- proportion: Decimal¶
- amount: Decimal¶
- description: str¶
- category: SpendingCategory | None¶
- iva_category: IvaCategory | None¶
- iva_rate: Decimal | None¶
- taxable_base: Decimal | None¶
- iva_amount: Decimal | None¶
- rate_derivable: bool¶
- derivation_note: str¶
- evidence_citation: str¶
- class LLMSplitSuggestion(**data)[source]¶
Bases:
BaseModelAn evidence-driven N-way split proposal with derived child amounts.
- Parameters:
transaction_id (str)
provider (LLMProvider | None)
provenance (str)
reason (str)
parent_amount (Decimal)
children (tuple[LLMSplitChildSuggestion, ...])
evidence_id (str | None)
- transaction_id: str¶
- provider: LLMProvider | None¶
- provenance: str¶
- reason: str¶
- parent_amount: Decimal¶
- children: tuple[LLMSplitChildSuggestion, ...]¶
- evidence_id: str | None¶
- class LLMSplitApplyResult(**data)[source]¶
Bases:
BaseModelOutcome of applying a reviewed evidence-driven split.
- Parameters:
- bucket_id: str¶
- parent_transaction_id: str¶
- split_group_id: str¶
- child_transaction_ids: tuple[str, ...]¶
- provenance: str¶
- classified_child_count: int¶