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
impl ModelRequestBuilder
Sourcepub fn instruction(self, instruction: Instruction) -> Self
pub fn instruction(self, instruction: Instruction) -> Self
Appends one ordered trusted instruction.
Sourcepub fn transcript(self, transcript: ModelTranscript) -> Self
pub fn transcript(self, transcript: ModelTranscript) -> Self
Replaces the complete ordered prior model/tool transcript.
Sourcepub fn tool(self, tool: ToolDescriptor) -> Self
pub fn tool(self, tool: ToolDescriptor) -> Self
Adds one tool descriptor under its registry-local name.
Sourcepub fn tool_selection(self, selection: ModelToolSelection) -> Self
pub fn tool_selection(self, selection: ModelToolSelection) -> Self
Sets tool-selection behavior.
Sourcepub const fn max_tool_calls_per_response(self, maximum: ExecutionCount) -> Self
pub const fn max_tool_calls_per_response(self, maximum: ExecutionCount) -> Self
Sets the finite per-response tool-call ceiling.
Sourcepub const fn strict_tool_arguments(self, required: bool) -> Self
pub const fn strict_tool_arguments(self, required: bool) -> Self
Requires provider-constrained complete tool arguments.
Sourcepub fn output_modalities(self, modalities: ModelModalities) -> Self
pub fn output_modalities(self, modalities: ModelModalities) -> Self
Replaces requested output modalities.
Sourcepub fn text_output_format(self, format: Option<ModelTextOutputFormat>) -> Self
pub fn text_output_format(self, format: Option<ModelTextOutputFormat>) -> Self
Sets text output format, or removes it for non-text-only output.
Sourcepub const fn response_mode(self, mode: ModelResponseMode) -> Self
pub const fn response_mode(self, mode: ModelResponseMode) -> Self
Selects complete or streaming response delivery.
Sourcepub const fn reasoning_summaries(self, required: bool) -> Self
pub const fn reasoning_summaries(self, required: bool) -> Self
Requests or disables a readable provider reasoning summary.
Sourcepub fn extensions(self, extensions: Extensions) -> Self
pub fn extensions(self, extensions: Extensions) -> Self
Replaces bounded registered extension values.
Sourcepub fn build(self) -> Result<ModelRequest, ModelRequestError>
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.