rice-sdk 0.1.2

Rust sdk for interacting with Rice
Documentation
use dotenv::dotenv;
use rice::rice_core::config;
use rice::{Client, RiceConfig};
use std::env;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    dotenv().ok();

    let mut config = RiceConfig::default();

    // Setup Storage Config from Environment
    if let Ok(storage_url) = env::var("STORAGE_INSTANCE_URL") {
        println!("Configuring Storage with URL: {}", storage_url);
        let token = env::var("STORAGE_AUTH_TOKEN").ok();
        config.storage = Some(config::StorageConfig {
            enabled: true,
            base_url: Some(storage_url),
            auth_token: token,
            username: env::var("STORAGE_USER").ok(),
            password: None,
        });
    }

    // Setup State Config from Environment
    if let Ok(state_url) = env::var("STATE_INSTANCE_URL") {
        println!("Configuring State with URL: {}", state_url);
        let token = env::var("STATE_AUTH_TOKEN").ok();
        config.state = Some(config::StateConfig {
            enabled: true,
            base_url: Some(state_url),
            auth_token: token,
            llm_mode: None,
            flux: None,
        });
    }

    println!("Connecting to Rice...");
    let mut client = Client::new(config).await?;
    println!("Client created successfully!");

    if let Some(mut storage) = client.storage {
        println!("Checking Storage Health...");
        match storage.health().await {
            Ok(resp) => println!(
                "Storage Health: status={}, version={}",
                resp.status, resp.version
            ),
            Err(e) => eprintln!("Storage Health Check Failed: {}", e),
        }
    } else {
        println!("Storage not enabled.");
    }

    Ok(())
}