pub struct ModelCallContext { /* private fields */ }Expand description
Execution scope for one model invocation.
It deliberately carries lifecycle data rather than provider configuration. Adapters must observe cancellation and should translate the deadline into their transport’s timeout mechanism.
Implementations§
Source§impl ModelCallContext
impl ModelCallContext
Sourcepub fn for_run(run: &RunContext) -> Self
pub fn for_run(run: &RunContext) -> Self
Creates an invocation scoped beneath a run.
Sourcepub const fn invocation_id(&self) -> InvocationId
pub const fn invocation_id(&self) -> InvocationId
Returns this model invocation’s identity.
Sourcepub const fn run_id(&self) -> Option<RunId>
pub const fn run_id(&self) -> Option<RunId>
Returns the owning run identity, when invoked inside a run.
Sourcepub const fn cancellation(&self) -> &CancellationToken
pub const fn cancellation(&self) -> &CancellationToken
Returns the invocation’s hierarchical cancellation token.
Sourcepub fn with_deadline(self, deadline: Instant) -> Self
pub fn with_deadline(self, deadline: Instant) -> Self
Sets a deadline, retaining an existing earlier deadline.
Sourcepub fn with_cancellation(self, cancellation: &CancellationToken) -> Self
pub fn with_cancellation(self, cancellation: &CancellationToken) -> Self
Replaces the cancellation root for an externally scoped invocation.
The invocation receives a child token so provider attempts cannot cancel their caller’s broader operation.
Sourcepub fn child_attempt(&self) -> Self
pub fn child_attempt(&self) -> Self
Creates a distinct provider-attempt context under the same logical invocation scope.
The attempt receives a new invocation identity while inheriting the run, effective deadline, and hierarchical cancellation.
Trait Implementations§
Source§impl Clone for ModelCallContext
impl Clone for ModelCallContext
Source§fn clone(&self) -> ModelCallContext
fn clone(&self) -> ModelCallContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more