#[non_exhaustive]pub struct ProcessorContext<'a> {
pub turn_id: &'a TurnId,
pub round_id: RoundId,
pub declaration_order: &'a [BlockId],
pub control: &'a CallControl,
pub tools: &'a [ToolDescription],
pub data: Option<&'a ProcessorData>,
}Expand description
Context made available to tool batch processors.
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.turn_id: &'a TurnIdTurn identity for the active tool batch.
round_id: RoundIdModel round that declared this batch.
declaration_order: &'a [BlockId]Original declaration order, represented by stable block IDs. The batch’s own entry order changes as results are resolved; this does not.
control: &'a CallControlCooperative cancellation and deadline control.
tools: &'a [ToolDescription]The tools bound for this batch, in offer order, with their declared
hints. The reference executor fixes them when it binds, so they stay
the same for every processor of the batch. Empty unless set with
ProcessorContext::with_tools.
data: Option<&'a ProcessorData>The host’s data for this run, passed through unchanged. None unless
set with ProcessorContext::with_data.
Implementations§
Source§impl<'a> ProcessorContext<'a>
impl<'a> ProcessorContext<'a>
Sourcepub fn new(
turn_id: &'a TurnId,
round_id: RoundId,
declaration_order: &'a [BlockId],
control: &'a CallControl,
) -> Self
pub fn new( turn_id: &'a TurnId, round_id: RoundId, declaration_order: &'a [BlockId], control: &'a CallControl, ) -> Self
The context one processor run sees, with no bound tools and no host data.
Sourcepub fn with_tools(self, tools: &'a [ToolDescription]) -> Self
pub fn with_tools(self, tools: &'a [ToolDescription]) -> Self
Sets the bound tools and their hints.
Sourcepub fn with_data(self, data: &'a ProcessorData) -> Self
pub fn with_data(self, data: &'a ProcessorData) -> Self
Sets the host’s data for this run.
Sourcepub fn hints(&self, name: &str) -> Option<&'a ToolHints>
pub fn hints(&self, name: &str) -> Option<&'a ToolHints>
The declared hints of the bound tool named name, or None when no
bound tool has that name. The reference executor rejects calls to
unbound names before the first processor runs, so every pending call
it hands to a processor resolves here.