pub struct RoleRoutingProvider { /* private fields */ }Expand description
Construct it at the composition root (where the agent’s primary provider is
built) via RoleRoutingProvider::new, then hand it to Agent::new in
place of the raw provider.
Implementations§
Source§impl RoleRoutingProvider
impl RoleRoutingProvider
Sourcepub fn new(
default: Arc<dyn Provider>,
registry: Arc<RwLock<RawRwLock, RoleRegistry>>,
) -> RoleRoutingProvider
pub fn new( default: Arc<dyn Provider>, registry: Arc<RwLock<RawRwLock, RoleRegistry>>, ) -> RoleRoutingProvider
Wrap default. Role-selected models delegate to their own provider
(resolved via the global provider registry); anything else — including
an unset or unresolvable role — falls back to default with the
originally-requested model.
Sourcepub fn update_registry(&self, f: impl FnOnce(&mut RoleRegistry))
pub fn update_registry(&self, f: impl FnOnce(&mut RoleRegistry))
Mutate the live role registry (e.g. from the settings UI) so changes
apply to subsequent stream() calls without rewrapping the provider.
Sourcepub fn signals_from_request(
context: &Context,
options: &Option<StreamOptions>,
) -> RoleSignals<'static>
pub fn signals_from_request( context: &Context, options: &Option<StreamOptions>, ) -> RoleSignals<'static>
Build the role signals for a request from its context + options.
explicit_override and current_tool are not derivable from a
stream() call (there is no user pin or tool-execution context at the
LLM-call boundary), so they are left as None; the switching rests on
thinking, token count, and triviality.