pub struct Driver { /* private fields */ }Expand description
An algorithm’s handle for requesting external work and awaiting the host’s typed replies.
Implementations§
Source§impl Driver
impl Driver
Sourcepub async fn call_model(
&self,
request: Request,
models: Vec<ModelId>,
) -> Result<Response>
pub async fn call_model( &self, request: Request, models: Vec<ModelId>, ) -> Result<Response>
Publish a model call and await the consumer’s response.
Errors if the stream is closed or the call failed.
The await is wrapped in a libsy.llm_call span measuring fulfillment as
the algorithm observes it (host queueing/serving included; a streamed
response resolves when its stream handle arrives). The host records call metrics
through CallModel::respond or CallModel::fail; outcome and token usage
are recorded on the span when the promise resolves. The provider call itself is the
host’s, and is instrumented by whoever makes it.
Sourcepub async fn call_decision(
&self,
request: DecisionRequest,
model: ModelId,
) -> Result<DecisionResponse>
pub async fn call_decision( &self, request: DecisionRequest, model: ModelId, ) -> Result<DecisionResponse>
Override the request’s model with model and wait for the host to reply.
Sourcepub fn models_for(&self, category: &Category) -> &[ModelId]
pub fn models_for(&self, category: &Category) -> &[ModelId]
The available models for this category, typically ordered best-first.
Sourcepub fn first_model_for(&self, category: &Category) -> Result<&ModelId>
pub fn first_model_for(&self, category: &Category) -> Result<&ModelId>
The first available model for category.
Sourcepub fn for_subagent(&self) -> Result<Self>
pub fn for_subagent(&self) -> Result<Self>
A driver scoped to delegated sub-agent work: its categories are the sub-agent’s own, and the parent’s are no longer reachable through it.