hotdata 0.1.2

Powerful data platform API for datasets, queries, and analytics.
Documentation
/*
 * Hotdata API
 *
 * Powerful data platform API for datasets, queries, and analytics.
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: developers@hotdata.dev
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// CreateIndexRequest : Request body for POST .../indexes
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateIndexRequest {
    /// When true, create the index as a background job and return a job ID for polling.
    #[serde(rename = "async", skip_serializing_if = "Option::is_none")]
    pub r#async: Option<bool>,
    /// Columns to index. Required for all index types.
    #[serde(rename = "columns")]
    pub columns: Vec<String>,
    /// User-facing description of the embedding (e.g., \"product descriptions\").
    #[serde(
        rename = "description",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub description: Option<Option<String>>,
    /// Output vector dimensions. Some models support multiple dimension sizes (e.g., OpenAI text-embedding-3-small supports 512 or 1536). If omitted, the model's default dimensions are used
    #[serde(
        rename = "dimensions",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub dimensions: Option<Option<i32>>,
    /// Embedding provider ID. When set for a vector index, the source column is treated as text and embeddings are generated automatically. The vector index is then built on the generated embedding column (`{column}_embedding` by default).
    #[serde(
        rename = "embedding_provider_id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub embedding_provider_id: Option<Option<String>>,
    #[serde(rename = "index_name")]
    pub index_name: String,
    /// Index type: \"sorted\" (default), \"bm25\", or \"vector\"
    #[serde(rename = "index_type", skip_serializing_if = "Option::is_none")]
    pub index_type: Option<String>,
    /// Distance metric for vector indexes: \"l2\", \"cosine\", or \"dot\". When omitted, defaults to \"l2\" for float array columns or the provider's preferred metric for text columns with auto-embedding.
    #[serde(
        rename = "metric",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub metric: Option<Option<String>>,
    /// Custom name for the generated embedding column. Defaults to `{column}_embedding`.
    #[serde(
        rename = "output_column",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub output_column: Option<Option<String>>,
}

impl CreateIndexRequest {
    /// Request body for POST .../indexes
    pub fn new(columns: Vec<String>, index_name: String) -> CreateIndexRequest {
        CreateIndexRequest {
            r#async: None,
            columns,
            description: None,
            dimensions: None,
            embedding_provider_id: None,
            index_name,
            index_type: None,
            metric: None,
            output_column: None,
        }
    }
}