| Crates.io | qwed |
| lib.rs | qwed |
| version | 1.0.0 |
| created_at | 2025-12-31 21:28:19.758085+00 |
| updated_at | 2025-12-31 21:28:19.758085+00 |
| description | Rust SDK for QWED Verification Protocol |
| homepage | |
| repository | https://github.com/QWED-AI/qwed-verification |
| max_upload_size | |
| id | 2015409 |
| size | 53,957 |
Rust SDK for QWED Verification Protocol
Add to your Cargo.toml:
[dependencies]
qwed = "1.0"
tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] }
use qwed::QWEDClient;
#[tokio::main]
async fn main() -> Result<(), qwed::Error> {
let client = QWEDClient::new("qwed_your_api_key");
let result = client.verify("What is 2+2?").await?;
println!("Verified: {}", result.verified); // true
println!("Status: {:?}", result.status); // Verified
Ok(())
}
let result = client.verify("Is 15% of 200 equal to 30?").await?;
let result = client.verify_math("x**2 + 2*x + 1 = (x+1)**2").await?;
let result = client.verify_logic("(AND (GT x 5) (LT y 10))").await?;
// result.result["satisfiability"] = "SAT"
let result = client.verify_code(r#"
import os
os.system('rm -rf /')
"#, "python").await?;
let result = client.verify_fact(
"Paris is the capital of France",
"France is a country in Europe. Its capital city is Paris.",
).await?;
let result = client.verify_sql(
"SELECT * FROM users WHERE id = 1",
"CREATE TABLE users (id INT PRIMARY KEY, name TEXT)",
"postgresql",
).await?;
use qwed::{BatchItem, VerificationType};
let items = vec![
BatchItem { query: "2+2=4".into(), r#type: Some(VerificationType::Math) },
BatchItem { query: "3*3=9".into(), r#type: Some(VerificationType::Math) },
];
let result = client.verify_batch(items).await?;
if let Some(summary) = result.summary {
println!("Success rate: {:.1}%", summary.success_rate);
}
use std::time::Duration;
let client = QWEDClient::with_options(
"qwed_...",
"https://api.qwed.ai",
Duration::from_secs(60),
);
use qwed::{QWEDClient, Error};
match client.verify("test").await {
Ok(result) => println!("Verified: {}", result.verified),
Err(Error::Auth) => eprintln!("Invalid API key"),
Err(Error::RateLimit) => eprintln!("Rate limit exceeded"),
Err(Error::Api { code, message }) => eprintln!("Error {}: {}", code, message),
Err(e) => eprintln!("Error: {}", e),
}
| Type | Description |
|---|---|
VerificationType |
Enum: Math, Logic, Stats, Fact, Code, Sql, etc. |
VerificationStatus |
Enum: Verified, Failed, Corrected, Blocked, etc. |
VerificationResponse |
Full verification result |
BatchResponse |
Batch operation result |
Error |
Error enum with Auth, RateLimit, Api variants |
This crate requires tokio as the async runtime:
#[tokio::main]
async fn main() {
// ...
}
Apache 2.0