#[non_exhaustive]pub struct InvokeModelContext {
pub agent: ToolAgent,
pub model: Arc<dyn Model>,
pub messages: Vec<Message>,
pub system_prompt: Option<SystemPrompt>,
pub tool_specs: Vec<ToolSpec>,
pub tool_choice: Option<ToolChoice>,
pub invocation_state: InvocationState,
pub projected_input_tokens: Option<u64>,
pub dynamic_trailing_blocks: Option<usize>,
pub structured_output_schema: Option<JsonSchema>,
pub deferred_tools: HashSet<String>,
pub invocation_context: Option<InvocationContext>,
}Expand description
What model-stage handlers receive (InvokeModelContext). Collections are copies of the
agent’s; invocation_state is shared with hooks, tools and the result.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.agent: ToolAgentThe agent, as tools see it (an escape hatch).
model: Arc<dyn Model>The model this call invokes; initialized from the agent’s and replaceable per call.
messages: Vec<Message>The messages to send.
system_prompt: Option<SystemPrompt>The system prompt.
tool_specs: Vec<ToolSpec>The tool specs the model may use.
tool_choice: Option<ToolChoice>How the model selects tools.
invocation_state: InvocationStatePer-invocation state, shared.
projected_input_tokens: Option<u64>The estimated input tokens of this call, when estimation succeeded.
dynamic_trailing_blocks: Option<usize>How many trailing blocks of the last user message are rebuilt on every call; producers add to it.
structured_output_schema: Option<JsonSchema>The schema this call must produce, set on the structured output retry.
deferred_tools: HashSet<String>Names of the tools this call defers, set by deferred tool loading and passed to the
provider in ModelRequest::deferred_tools.
invocation_context: Option<InvocationContext>The request this call belongs to.
Trait Implementations§
Source§impl Clone for InvokeModelContext
impl Clone for InvokeModelContext
Auto Trait Implementations§
impl !RefUnwindSafe for InvokeModelContext
impl !UnwindSafe for InvokeModelContext
impl Freeze for InvokeModelContext
impl Send for InvokeModelContext
impl Sync for InvokeModelContext
impl Unpin for InvokeModelContext
impl UnsafeUnpin for InvokeModelContext
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
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> ⓘ
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> ⓘ
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