Skip to main content

ModelRequestBuilder

Struct ModelRequestBuilder 

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

Fluent, fail-closed builder for ModelRequest.

Collection methods retain the first validation error and stop accepting further collection values, so fluent construction cannot grow beyond hard limits before Self::build reports the error.

Implementations§

Source§

impl ModelRequestBuilder

Source

pub fn instruction(self, instruction: Instruction) -> Self

Appends one ordered trusted instruction.

Source

pub fn message(self, message: Message) -> Self

Appends one ordered durable message.

Source

pub fn transcript(self, transcript: ModelTranscript) -> Self

Replaces the complete ordered prior model/tool transcript.

Source

pub fn tool(self, tool: ToolDescriptor) -> Self

Adds one tool descriptor under its registry-local name.

Source

pub fn tool_selection(self, selection: ModelToolSelection) -> Self

Sets tool-selection behavior.

Source

pub const fn max_tool_calls_per_response(self, maximum: ExecutionCount) -> Self

Sets the finite per-response tool-call ceiling.

Source

pub const fn strict_tool_arguments(self, required: bool) -> Self

Requires provider-constrained complete tool arguments.

Source

pub fn output_modalities(self, modalities: ModelModalities) -> Self

Replaces requested output modalities.

Source

pub fn text_output_format(self, format: Option<ModelTextOutputFormat>) -> Self

Sets text output format, or removes it for non-text-only output.

Source

pub const fn response_mode(self, mode: ModelResponseMode) -> Self

Selects complete or streaming response delivery.

Source

pub const fn reasoning_summaries(self, required: bool) -> Self

Requests or disables a readable provider reasoning summary.

Source

pub fn extensions(self, extensions: Extensions) -> Self

Replaces bounded registered extension values.

Source

pub fn build(self) -> Result<ModelRequest, ModelRequestError>

Validates cross-field invariants and derives normalized requirements.

§Errors

Returns ModelRequestError for the first resource, identity, modality, tool-control, output-format, or derived-requirement violation.

Trait Implementations§

Source§

impl Debug for ModelRequestBuilder

Source§

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

Formats the value using the given formatter. Read more

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> 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, 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.