1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
* 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,
}
}
}