pub struct Dispatch { /* private fields */ }Implementations§
Source§impl Dispatch
impl Dispatch
Sourcepub fn new(license: Option<String>) -> Self
pub fn new(license: Option<String>) -> Self
license: your wv_... key, or None to read WAVE_LICENSE (omit for x402 pay-per-use).
Sourcepub fn with_payment_hook(self, hook: PaymentHook) -> Self
pub fn with_payment_hook(self, hook: PaymentHook) -> Self
0.5.1 — attach a payment hook so 402 challenges are handled inside the client (signs + retries
in one .route() call). See Dispatch::wallet_hook for the built-in factory.
Sourcepub fn route(&self, prompt: &str) -> Result<Value, Box<dyn Error>>
pub fn route(&self, prompt: &str) -> Result<Value, Box<dyn Error>>
Classify a prompt (no execution): {route, probability, margin, forward}.
Sourcepub fn route_with_profile(
&self,
prompt: &str,
profile: &str,
) -> Result<Value, Box<dyn Error>>
pub fn route_with_profile( &self, prompt: &str, profile: &str, ) -> Result<Value, Box<dyn Error>>
Sovereign tier (D3): classify a prompt under a named routing profile (Fast|Expert|Heavy|
Code). Rust has no default args, so this is a sibling of [route] rather than an optional
param; profile is the snake_case cross-SDK contract field the edge resolveProfile() honors.
Sourcepub fn execute(&self, prompt: &str) -> Result<Value, Box<dyn Error>>
pub fn execute(&self, prompt: &str) -> Result<Value, Box<dyn Error>>
Classify and run on the edge if your plan allows it.
Sourcepub fn execute_with_profile(
&self,
prompt: &str,
profile: &str,
) -> Result<Value, Box<dyn Error>>
pub fn execute_with_profile( &self, prompt: &str, profile: &str, ) -> Result<Value, Box<dyn Error>>
Execute under a named routing profile (Sovereign tier; see [route_with_profile]).
Sourcepub fn route_vector(&self, vector: &[f32]) -> Result<Value, Box<dyn Error>>
pub fn route_vector(&self, vector: &[f32]) -> Result<Value, Box<dyn Error>>
Classify a pre-computed 768-d embedding (matmul-only: cheapest + fastest).
Sourcepub fn savings(&self) -> Result<Value, Box<dyn Error>>
pub fn savings(&self) -> Result<Value, Box<dyn Error>>
This license’s savings ledger (decisions, saved_usd, saved_pct, …). Requires a license.
Sourcepub fn subscription(&self) -> Result<Value, Box<dyn Error>>
pub fn subscription(&self) -> Result<Value, Box<dyn Error>>
This license’s agent-subscription status.
Sourcepub fn subscribe(&self, plan: &str) -> Result<Value, Box<dyn Error>>
pub fn subscribe(&self, plan: &str) -> Result<Value, Box<dyn Error>>
Start/replace a programmatic subscription (plan: agent_starter|agent_pro|agent_scale).
Sourcepub fn wallet_hook(
provider: &str,
credentials: HashMap<String, String>,
) -> Result<PaymentHook, Box<dyn Error>>
pub fn wallet_hook( provider: &str, credentials: HashMap<String, String>, ) -> Result<PaymentHook, Box<dyn Error>>
0.5.1 — Build a PaymentHook that signs each 402 challenge via a wallet provider.
provider: "cdp" | "privy" | "bridge". For custom wallets, build your own
closure and pass it to with_payment_hook directly.
credentials: provider-specific. CDP: {api_key, api_secret, address}. Privy: {app_id, app_secret, wallet_id}. Bridge: {api_key, source_wallet, destination?}.