Skip to main content

ModelRequest

Struct ModelRequest 

Source
pub struct ModelRequest { /* private fields */ }
Expand description

Immutable, fully normalized request passed to a model adapter.

Construction derives input modalities and every provider-neutral capability requirement from the supplied content and controls. Adapters must validate registered extensions and referenced schemas before provider I/O; unsupported extensions are errors and are never silently dropped. Provider-side history, automatic truncation, storage, background execution, and multi-candidate generation are intentionally outside this durable core request.

Structural validation does not authenticate serialized instruction owners or tool descriptors. Public protocol/API adapters must resolve those values from an authenticated tenant registry instead of accepting caller-supplied claims.

Implementations§

Source§

impl ModelRequest

Source

pub const MAX_TOOL_DEFINITIONS: ExecutionCount

Maximum tool definitions accepted by one provider-neutral request.

Source

pub const MAX_TOOL_CALLS_PER_RESPONSE: ExecutionCount

Maximum tool calls accepted from one model response.

Source

pub fn builder(limits: ModelRequestLimits) -> ModelRequestBuilder

Starts a bounded request builder with explicit finite limits.

Source

pub fn instructions(&self) -> &[Instruction]

Returns ordered application-owned instructions.

Source

pub fn messages(&self) -> &[Message]

Returns ordered durable conversation messages.

Source

pub const fn transcript(&self) -> &ModelTranscript

Returns ordered durable prior model/tool turns.

Source

pub fn tools(&self) -> impl ExactSizeIterator<Item = &ToolDescriptor>

Iterates available tool descriptors in canonical name order.

Source

pub fn tool(&self, name: &CapabilityName) -> Option<&ToolDescriptor>

Returns one available tool by registry-local name.

Source

pub const fn tool_selection(&self) -> &ModelToolSelection

Returns the requested tool-selection behavior.

Source

pub const fn max_tool_calls_per_response(&self) -> ExecutionCount

Returns the finite tool-call ceiling for one response.

Source

pub const fn requires_strict_tool_arguments(&self) -> bool

Returns whether every complete tool argument must be provider-constrained.

Source

pub const fn output_modalities(&self) -> &ModelModalities

Returns requested output modalities.

Source

pub const fn text_output_format(&self) -> Option<&ModelTextOutputFormat>

Returns text output format, absent for non-text-only output.

Source

pub const fn response_mode(&self) -> ModelResponseMode

Returns complete or streaming response delivery.

Source

pub const fn requires_reasoning_summaries(&self) -> bool

Returns whether a readable provider reasoning summary was requested.

Source

pub const fn limits(&self) -> &ModelRequestLimits

Returns finite request limits.

Source

pub const fn extensions(&self) -> &Extensions

Returns bounded registered provider/adapter extension values.

Source

pub const fn requirements(&self) -> &ModelRequirements

Returns normalized requirements derived from this exact request.

Source

pub fn content_bytes(&self) -> ByteCount

Returns resolved instruction and message content bytes.

Trait Implementations§

Source§

impl Clone for ModelRequest

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModelRequest

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ModelRequest

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ModelRequest

Source§

impl JsonSchema for ModelRequest

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for ModelRequest

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ModelRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ModelRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.