Interface IChatModelHost
The ref-counted chat-model host. One per AddOnnxChat registration.
public interface IChatModelHost
Properties
- IsAcceptingTurns
False between
MemoryPressure(Moderate)and the nextResumed.
Methods
- AcquireAsync(CancellationToken)
Awaits
IEdgeHost.EnsureStartedAsync, verifies provisioning, resolves the budget, loads on first call, and returns the exclusive lease.
- Describe()
What the host last knew about the model, or null if it has never loaded one.
- PreloadAsync(CancellationToken)
Everything AcquireAsync(CancellationToken) does except awaiting host startup, so an
IEdgeStartupTaskcan drive a load without deadlocking on its own completion. Public on purpose: sub-project 2 documents this exact hole as unclosable from L1 because its equivalent isinternalto another assembly. Sub-project 4's host and its warm-up task are in the same assembly, so sub-project 4 does not inherit it.
- TerminateActiveGeneration()
Sets a volatile abort flag AND calls
Generator.SetRuntimeOption("terminate_session", "1")on the live generator - the documented cooperative abort, and the only thing that can stop a multi-second prefill. Safe to call from a lifecycle observer on another thread; it is the one GenAI call sub-project 4 makes outside the turn gate, and section 20 records that as a stated risk.
- UnloadAsync(CancellationToken)
Marks the model for drop and disposes it once the lease returns.