Skip to main content

PredictHost

Trait PredictHost 

Source
pub trait PredictHost: Send + Sync {
    // Required methods
    fn is_enabled(&self) -> bool;
    fn pref_get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn pref_set<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        value: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn agent_bound_model<'life0, 'life1, 'async_trait>(
        &'life0 self,
        agent_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn default_model(&self) -> String;
    fn call_side_model<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        model: &'life1 str,
        effort: &'life2 str,
        system: &'life3 str,
        user: &'life4 str,
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
}
Expand description

The kernel couplings the moved predict engine needs, inverted so this crate stays free of any apps/core dependency. Core implements it (predict_host.rs) over the ServerState and installs it into the PredictCtx.

Required Methods§

Source

fn is_enabled(&self) -> bool

Whether system-wide predictive typing is currently enabled (i.e. the built-in Predict plugin is installed and enabled). The flag is owned by the kernel (predict::is_enabled, seeded at boot + flipped on plugin enable/disable); the request path reads it here and refuses when off.

Source

fn pref_get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read a persisted preference value (the predict config blob).

Source

fn pref_set<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Persist a preference value (the predict config blob).

Source

fn agent_bound_model<'life0, 'life1, 'async_trait>( &'life0 self, agent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The bound chat model of an agent, if that agent exists and has one. Lets an explicit agent_id make the prediction agent a real, swappable card — its bound model wins over the config’s model.

Source

fn default_model(&self) -> String

The built-in default model id, used when nothing else resolves.

Source

fn call_side_model<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, model: &'life1 str, effort: &'life2 str, system: &'life3 str, user: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Hand the completion call to the Gateway (routing / firewall / budgets / audit all apply). Returns the raw assistant text.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§