pub struct ModelRequest {
pub model: ModelRef,
pub messages: Vec<Message>,
pub tools: Vec<ToolSpec>,
pub tool_choice: ToolChoice,
pub output_format: OutputFormat,
pub generation: GenerationOptions,
pub feature_policy: FeaturePolicy,
pub provider_options: BTreeMap<String, Value>,
pub metadata: ExtensionMap,
}Expand description
A complete provider-neutral model request.
Fields§
§model: ModelRefSelected model.
messages: Vec<Message>Ordered conversation messages.
tools: Vec<ToolSpec>Model-facing tools.
tool_choice: ToolChoiceTool-selection behavior.
output_format: OutputFormatDesired final-output format.
generation: GenerationOptionsCommon generation options.
feature_policy: FeaturePolicyFeature-degradation behavior.
provider_options: BTreeMap<String, Value>Typed adapters serialize options into their provider namespace.
metadata: ExtensionMapHost-only namespaced metadata.
Implementations§
Source§impl ModelRequest
impl ModelRequest
Sourcepub fn new(model: ModelRef, message: Message) -> Self
pub fn new(model: ModelRef, message: Message) -> Self
Creates a request with one initial message.
Sourcepub fn output_format(self, output_format: OutputFormat) -> Self
pub fn output_format(self, output_format: OutputFormat) -> Self
Sets the desired output format.
Sourcepub fn structured_output<T>(self, name: impl Into<String>) -> Selfwhere
T: JsonSchema,
pub fn structured_output<T>(self, name: impl Into<String>) -> Selfwhere
T: JsonSchema,
Requests strict structured output described by the Rust type T.
Sourcepub const fn feature_policy(self, feature_policy: FeaturePolicy) -> Self
pub const fn feature_policy(self, feature_policy: FeaturePolicy) -> Self
Sets the feature-degradation policy.
Trait Implementations§
Source§impl Clone for ModelRequest
impl Clone for ModelRequest
Source§fn clone(&self) -> ModelRequest
fn clone(&self) -> ModelRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelRequest
impl Debug for ModelRequest
Source§impl<'de> Deserialize<'de> for ModelRequest
impl<'de> Deserialize<'de> for ModelRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 PartialEq for ModelRequest
impl PartialEq for ModelRequest
Source§impl Serialize for ModelRequest
impl Serialize for ModelRequest
impl StructuralPartialEq for ModelRequest
Auto Trait Implementations§
impl Freeze for ModelRequest
impl RefUnwindSafe for ModelRequest
impl Send for ModelRequest
impl Sync for ModelRequest
impl Unpin for ModelRequest
impl UnsafeUnpin for ModelRequest
impl UnwindSafe for ModelRequest
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
Mutably borrows from an owned value. Read more