Skip to main content

Crate veil_sdk

Crate veil_sdk 

Source
Expand description

§veil-sdk

Rust client for the Mugen Veil verifiable inference gateway.

§Quick start

use veil_sdk::VeilClient;

#[tokio::main]
async fn main() -> veil_sdk::error::Result<()> {
    let client = VeilClient::builder()
        .base_url("http://localhost:8080")
        .build()?;

    // High-level: submit + wait
    let result = client
        .verify_inference("tiny_mlp_v1", vec![vec![0.1, 0.2, 0.3, 0.4]])
        .await?;

    println!("status:          {}", result.status);
    println!("tx_hash:         {:?}", result.tx_hash);
    println!("attestation:     {:?}", result.attestation_hash);
    println!("elapsed:         {}ms", result.elapsed_ms);
    Ok(())
}

§Primitives

For finer control, use the primitive methods directly:

use veil_sdk::VeilClient;

#[tokio::main]
async fn main() -> veil_sdk::error::Result<()> {
    let client = VeilClient::builder()
        .base_url("http://localhost:8080")
        .build()?;

    // Health check
    let health = client.health_check().await?;
    assert!(health.is_healthy());

    // Submit and poll manually
    let job_id = client
        .submit_job("tiny_mlp_v1", vec![vec![0.5, 0.3, 0.8, 0.1]])
        .await?;

    loop {
        let job = client.get_job(&job_id).await?;
        if job.status.is_terminal() { break; }
        tokio::time::sleep(std::time::Duration::from_secs(2)).await;
    }

    // Fetch raw proof bytes
    let proof = client.get_proof(&job_id).await?;
    println!("proof size: {} bytes", proof.size_bytes);
    Ok(())
}

Re-exports§

pub use client::VeilClient;
pub use client::VeilClientBuilder;
pub use error::Result;
pub use error::VeilError;
pub use types::Health;
pub use types::Job;
pub use types::JobStatus;
pub use types::Proof;
pub use types::RegisterModelRequest;
pub use types::RegisterModelResponse;
pub use types::VerifyResult;

Modules§

client
error
types