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 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 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?}.