tcvectordb_rust/
lib.rs

1//! # Tencent VectorDB Rust SDK
2//! 
3//! Rust SDK for [Tencent Cloud VectorDB](https://cloud.tencent.com/product/vdb).
4//! 
5//! ## Features
6//! 
7//! - Database and collection management
8//! - Document CRUD operations
9//! - Vector similarity search
10//! - Index management
11//! - Filter support
12//! 
13//! ## Example
14//! 
15//! ```rust,no_run
16//! use tcvectordb_rust::{VectorDBClient, Document, Index, VectorIndex, FilterIndex};
17//! use tcvectordb_rust::enums::{IndexType, MetricType, FieldType, ReadConsistency};
18//! 
19//! #[tokio::main]
20//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
21//!     let client = VectorDBClient::new(
22//!         "http://localhost:8100",
23//!         "root",
24//!         "your-api-key",
25//!         ReadConsistency::EventualConsistency,
26//!         30,
27//!     )?;
28//! 
29//!     // Create database
30//!     let db = client.create_database("test_db").await?;
31//! 
32//!     // Create collection with index
33//!     let mut index = Index::new();
34//!     index.add_vector_index(VectorIndex::new(
35//!         "vector",
36//!         3,
37//!         IndexType::HNSW,
38//!         MetricType::COSINE,
39//!         None,
40//!     ));
41//!     index.add_filter_index(FilterIndex::new(
42//!         "id",
43//!         FieldType::String,
44//!         IndexType::PRIMARY_KEY,
45//!     ));
46//! 
47//!     let collection = db.create_collection(
48//!         "test_collection",
49//!         3,
50//!         2,
51//!         Some("Test collection"),
52//!         Some(index),
53//!         None,
54//!         None,
55//!     ).await?;
56//! 
57//!     // Upsert documents
58//!     let documents = vec![
59//!         Document::new()
60//!             .with_id("doc1")
61//!             .with_vector(vec![0.1, 0.2, 0.3])
62//!             .with_field("title", "Document 1"),
63//!     ];
64//! 
65//!     collection.upsert(documents, None, true).await?;
66//! 
67//!     // Search similar vectors
68//!     let results = collection.search(
69//!         vec![vec![0.1, 0.2, 0.3]],
70//!         None,
71//!         None,
72//!         false,
73//!         10,
74//!         None,
75//!         None,
76//!         None,
77//!     ).await?;
78//! 
79//!     println!("Search results: {:?}", results);
80//! 
81//!     Ok(())
82//! }
83//! ```
84
85pub mod client;
86pub mod database;
87pub mod collection;
88pub mod document;
89pub mod index;
90pub mod enums;
91pub mod error;
92pub mod filter;
93
94pub use client::VectorDBClient;
95pub use database::Database;
96pub use collection::Collection;
97pub use document::Document;
98pub use index::{Index, VectorIndex, FilterIndex, SparseIndex};
99pub use error::{VectorDBError, Result};
100pub use filter::Filter;