Rust API Reference¶
Rust API for StrataRouter Runtime.
Installation¶
Quick Start¶
use stratarouter_runtime::{CoreRuntimeBridge, RuntimeConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = RuntimeConfig::default();
let bridge = CoreRuntimeBridge::new(config)?;
let result = bridge.execute("My invoice?", None).await?;
println!("Response: {}", result.response);
Ok(())
}
Core Types¶
CoreRuntimeBridge¶
pub struct CoreRuntimeBridge {
config: RuntimeConfig,
}
impl CoreRuntimeBridge {
pub fn new(config: RuntimeConfig) -> Result<Self>;
pub async fn execute(&self, query: &str, context: Option<Context>) -> Result<ExecutionResult>;
}
RuntimeConfig¶
pub struct RuntimeConfig {
pub execution_timeout: u64,
pub max_retries: u32,
pub cache_enabled: bool,
pub batch_enabled: bool,
}
ExecutionResult¶
pub struct ExecutionResult {
pub response: String,
pub route_id: String,
pub confidence: f32,
pub latency_ms: f64,
pub cost_usd: f64,
}