pub struct ProviderRequest {
pub messages: Vec<Message>,
pub system_prompt: String,
pub tools: Vec<ToolSchema>,
pub model: String,
pub max_tokens: u32,
pub temperature: Option<f64>,
pub enable_caching: bool,
pub tool_choice: ToolChoice,
pub metadata: Option<Value>,
pub cancel: CancellationToken,
}Expand description
A provider-agnostic request.
Fields§
§messages: Vec<Message>§system_prompt: String§tools: Vec<ToolSchema>§model: String§max_tokens: u32§temperature: Option<f64>§enable_caching: bool§tool_choice: ToolChoiceControls whether/how the model should use tools.
metadata: Option<Value>Metadata to send with the request (e.g., user_id for Anthropic).
cancel: CancellationTokenCancellation token for interrupting the in-flight streaming HTTP read.
Providers must race byte_stream.next().await against
cancel.cancelled() so that the spawned streaming task exits
promptly when the user presses Escape or Ctrl+C. Background callers
(memory extraction, consolidation) can pass CancellationToken::new()
for an uncancellable request.
Auto Trait Implementations§
impl Freeze for ProviderRequest
impl RefUnwindSafe for ProviderRequest
impl Send for ProviderRequest
impl Sync for ProviderRequest
impl Unpin for ProviderRequest
impl UnsafeUnpin for ProviderRequest
impl UnwindSafe for ProviderRequest
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