pub struct VectorizerClient { /* private fields */ }Expand description
Vectorizer client with optional master/replica topology support
Implementations§
Source§impl VectorizerClient
impl VectorizerClient
Sourcepub fn new(config: ClientConfig) -> Result<Self>
pub fn new(config: ClientConfig) -> Result<Self>
Create a new client with configuration
Sourcepub fn new_default() -> Result<Self>
pub fn new_default() -> Result<Self>
Create a new client with default configuration
Sourcepub fn new_with_url(base_url: &str) -> Result<Self>
pub fn new_with_url(base_url: &str) -> Result<Self>
Create client with custom URL
Sourcepub fn new_with_api_key(base_url: &str, api_key: &str) -> Result<Self>
pub fn new_with_api_key(base_url: &str, api_key: &str) -> Result<Self>
Create client with API key
Sourcepub fn from_connection_string(
connection_string: &str,
api_key: Option<&str>,
) -> Result<Self>
pub fn from_connection_string( connection_string: &str, api_key: Option<&str>, ) -> Result<Self>
Create client from connection string
Sourcepub async fn with_master<F, Fut, T>(&self, callback: F) -> Result<T>
pub async fn with_master<F, Fut, T>(&self, callback: F) -> Result<T>
Execute a callback with master transport for read-your-writes scenarios. All operations within the callback will be routed to master.
Sourcepub async fn health_check(&self) -> Result<HealthStatus>
pub async fn health_check(&self) -> Result<HealthStatus>
Health check
Sourcepub async fn list_collections(&self) -> Result<Vec<Collection>>
pub async fn list_collections(&self) -> Result<Vec<Collection>>
List collections
Sourcepub async fn search_vectors(
&self,
collection: &str,
query: &str,
limit: Option<usize>,
score_threshold: Option<f32>,
) -> Result<SearchResponse>
pub async fn search_vectors( &self, collection: &str, query: &str, limit: Option<usize>, score_threshold: Option<f32>, ) -> Result<SearchResponse>
Search vectors
Sourcepub async fn intelligent_search(
&self,
request: IntelligentSearchRequest,
) -> Result<IntelligentSearchResponse>
pub async fn intelligent_search( &self, request: IntelligentSearchRequest, ) -> Result<IntelligentSearchResponse>
Intelligent search with multi-query expansion and semantic reranking
Sourcepub async fn semantic_search(
&self,
request: SemanticSearchRequest,
) -> Result<SemanticSearchResponse>
pub async fn semantic_search( &self, request: SemanticSearchRequest, ) -> Result<SemanticSearchResponse>
Semantic search with advanced reranking and similarity thresholds
Sourcepub async fn contextual_search(
&self,
request: ContextualSearchRequest,
) -> Result<ContextualSearchResponse>
pub async fn contextual_search( &self, request: ContextualSearchRequest, ) -> Result<ContextualSearchResponse>
Context-aware search with metadata filtering and contextual reranking
Sourcepub async fn multi_collection_search(
&self,
request: MultiCollectionSearchRequest,
) -> Result<MultiCollectionSearchResponse>
pub async fn multi_collection_search( &self, request: MultiCollectionSearchRequest, ) -> Result<MultiCollectionSearchResponse>
Multi-collection search with cross-collection reranking and aggregation
Sourcepub async fn hybrid_search(
&self,
request: HybridSearchRequest,
) -> Result<HybridSearchResponse>
pub async fn hybrid_search( &self, request: HybridSearchRequest, ) -> Result<HybridSearchResponse>
Perform hybrid search combining dense and sparse vectors
Sourcepub async fn qdrant_list_collections(&self) -> Result<Value>
pub async fn qdrant_list_collections(&self) -> Result<Value>
List all collections (Qdrant-compatible API)
Sourcepub async fn qdrant_get_collection(&self, name: &str) -> Result<Value>
pub async fn qdrant_get_collection(&self, name: &str) -> Result<Value>
Get collection information (Qdrant-compatible API)
Sourcepub async fn qdrant_create_collection(
&self,
name: &str,
config: &Value,
) -> Result<Value>
pub async fn qdrant_create_collection( &self, name: &str, config: &Value, ) -> Result<Value>
Create collection (Qdrant-compatible API)
Sourcepub async fn qdrant_upsert_points(
&self,
collection: &str,
points: &Value,
wait: bool,
) -> Result<Value>
pub async fn qdrant_upsert_points( &self, collection: &str, points: &Value, wait: bool, ) -> Result<Value>
Upsert points to collection (Qdrant-compatible API)
Sourcepub async fn qdrant_search_points(
&self,
collection: &str,
vector: &[f32],
limit: Option<usize>,
filter: Option<&Value>,
with_payload: bool,
with_vector: bool,
) -> Result<Value>
pub async fn qdrant_search_points( &self, collection: &str, vector: &[f32], limit: Option<usize>, filter: Option<&Value>, with_payload: bool, with_vector: bool, ) -> Result<Value>
Search points in collection (Qdrant-compatible API)
Sourcepub async fn qdrant_delete_points(
&self,
collection: &str,
point_ids: &[Value],
wait: bool,
) -> Result<Value>
pub async fn qdrant_delete_points( &self, collection: &str, point_ids: &[Value], wait: bool, ) -> Result<Value>
Delete points from collection (Qdrant-compatible API)
Sourcepub async fn qdrant_retrieve_points(
&self,
collection: &str,
point_ids: &[Value],
with_payload: bool,
with_vector: bool,
) -> Result<Value>
pub async fn qdrant_retrieve_points( &self, collection: &str, point_ids: &[Value], with_payload: bool, with_vector: bool, ) -> Result<Value>
Retrieve points by IDs (Qdrant-compatible API)
Sourcepub async fn qdrant_count_points(
&self,
collection: &str,
filter: Option<&Value>,
) -> Result<Value>
pub async fn qdrant_count_points( &self, collection: &str, filter: Option<&Value>, ) -> Result<Value>
Count points in collection (Qdrant-compatible API)
Sourcepub async fn qdrant_list_collection_snapshots(
&self,
collection: &str,
) -> Result<Value>
pub async fn qdrant_list_collection_snapshots( &self, collection: &str, ) -> Result<Value>
List snapshots for a collection (Qdrant-compatible API)
Sourcepub async fn qdrant_create_collection_snapshot(
&self,
collection: &str,
) -> Result<Value>
pub async fn qdrant_create_collection_snapshot( &self, collection: &str, ) -> Result<Value>
Create snapshot for a collection (Qdrant-compatible API)
Sourcepub async fn qdrant_delete_collection_snapshot(
&self,
collection: &str,
snapshot_name: &str,
) -> Result<Value>
pub async fn qdrant_delete_collection_snapshot( &self, collection: &str, snapshot_name: &str, ) -> Result<Value>
Delete snapshot (Qdrant-compatible API)
Sourcepub async fn qdrant_recover_collection_snapshot(
&self,
collection: &str,
location: &str,
) -> Result<Value>
pub async fn qdrant_recover_collection_snapshot( &self, collection: &str, location: &str, ) -> Result<Value>
Recover collection from snapshot (Qdrant-compatible API)
Sourcepub async fn qdrant_list_all_snapshots(&self) -> Result<Value>
pub async fn qdrant_list_all_snapshots(&self) -> Result<Value>
List all snapshots (Qdrant-compatible API)
Sourcepub async fn qdrant_create_full_snapshot(&self) -> Result<Value>
pub async fn qdrant_create_full_snapshot(&self) -> Result<Value>
Create full snapshot (Qdrant-compatible API)
Sourcepub async fn qdrant_list_shard_keys(&self, collection: &str) -> Result<Value>
pub async fn qdrant_list_shard_keys(&self, collection: &str) -> Result<Value>
List shard keys for a collection (Qdrant-compatible API)
Sourcepub async fn qdrant_create_shard_key(
&self,
collection: &str,
shard_key: &Value,
) -> Result<Value>
pub async fn qdrant_create_shard_key( &self, collection: &str, shard_key: &Value, ) -> Result<Value>
Create shard key (Qdrant-compatible API)
Sourcepub async fn qdrant_delete_shard_key(
&self,
collection: &str,
shard_key: &Value,
) -> Result<Value>
pub async fn qdrant_delete_shard_key( &self, collection: &str, shard_key: &Value, ) -> Result<Value>
Delete shard key (Qdrant-compatible API)
Sourcepub async fn qdrant_get_cluster_status(&self) -> Result<Value>
pub async fn qdrant_get_cluster_status(&self) -> Result<Value>
Get cluster status (Qdrant-compatible API)
Sourcepub async fn qdrant_cluster_recover(&self) -> Result<Value>
pub async fn qdrant_cluster_recover(&self) -> Result<Value>
Recover current peer (Qdrant-compatible API)
Sourcepub async fn qdrant_remove_peer(&self, peer_id: &str) -> Result<Value>
pub async fn qdrant_remove_peer(&self, peer_id: &str) -> Result<Value>
Remove peer from cluster (Qdrant-compatible API)
Sourcepub async fn qdrant_list_metadata_keys(&self) -> Result<Value>
pub async fn qdrant_list_metadata_keys(&self) -> Result<Value>
List metadata keys (Qdrant-compatible API)
Sourcepub async fn qdrant_get_metadata_key(&self, key: &str) -> Result<Value>
pub async fn qdrant_get_metadata_key(&self, key: &str) -> Result<Value>
Get metadata key (Qdrant-compatible API)
Sourcepub async fn qdrant_update_metadata_key(
&self,
key: &str,
value: &Value,
) -> Result<Value>
pub async fn qdrant_update_metadata_key( &self, key: &str, value: &Value, ) -> Result<Value>
Update metadata key (Qdrant-compatible API)
Sourcepub async fn qdrant_query_points(
&self,
collection: &str,
request: &Value,
) -> Result<Value>
pub async fn qdrant_query_points( &self, collection: &str, request: &Value, ) -> Result<Value>
Query points (Qdrant 1.7+ Query API)
Sourcepub async fn qdrant_batch_query_points(
&self,
collection: &str,
request: &Value,
) -> Result<Value>
pub async fn qdrant_batch_query_points( &self, collection: &str, request: &Value, ) -> Result<Value>
Batch query points (Qdrant 1.7+ Query API)
Sourcepub async fn qdrant_query_points_groups(
&self,
collection: &str,
request: &Value,
) -> Result<Value>
pub async fn qdrant_query_points_groups( &self, collection: &str, request: &Value, ) -> Result<Value>
Query points with groups (Qdrant 1.7+ Query API)
Sourcepub async fn qdrant_search_points_groups(
&self,
collection: &str,
request: &Value,
) -> Result<Value>
pub async fn qdrant_search_points_groups( &self, collection: &str, request: &Value, ) -> Result<Value>
Search points with groups (Qdrant Search Groups API)
Sourcepub async fn qdrant_search_matrix_pairs(
&self,
collection: &str,
request: &Value,
) -> Result<Value>
pub async fn qdrant_search_matrix_pairs( &self, collection: &str, request: &Value, ) -> Result<Value>
Search matrix pairs (Qdrant Search Matrix API)
Sourcepub async fn qdrant_search_matrix_offsets(
&self,
collection: &str,
request: &Value,
) -> Result<Value>
pub async fn qdrant_search_matrix_offsets( &self, collection: &str, request: &Value, ) -> Result<Value>
Search matrix offsets (Qdrant Search Matrix API)
Sourcepub async fn create_collection(
&self,
name: &str,
dimension: usize,
metric: Option<SimilarityMetric>,
) -> Result<CollectionInfo>
pub async fn create_collection( &self, name: &str, dimension: usize, metric: Option<SimilarityMetric>, ) -> Result<CollectionInfo>
Create collection
Sourcepub async fn insert_texts(
&self,
collection: &str,
texts: Vec<BatchTextRequest>,
) -> Result<BatchResponse>
pub async fn insert_texts( &self, collection: &str, texts: Vec<BatchTextRequest>, ) -> Result<BatchResponse>
Insert texts
Sourcepub async fn delete_collection(&self, name: &str) -> Result<()>
pub async fn delete_collection(&self, name: &str) -> Result<()>
Delete collection
Sourcepub async fn get_vector(
&self,
collection: &str,
vector_id: &str,
) -> Result<Vector>
pub async fn get_vector( &self, collection: &str, vector_id: &str, ) -> Result<Vector>
Get vector
Sourcepub async fn get_collection_info(
&self,
collection: &str,
) -> Result<CollectionInfo>
pub async fn get_collection_info( &self, collection: &str, ) -> Result<CollectionInfo>
Get collection info
Sourcepub async fn embed_text(
&self,
text: &str,
model: Option<&str>,
) -> Result<EmbeddingResponse>
pub async fn embed_text( &self, text: &str, model: Option<&str>, ) -> Result<EmbeddingResponse>
Generate embeddings
Sourcepub async fn discover(
&self,
query: &str,
include_collections: Option<Vec<String>>,
exclude_collections: Option<Vec<String>>,
max_bullets: Option<usize>,
broad_k: Option<usize>,
focus_k: Option<usize>,
) -> Result<Value>
pub async fn discover( &self, query: &str, include_collections: Option<Vec<String>>, exclude_collections: Option<Vec<String>>, max_bullets: Option<usize>, broad_k: Option<usize>, focus_k: Option<usize>, ) -> Result<Value>
Complete discovery pipeline with intelligent search and prompt generation
Sourcepub async fn filter_collections(
&self,
query: &str,
include: Option<Vec<String>>,
exclude: Option<Vec<String>>,
) -> Result<Value>
pub async fn filter_collections( &self, query: &str, include: Option<Vec<String>>, exclude: Option<Vec<String>>, ) -> Result<Value>
Pre-filter collections by name patterns
Sourcepub async fn score_collections(
&self,
query: &str,
name_match_weight: Option<f32>,
term_boost_weight: Option<f32>,
signal_boost_weight: Option<f32>,
) -> Result<Value>
pub async fn score_collections( &self, query: &str, name_match_weight: Option<f32>, term_boost_weight: Option<f32>, signal_boost_weight: Option<f32>, ) -> Result<Value>
Rank collections by relevance
Sourcepub async fn expand_queries(
&self,
query: &str,
max_expansions: Option<usize>,
include_definition: Option<bool>,
include_features: Option<bool>,
include_architecture: Option<bool>,
) -> Result<Value>
pub async fn expand_queries( &self, query: &str, max_expansions: Option<usize>, include_definition: Option<bool>, include_features: Option<bool>, include_architecture: Option<bool>, ) -> Result<Value>
Generate query variations
Sourcepub async fn get_file_content(
&self,
collection: &str,
file_path: &str,
max_size_kb: Option<usize>,
) -> Result<Value>
pub async fn get_file_content( &self, collection: &str, file_path: &str, max_size_kb: Option<usize>, ) -> Result<Value>
Retrieve complete file content from a collection
Sourcepub async fn list_files_in_collection(
&self,
collection: &str,
filter_by_type: Option<Vec<String>>,
min_chunks: Option<usize>,
max_results: Option<usize>,
sort_by: Option<&str>,
) -> Result<Value>
pub async fn list_files_in_collection( &self, collection: &str, filter_by_type: Option<Vec<String>>, min_chunks: Option<usize>, max_results: Option<usize>, sort_by: Option<&str>, ) -> Result<Value>
List all indexed files in a collection
Sourcepub async fn get_file_summary(
&self,
collection: &str,
file_path: &str,
summary_type: Option<&str>,
max_sentences: Option<usize>,
) -> Result<Value>
pub async fn get_file_summary( &self, collection: &str, file_path: &str, summary_type: Option<&str>, max_sentences: Option<usize>, ) -> Result<Value>
Get extractive or structural summary of an indexed file
Sourcepub async fn get_file_chunks_ordered(
&self,
collection: &str,
file_path: &str,
start_chunk: Option<usize>,
limit: Option<usize>,
include_context: Option<bool>,
) -> Result<Value>
pub async fn get_file_chunks_ordered( &self, collection: &str, file_path: &str, start_chunk: Option<usize>, limit: Option<usize>, include_context: Option<bool>, ) -> Result<Value>
Retrieve chunks in original file order for progressive reading
Sourcepub async fn get_project_outline(
&self,
collection: &str,
max_depth: Option<usize>,
include_summaries: Option<bool>,
highlight_key_files: Option<bool>,
) -> Result<Value>
pub async fn get_project_outline( &self, collection: &str, max_depth: Option<usize>, include_summaries: Option<bool>, highlight_key_files: Option<bool>, ) -> Result<Value>
Generate hierarchical project structure overview
Find semantically related files using vector similarity
Sourcepub async fn search_by_file_type(
&self,
collection: &str,
query: &str,
file_types: Vec<String>,
limit: Option<usize>,
return_full_files: Option<bool>,
) -> Result<Value>
pub async fn search_by_file_type( &self, collection: &str, query: &str, file_types: Vec<String>, limit: Option<usize>, return_full_files: Option<bool>, ) -> Result<Value>
Semantic search filtered by file type
Sourcepub async fn list_graph_nodes(
&self,
collection: &str,
) -> Result<ListNodesResponse>
pub async fn list_graph_nodes( &self, collection: &str, ) -> Result<ListNodesResponse>
List all nodes in a collection’s graph
Sourcepub async fn get_graph_neighbors(
&self,
collection: &str,
node_id: &str,
) -> Result<GetNeighborsResponse>
pub async fn get_graph_neighbors( &self, collection: &str, node_id: &str, ) -> Result<GetNeighborsResponse>
Get neighbors of a specific node
Find related nodes within N hops
Sourcepub async fn find_graph_path(
&self,
request: FindPathRequest,
) -> Result<FindPathResponse>
pub async fn find_graph_path( &self, request: FindPathRequest, ) -> Result<FindPathResponse>
Find shortest path between two nodes
Sourcepub async fn create_graph_edge(
&self,
request: CreateEdgeRequest,
) -> Result<CreateEdgeResponse>
pub async fn create_graph_edge( &self, request: CreateEdgeRequest, ) -> Result<CreateEdgeResponse>
Create an explicit edge between two nodes
Sourcepub async fn delete_graph_edge(&self, edge_id: &str) -> Result<()>
pub async fn delete_graph_edge(&self, edge_id: &str) -> Result<()>
Delete an edge by ID
Sourcepub async fn list_graph_edges(
&self,
collection: &str,
) -> Result<ListEdgesResponse>
pub async fn list_graph_edges( &self, collection: &str, ) -> Result<ListEdgesResponse>
List all edges in a collection
Sourcepub async fn discover_graph_edges(
&self,
collection: &str,
request: DiscoverEdgesRequest,
) -> Result<DiscoverEdgesResponse>
pub async fn discover_graph_edges( &self, collection: &str, request: DiscoverEdgesRequest, ) -> Result<DiscoverEdgesResponse>
Discover SIMILAR_TO edges for entire collection
Sourcepub async fn discover_graph_edges_for_node(
&self,
collection: &str,
node_id: &str,
request: DiscoverEdgesRequest,
) -> Result<DiscoverEdgesResponse>
pub async fn discover_graph_edges_for_node( &self, collection: &str, node_id: &str, request: DiscoverEdgesRequest, ) -> Result<DiscoverEdgesResponse>
Discover SIMILAR_TO edges for a specific node
Sourcepub async fn get_graph_discovery_status(
&self,
collection: &str,
) -> Result<DiscoveryStatusResponse>
pub async fn get_graph_discovery_status( &self, collection: &str, ) -> Result<DiscoveryStatusResponse>
Get discovery status for a collection
Sourcepub async fn upload_file(
&self,
file_bytes: Vec<u8>,
filename: &str,
collection_name: &str,
options: UploadFileOptions,
) -> Result<FileUploadResponse>
pub async fn upload_file( &self, file_bytes: Vec<u8>, filename: &str, collection_name: &str, options: UploadFileOptions, ) -> Result<FileUploadResponse>
Upload a file for automatic text extraction, chunking, and indexing.
§Arguments
file_bytes- File content as bytesfilename- Name of the file (used for extension detection)collection_name- Target collection nameoptions- Upload options (chunk size, overlap, metadata)
§Example
use vectorizer_sdk::{VectorizerClient, ClientConfig, UploadFileOptions};
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = ClientConfig::default();
let client = VectorizerClient::new(config)?;
let file_bytes = std::fs::read("document.pdf")?;
let options = UploadFileOptions::default();
let response = client.upload_file(
file_bytes,
"document.pdf",
"my-docs",
options
).await?;
println!("Uploaded: {} chunks created", response.chunks_created);
Ok(())
}Sourcepub async fn upload_file_content(
&self,
content: &str,
filename: &str,
collection_name: &str,
options: UploadFileOptions,
) -> Result<FileUploadResponse>
pub async fn upload_file_content( &self, content: &str, filename: &str, collection_name: &str, options: UploadFileOptions, ) -> Result<FileUploadResponse>
Upload file content directly as a string.
This is a convenience method that accepts text content directly instead of file bytes.
§Arguments
content- File content as stringfilename- Name of the file (used for extension detection)collection_name- Target collection nameoptions- Upload options (chunk size, overlap, metadata)
§Example
use vectorizer_sdk::{VectorizerClient, ClientConfig, UploadFileOptions};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = ClientConfig::default();
let client = VectorizerClient::new(config)?;
let code = r#"fn main() { println!("Hello!"); }"#;
let options = UploadFileOptions::default();
let response = client.upload_file_content(
code,
"main.rs",
"rust-code",
options
).await?;
println!("Uploaded: {} vectors created", response.vectors_created);
Ok(())
}Sourcepub async fn get_upload_config(&self) -> Result<FileUploadConfig>
pub async fn get_upload_config(&self) -> Result<FileUploadConfig>
Get file upload configuration from the server.
Returns the maximum file size, allowed extensions, and default chunk settings.
§Example
use vectorizer_sdk::{VectorizerClient, ClientConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = ClientConfig::default();
let client = VectorizerClient::new(config)?;
let upload_config = client.get_upload_config().await?;
println!("Max file size: {}MB", upload_config.max_file_size_mb);
println!("Allowed extensions: {:?}", upload_config.allowed_extensions);
Ok(())
}