pub struct OutputPolicy { /* private fields */ }Expand description
Complete output behavior for one agent.
Implementations§
Source§impl OutputPolicy
impl OutputPolicy
Sourcepub fn structured(schema: OutputSchema) -> Self
pub fn structured(schema: OutputSchema) -> Self
Create a policy with a structured output schema.
Sourcepub fn typed<T>() -> Selfwhere
T: JsonSchema,
pub fn typed<T>() -> Selfwhere
T: JsonSchema,
Create a structured output policy from a Rust type.
Sourcepub fn typed_named<T>(name: impl Into<String>) -> Selfwhere
T: JsonSchema,
pub fn typed_named<T>(name: impl Into<String>) -> Selfwhere
T: JsonSchema,
Create a named structured output policy from a Rust type.
Sourcepub fn auto(schema: OutputSchema) -> Self
pub fn auto(schema: OutputSchema) -> Self
Create an auto-selected structured output policy.
Sourcepub fn native_json_schema(schema: OutputSchema) -> Self
pub fn native_json_schema(schema: OutputSchema) -> Self
Create a provider-native JSON schema output policy.
Sourcepub fn native_json_object(schema: OutputSchema) -> Self
pub fn native_json_object(schema: OutputSchema) -> Self
Create a provider-native JSON object output policy.
Sourcepub fn tool(schema: OutputSchema) -> Self
pub fn tool(schema: OutputSchema) -> Self
Create a tool-call structured output policy.
Sourcepub fn tool_or_text(schema: OutputSchema) -> Self
pub fn tool_or_text(schema: OutputSchema) -> Self
Create a tool-call structured output policy with text fallback.
Sourcepub fn prompted(schema: OutputSchema) -> Self
pub fn prompted(schema: OutputSchema) -> Self
Create a prompted structured output policy.
Sourcepub fn with_schema(self, schema: OutputSchema) -> Self
pub fn with_schema(self, schema: OutputSchema) -> Self
Attach a structured output schema.
Sourcepub const fn with_mode(self, mode: OutputMode) -> Self
pub const fn with_mode(self, mode: OutputMode) -> Self
Select output mode for request preparation.
Sourcepub const fn allow_text_output(self, allow: bool) -> Self
pub const fn allow_text_output(self, allow: bool) -> Self
Configure whether text output is allowed.
Sourcepub const fn allow_image_output(self, allow: bool) -> Self
pub const fn allow_image_output(self, allow: bool) -> Self
Configure whether image output is allowed.
Sourcepub fn with_validator(self, validator: Arc<dyn OutputValidator>) -> Self
pub fn with_validator(self, validator: Arc<dyn OutputValidator>) -> Self
Attach a validator.
Sourcepub fn with_function(self, function: DynOutputFunction) -> Self
pub fn with_function(self, function: DynOutputFunction) -> Self
Attach an output function.
Sourcepub const fn with_retries(self, retries: usize) -> Self
pub const fn with_retries(self, retries: usize) -> Self
Set output retry budget.
Sourcepub const fn schema(&self) -> Option<&OutputSchema>
pub const fn schema(&self) -> Option<&OutputSchema>
Return configured schema.
Sourcepub fn validators(&self) -> &[Arc<dyn OutputValidator>]
pub fn validators(&self) -> &[Arc<dyn OutputValidator>]
Return configured validators.
Sourcepub fn functions(&self) -> &[DynOutputFunction] ⓘ
pub fn functions(&self) -> &[DynOutputFunction] ⓘ
Return configured output functions.
Sourcepub const fn mode(&self) -> Option<OutputMode>
pub const fn mode(&self) -> Option<OutputMode>
Return configured output mode.
Sourcepub const fn text_output_allowed(&self) -> Option<bool>
pub const fn text_output_allowed(&self) -> Option<bool>
Return configured text-output allowance.
Sourcepub const fn image_output_allowed(&self) -> Option<bool>
pub const fn image_output_allowed(&self) -> Option<bool>
Return configured image-output allowance.
Trait Implementations§
Source§impl Clone for OutputPolicy
impl Clone for OutputPolicy
Source§fn clone(&self) -> OutputPolicy
fn clone(&self) -> OutputPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more