pub struct InferenceSession<E: InferenceEngine> { /* private fields */ }Expand description
One live generation. Constructing it requires a LoadPermit, so a model
that has not passed the provenance gate (ADR-006) cannot reach the runtime —
the Conformist relationship is enforced in the type system.
Implementations§
Source§impl<E: InferenceEngine> InferenceSession<E>
impl<E: InferenceEngine> InferenceSession<E>
pub fn new( id: SessionId, config: SessionConfig, engine: E, permit: LoadPermit, ) -> Self
pub fn phase(&self) -> Phase
pub fn output(&self) -> &[Token] ⓘ
pub fn kv_len(&self) -> u32
pub fn config(&self) -> &SessionConfig
Sourcepub fn permit(&self) -> LoadPermit
pub fn permit(&self) -> LoadPermit
The load permit this session was constructed with — evidence the model passed the provenance gate (ADR-006).
Sourcepub fn drain_events(&mut self) -> Vec<EventEnvelope>
pub fn drain_events(&mut self) -> Vec<EventEnvelope>
Take the buffered domain events (a real build would stream these to the Telemetry subscriber).
Sourcepub fn load_prompt(&mut self, ports: &Ports, prompt: &[Token]) -> Result<()>
pub fn load_prompt(&mut self, ports: &Ports, prompt: &[Token]) -> Result<()>
Compress (optional) → prefill → build KV. Valid only from Initialized.
Sourcepub fn generate(&mut self, ports: &Ports, max_tokens: u32) -> Result<StopReason>
pub fn generate(&mut self, ports: &Ports, max_tokens: u32) -> Result<StopReason>
Run the decode loop until EOS or max_tokens. Each step composes
collaborators in the invariant order: grammar mask → safety adjust →
sample → commit.
Sourcepub fn consult_relay(
&mut self,
ports: &Ports,
query: &[Token],
) -> Result<Vec<Token>>
pub fn consult_relay( &mut self, ports: &Ports, query: &[Token], ) -> Result<Vec<Token>>
Consult the opt-in LAN relay. Hard-fails with EdgeError::AirGapViolation
unless hybrid_mode is enabled AND a relay is wired (ADR-004).