cadrumo.application.ledger.llm_diagnostics_ports module¶
Application-owned read capabilities for ledger LLM diagnostics.
The diagnostics projection aggregates two existing stores, but it does not own either store’s persistence details. The application boundary therefore names only the accounting facts it needs and lets an executable composition root translate concrete records and failures before they cross inward.
- class LlmUsageDiagnosticRecord(provider, input_tokens, output_tokens, cost_estimate_usd, cache_hit)[source]¶
Bases:
objectAccounting-only usage fact supplied by an outer reader.
Response text, request identifiers, and other transport/storage fields are intentionally absent: the diagnostics use case has no reason to receive them, and the DTO keeps that boundary explicit.
- Parameters:
- class LlmUsageDiagnosticsReader(*args, **kwargs)[source]¶
Bases:
ProtocolRead usage accounting facts within an inclusive date window.
- class LlmTransactionDiagnosticsReader(*args, **kwargs)[source]¶
Bases:
ProtocolRead the domain transaction facts used for confidence diagnostics.
- exception LlmDiagnosticsReadError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorA usage or transaction diagnostics read failed at the outer boundary.
- Parameters:
- Return type:
None
- code¶
- class LlmDiagnosticsPorts(usage_reader, transaction_reader)[source]¶
Bases:
objectRequired read capabilities for one ledger LLM diagnostics report.
- Parameters:
usage_reader (LlmUsageDiagnosticsReader)
transaction_reader (LlmTransactionDiagnosticsReader)
-
usage_reader:
LlmUsageDiagnosticsReader¶
-
transaction_reader:
LlmTransactionDiagnosticsReader¶