pub struct RoutingCandidate(/* private fields */);Expand description
A model or nested router with optional evidence for strategies (RoutingCandidate).
Immutable; clones are the same candidate, and candidates compare by identity, as strategies must return one of the configured instances.
use strands::models::routing::{RoutingCandidate, RoutingCandidateOptions};
use strands::testing::MockModel;
let candidate = RoutingCandidate::new(
RoutingCandidateOptions::new(MockModel::new())
.with_name("fast")
.with_description("Short factual requests"),
);
assert_eq!(candidate.name(), Some("fast"));
assert_eq!(candidate, candidate.clone());Implementations§
Source§impl RoutingCandidate
impl RoutingCandidate
Sourcepub fn new(options: RoutingCandidateOptions) -> Self
pub fn new(options: RoutingCandidateOptions) -> Self
A candidate from its options.
Sourcepub fn model(&self) -> &CandidateModel
pub fn model(&self) -> &CandidateModel
The model or nested router.
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
The strategy-facing description.
Sourcepub fn metadata(&self) -> Option<&JsonObject>
pub fn metadata(&self) -> Option<&JsonObject>
The strategy-facing evidence.
Trait Implementations§
Source§impl Clone for RoutingCandidate
impl Clone for RoutingCandidate
Source§impl Debug for RoutingCandidate
impl Debug for RoutingCandidate
impl Eq for RoutingCandidate
Source§impl From<CandidateModel> for RoutingCandidate
impl From<CandidateModel> for RoutingCandidate
Source§fn from(model: CandidateModel) -> Self
fn from(model: CandidateModel) -> Self
Converts to this type from the input type.
Source§impl<M: Model> From<M> for RoutingCandidate
impl<M: Model> From<M> for RoutingCandidate
Source§impl From<ModelRouter> for RoutingCandidate
impl From<ModelRouter> for RoutingCandidate
Source§fn from(router: ModelRouter) -> Self
fn from(router: ModelRouter) -> Self
Converts to this type from the input type.
Source§impl From<RoutingCandidateOptions> for RoutingCandidate
impl From<RoutingCandidateOptions> for RoutingCandidate
Source§fn from(options: RoutingCandidateOptions) -> Self
fn from(options: RoutingCandidateOptions) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for RoutingCandidate
impl !UnwindSafe for RoutingCandidate
impl Freeze for RoutingCandidate
impl Send for RoutingCandidate
impl Sync for RoutingCandidate
impl Unpin for RoutingCandidate
impl UnsafeUnpin for RoutingCandidate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.