Skip to main content

SummaryBackend

Trait SummaryBackend 

Source
pub trait SummaryBackend:
    Debug
    + Send
    + Sync {
    // Required method
    fn summarize(
        &self,
        request: &SummaryRequest,
    ) -> Result<SummaryResponse, SummaryError>;
}
Expand description

Pluggable LLM summary backend used by the Phase 4.D decay path.

Contract:

  • summarize(request) takes a deterministic input (model_name pin, prompt_template_blake3 pin, source claims, byte budget) and returns either a summary string + token usage or a typed error.
  • Implementations MUST validate the model_name pin against their own allowlist BEFORE making any backend call.
  • Implementations MUST be deterministic given the same input when used in CI / fixture mode (see ReplaySummaryBackend).
  • Implementations MUST NOT panic on invalid inputs; the decay runner relies on every refusal returning a typed SummaryError.

Send + Sync + Debug is required so the runtime can hold a &dyn SummaryBackend across thread boundaries.

Required Methods§

Source

fn summarize( &self, request: &SummaryRequest, ) -> Result<SummaryResponse, SummaryError>

Issue a summary call. The implementation owns its own timeout budget and MUST surface timeouts as SummaryError::CallFailed.

Implementors§