Skip to main content

DecideBackend

Trait DecideBackend 

Source
pub trait DecideBackend: Send + Sync {
    // Required methods
    fn decide(&self, request_json: &str) -> Result<String>;
    fn calibrated(&self) -> bool;
    fn describe(&self) -> String;
}
Expand description

The seam: one wire request in, one wire response out.

Required Methods§

Source

fn decide(&self, request_json: &str) -> Result<String>

Answer one request. request_json is {"state": …, "questions": {id: question}} in the proposal’s wire shape; the returned text is the wire response plus provenance (provider, model, calibrated, latency_ms) and is validated by the caller.

Source

fn calibrated(&self) -> bool

Whether this backend’s probabilities are calibrated. Uncalibrated backends may reorder, never omit.

Source

fn describe(&self) -> String

Stable human label for provenance, e.g. "typesafe:jev-latest".

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: DecideBackend + ?Sized> DecideBackend for Box<T>

Source§

fn decide(&self, request_json: &str) -> Result<String>

Source§

fn calibrated(&self) -> bool

Source§

fn describe(&self) -> String

Implementors§