pub struct Request<'a> {
pub model: &'a ModelId,
pub prompt: &'a Value,
pub max_output_tokens: u32,
pub reasoning_effort: Option<ReasoningEffort>,
pub schema: Option<&'a Value>,
pub tools: &'a [ToolDeclaration],
pub exchanges: &'a [ToolExchange],
pub continuation: Option<&'a ProviderContinuation>,
pub stream: Option<(&'a dyn ModelStreamObserver, &'a Label)>,
}Expand description
One request to a provider.
A struct rather than a widening argument list, because what a model call carries is the part of this seam most likely to grow — and every growth would otherwise be a breaking change to every driver.
Fields§
§model: &'a ModelId§prompt: &'a Value§max_output_tokens: u32Maximum tokens the provider may generate for this call.
Provider-neutral because both shipped APIs expose the same control, and per-call because a manifest declares it per model role. Keeping it on a driver silently discarded that declaration and kept the real request limit out of the effect key.
reasoning_effort: Option<ReasoningEffort>How much internal reasoning to request, when explicitly configured.
schema: Option<&'a Value>A JSON Schema the answer must conform to, if one was declared.
Passed straight through to the provider’s own structured-output mode —
text.format on OpenAI Responses, output_config.format on Anthropic —
where the constraint is enforced during generation rather than checked
afterwards. That is the whole reason to use it: a schema applied after
the fact rejects a bad answer you have already paid for.
tools: &'a [ToolDeclaration]The tools the model may ask for.
Empty means the model is told of none, which is not the same as being forbidden: authorization happens when a call comes back, against the operator’s grants. Declaring nothing simply gives it nothing to choose.
exchanges: &'a [ToolExchange]Tools already run this turn, and what they returned.
continuation: Option<&'a ProviderContinuation>Exact provider-native state emitted beside those tool calls.
stream: Option<(&'a dyn ModelStreamObserver, &'a Label)>Live observer. Not provider-visible and therefore not effect identity. Strict replay never calls it because replay never performs the provider.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Request<'a>
impl<'a> !UnwindSafe for Request<'a>
impl<'a> Freeze for Request<'a>
impl<'a> Send for Request<'a>
impl<'a> Sync for Request<'a>
impl<'a> Unpin for Request<'a>
impl<'a> UnsafeUnpin for Request<'a>
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,
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> ⓘ
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