pub struct ContextPolicyChain {
pub policies: Vec<ContextPolicy>,
}Expand description
A chain of context policies applied in combination.
Fields§
§policies: Vec<ContextPolicy>The ordered list of policies in this chain.
Implementations§
Source§impl ContextPolicyChain
impl ContextPolicyChain
Sourcepub fn apply(&self, history: &[Content]) -> Vec<Content>
pub fn apply(&self, history: &[Content]) -> Vec<Content>
Apply all policies in sequence, piping each policy’s output into the
next. For C::window(10) + C::user_only() this means “take the last 10
turns, then keep only the user turns” — the additive + composes the
transforms rather than unioning their independent results.
Sourcepub fn into_middleware(self) -> Arc<dyn Middleware>
pub fn into_middleware(self) -> Arc<dyn Middleware>
Adapt this policy chain into a transform_request middleware layer that
rewrites the request’s conversation history before it reaches the model.
Trait Implementations§
Source§impl Add<ContextPolicy> for ContextPolicyChain
impl Add<ContextPolicy> for ContextPolicyChain
Source§type Output = ContextPolicyChain
type Output = ContextPolicyChain
The resulting type after applying the
+ operator.Source§impl Clone for ContextPolicyChain
impl Clone for ContextPolicyChain
Source§fn clone(&self) -> ContextPolicyChain
fn clone(&self) -> ContextPolicyChain
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl From<ContextPolicy> for ContextPolicyChain
A single policy is a one-element chain, so .context(C::window(10)) works
without an explicit +.
impl From<ContextPolicy> for ContextPolicyChain
A single policy is a one-element chain, so .context(C::window(10)) works
without an explicit +.
Source§fn from(policy: ContextPolicy) -> Self
fn from(policy: ContextPolicy) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ContextPolicyChain
impl !RefUnwindSafe for ContextPolicyChain
impl Send for ContextPolicyChain
impl Sync for ContextPolicyChain
impl Unpin for ContextPolicyChain
impl !UnwindSafe for ContextPolicyChain
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