Rust
The Ahnlich Rust client library is a Rust crate that allows you to interact with Ahnlich DB and Ahnlich AI.
id: client-rust
title: Rust SDK (๐ฆ)
sidebar_label: Rust
description: Official Rust client library to integrate with Ahnlich DB (exact vector search) and AI (semantic embeddings) services.
๐ฆ Ahnlich Rust SDKโ
The official Rust client to interface with ahnlichโdb (exact similarity search) and ahnlichโai (semantic similarity) over gRPC.
See full API docs and examples at docs.rs โ ahnlich_client_rs
๐ Connecting to DB / AI Servicesโ
Both services expect:
ahnlich-db
should be accessible (default:127.0.0.1:1369
)ahnlich-ai
should be separately reachable (default:127.0.0.1:1370
or as configured)
The SDK supports optional W3C trace context via an Option<String>
trace_id
in all calls.
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let tracing_id: Option<String> = None;
// โ๏ธ DB client:
let db_client = ahnlich_client_rs::db::DbClient::new("127.0.0.1:1369".to_string()).await?;
db_client.ping(tracing_id.clone()).await?;
// โ๏ธ AI client:
let ai_client = ahnlich_client_rs::ai::AIClient::new("127.0.0.1:1369".to_string()).await?;
ai_client.ping(tracing_id.clone()).await?;
Ok(())
}
๐ง Best Practices Always match vector/query dimension to the storeโs declared dimension (e.g. 128 or 768).
Use DbClient::pipeline() or AIClient::pipeline() if you require ordered batched operations with predictable response order.
Metadata predicates are fast and flexible filtering toolsโeven if predicates aren't pre-indexed.
AI Stores automatically handle embedding; no need to compute embeddings manually for raw input.