vectrixdb 2.2.0

Client for VectrixDB: collections, documents, text search, sources.
Documentation
// Generated by scripts/generate.py from docs/reference/openapi.json; do not edit.
// Regenerate with: python3 -I scripts/generate.py (run from sdk/rust).
// Schemas: CreateCollectionRequestV2, TextUpsertRequest, TextSearchRequest, AddSourceRequest, RefreshRequest and the ones they reference.
//
// The request bodies the client sends. Every field the spec does not list
// as required is an Option that is omitted from the JSON when None.

/// Enhanced request to create a collection with advanced options.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateCollectionRequestV2 {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    pub dimension: i64,
    /// Enable hybrid search
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub enable_text_index: Option<bool>,
    /// HNSW construction parameter
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub hnsw_ef_construction: Option<i64>,
    /// HNSW M parameter
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub hnsw_m: Option<i64>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub metric: Option<String>,
    pub name: String,
    /// Capability tags: Dense, Sparse, Hybrid, Ultimate, Graph
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<String>>,
}

/// Request for text upsert endpoint.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TextUpsertRequest {
    /// Points with text to embed
    pub points: Vec<TextUpsertPoint>,
}

/// Text-based semantic search request.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TextSearchRequest {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub filter: Option<serde_json::Map<String, serde_json::Value>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub include_vectors: Option<bool>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub limit: Option<i64>,
    /// Search query text (auto-embedded)
    pub query_text: String,
    /// Re-rank the top candidates with the bundled cross-encoder. The dashboard used to send this and the server ignored it, so its Rerank mode was dense search.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub rerank: Option<bool>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub score_threshold: Option<f64>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub use_cache: Option<bool>,
}

#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct AddSourceRequest {
    /// The feed's or the page's address.
    pub address: String,
    /// A feed: index the article each entry links to.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub articles: Option<bool>,
    /// A page: remove its chunks when it answers 404 or 410.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub delete_when_gone: Option<bool>,
    /// How often it is read: 30m, 6h, 1d, or seconds.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub every: Option<serde_json::Value>,
    /// feed or page. Left out, it is fetched once to tell.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    /// A podcast: transcribe episodes when an audio extractor is configured.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub transcribe: Option<bool>,
}

#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RefreshRequest {
    /// Every source, not only the ones that are due.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub force: Option<bool>,
    /// Entries written per source.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub max_items: Option<i64>,
    /// One source's id or address.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub source: Option<String>,
}

/// Point with text for auto-embedding.
#[derive(Debug, Clone, Default, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TextUpsertPoint {
    /// Point ID
    pub id: String,
    /// Additional metadata
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub payload: Option<serde_json::Map<String, serde_json::Value>>,
    /// Text to embed and store
    pub text: String,
}