List Stores
Schema
ListStores accepts an optional schema field. When it is omitted, the server lists stores in public only; it does not list stores across every schema. Set schema to list stores in another schema.
Retrieves vector stores from one schema currently managed by the AI service. Each store represents a logical container for embeddings and their associated metadata. This operation is useful for exploring available stores before performing read or write operations.
Source Code Example
Click to expand
use ahnlich_client_rs::ai::AiClient;
use ahnlich_client_rs::error::AhnlichError;
#[tokio::main]
async fn main() -> Result<(), AhnlichError> {
let addr = "127.0.0.1:1370";
let client = AiClient::new(addr.to_string()).await?;
let stores = client
.list_stores_with_schema(Some("analytics".to_string()), None)
.await?;
println!("Stores: {:?}", stores);
Ok(())
}
Returns
-
Ok(StoreList)— A structured list of available vector stores managed by the AI service. -
Err(AhnlichError)— If the request fails due to connectivity issues, authorization errors, or service unavailability.
Behavior (explains the code, brief)
-
Creates a
tonic::Requestwrapping an emptyListStores { schema: Some("analytics".to_string()) }message. -
Adds a tracing ID if provided for observability.
-
Calls the remote
list_storesRPC using the AI client. -
Awaits the result and unwraps the server’s response.
-
Returns the
StoreListobject containing store metadata. EachAiStoreInfoincludes an optionaldb_infofield with the underlying DB store information when the AI service is connected to a DB instance.