#[non_exhaustive]pub struct RoutingContext {
pub messages: Vec<Message>,
pub system_prompt: Option<SystemPrompt>,
pub tool_specs: Vec<ToolSpec>,
pub candidates: Vec<RoutingCandidate>,
pub invocation_state: InvocationState,
pub attempts: Vec<RoutingAttempt>,
pub invocation_context: Option<InvocationContext>,
}Expand description
What a strategy reads to choose a candidate (RoutingContext): copies of the request, the
configured candidates and the attempts of this invocation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.messages: Vec<Message>A copy of the messages.
system_prompt: Option<SystemPrompt>A copy of the system prompt.
tool_specs: Vec<ToolSpec>A copy of the tool specs.
candidates: Vec<RoutingCandidate>The configured candidates; a strategy returns one of these.
invocation_state: InvocationStateThe caller’s invocation state.
attempts: Vec<RoutingAttempt>The attempts of this invocation, oldest first.
invocation_context: Option<InvocationContext>The request this decision runs for; a nested model call that joins it adds to its usage, but its limits do not apply.
Implementations§
Source§impl RoutingContext
impl RoutingContext
Sourcepub fn new(candidates: Vec<RoutingCandidate>) -> Self
pub fn new(candidates: Vec<RoutingCandidate>) -> Self
A context over candidates with an empty request and no attempts.
Sourcepub fn with_messages(self, messages: Vec<Message>) -> Self
pub fn with_messages(self, messages: Vec<Message>) -> Self
Sets the messages.
Sourcepub fn with_system_prompt(self, system_prompt: impl Into<SystemPrompt>) -> Self
pub fn with_system_prompt(self, system_prompt: impl Into<SystemPrompt>) -> Self
Sets the system prompt.
Sourcepub fn with_tool_specs(self, tool_specs: Vec<ToolSpec>) -> Self
pub fn with_tool_specs(self, tool_specs: Vec<ToolSpec>) -> Self
Sets the tool specs.
Sourcepub fn with_attempts(self, attempts: Vec<RoutingAttempt>) -> Self
pub fn with_attempts(self, attempts: Vec<RoutingAttempt>) -> Self
Sets the attempts.
Sourcepub fn with_invocation_state(self, invocation_state: InvocationState) -> Self
pub fn with_invocation_state(self, invocation_state: InvocationState) -> Self
Sets the invocation state.
Sourcepub fn with_invocation_context(
self,
invocation_context: Option<InvocationContext>,
) -> Self
pub fn with_invocation_context( self, invocation_context: Option<InvocationContext>, ) -> Self
Sets the request the decision runs for.
Trait Implementations§
Source§impl Clone for RoutingContext
impl Clone for RoutingContext
Auto Trait Implementations§
impl !RefUnwindSafe for RoutingContext
impl !UnwindSafe for RoutingContext
impl Freeze for RoutingContext
impl Send for RoutingContext
impl Sync for RoutingContext
impl Unpin for RoutingContext
impl UnsafeUnpin for RoutingContext
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<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.