pub struct ClientContext {
pub request_id: Uuid,
pub config: RequestContextConfig,
pub metadata: HashMap<String, String>,
pub deadline: Option<Instant>,
pub priority: u8,
}Expand description
Request context for client operations.
Provides request-scoped configuration overrides and metadata.
Fields§
§request_id: UuidUnique request ID for tracing.
config: RequestContextConfigRequest-specific configuration overrides.
metadata: HashMap<String, String>Request metadata (custom key-value pairs).
deadline: Option<Instant>Request deadline (for timeout).
priority: u8Priority (higher = more important).
Implementations§
Source§impl ClientContext
impl ClientContext
Sourcepub fn with_top_k(self, top_k: usize) -> Self
pub fn with_top_k(self, top_k: usize) -> Self
Set the top_k override for retrieval.
Sourcepub fn with_token_budget(self, budget: usize) -> Self
pub fn with_token_budget(self, budget: usize) -> Self
Set the token budget override.
Sourcepub fn with_content_format(self, format: OutputFormatConfig) -> Self
pub fn with_content_format(self, format: OutputFormatConfig) -> Self
Set the content format override.
Sourcepub fn with_summaries(self, include: bool) -> Self
pub fn with_summaries(self, include: bool) -> Self
Set whether to include summaries.
Sourcepub fn with_content(self, include: bool) -> Self
pub fn with_content(self, include: bool) -> Self
Set whether to include content.
Sourcepub fn with_cache(self, enable: bool) -> Self
pub fn with_cache(self, enable: bool) -> Self
Set whether to enable caching.
Sourcepub fn with_sufficiency_check(self, enable: bool) -> Self
pub fn with_sufficiency_check(self, enable: bool) -> Self
Set whether to enable sufficiency checking.
Sourcepub fn with_timeout(self, duration: Duration) -> Self
pub fn with_timeout(self, duration: Duration) -> Self
Set a timeout duration.
Sourcepub fn with_deadline(self, deadline: Instant) -> Self
pub fn with_deadline(self, deadline: Instant) -> Self
Set a deadline.
Sourcepub fn with_priority(self, priority: u8) -> Self
pub fn with_priority(self, priority: u8) -> Self
Set the priority (0-10, higher = more important).
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata.
Sourcepub fn is_timed_out(&self) -> bool
pub fn is_timed_out(&self) -> bool
Check if the request has timed out.
Sourcepub fn remaining_time(&self) -> Option<Duration>
pub fn remaining_time(&self) -> Option<Duration>
Get remaining time until deadline.
Sourcepub fn merge(&self, other: &ClientContext) -> ClientContext
pub fn merge(&self, other: &ClientContext) -> ClientContext
Merge with another context (other takes precedence).
Trait Implementations§
Source§impl Clone for ClientContext
impl Clone for ClientContext
Source§fn clone(&self) -> ClientContext
fn clone(&self) -> ClientContext
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 Debug for ClientContext
impl Debug for ClientContext
Auto Trait Implementations§
impl Freeze for ClientContext
impl RefUnwindSafe for ClientContext
impl Send for ClientContext
impl Sync for ClientContext
impl Unpin for ClientContext
impl UnsafeUnpin for ClientContext
impl UnwindSafe for ClientContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 more