#![allow(warnings)]
#![allow(clippy::unwrap_used, clippy::expect_used)]
#![allow(
clippy::absurd_extreme_comparisons,
clippy::nonminimal_bool,
clippy::overly_complex_bool_expr
)]
use vectorizer_sdk::rpc::{HelloPayload, RpcClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let url = std::env::var("VECTORIZER_URL")
.unwrap_or_else(|_| "vectorizer://127.0.0.1:15503".to_string());
println!("→ Dialing {url}");
let client = RpcClient::connect_url(&url).await?;
let hello = client.hello(HelloPayload::new("rpc-quickstart")).await?;
println!(
"✓ HELLO ok — server={} protocol_version={} authenticated={} admin={}",
hello.server_version, hello.protocol_version, hello.authenticated, hello.admin
);
println!(" capabilities: {:?}", hello.capabilities);
let pong = client.ping().await?;
println!("✓ PING → {pong}");
let collections = client.list_collections().await?;
println!("✓ {} collection(s): {:?}", collections.len(), collections);
if let Some(first) = collections.first() {
println!("→ Searching '{first}' for 'vector database'");
let info = client.get_collection_info(first).await?;
println!(
" collection has {} vectors across {} documents (dim={})",
info.vector_count, info.document_count, info.dimension
);
let hits = client.search_basic(first, "vector database", 5).await?;
println!(" top {} hit(s):", hits.len());
for hit in &hits {
println!(" {} (score={:.4})", hit.id, hit.score);
}
} else {
println!(" (no collections to search — create one via the REST/MCP API or the dashboard)");
}
Ok(())
}