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
/*
* Pinecone Control Plane API
*
* Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors.
*
* The version of the OpenAPI document: 2024-07
* Contact: support@pinecone.io
* Generated by: https://openapi-generator.tech
*/
use crate::openapi::models;
use serde::{Deserialize, Serialize};
/// IndexModel : The IndexModel describes the configuration and status of a Pinecone index.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct IndexModel {
/// The name of the index. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'.
#[serde(rename = "name")]
pub name: String,
/// The dimensions of the vectors to be inserted in the index.
#[serde(rename = "dimension")]
pub dimension: i32,
/// The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.
#[serde(rename = "metric")]
pub metric: Metric,
/// The URL address where the index is hosted.
#[serde(rename = "host")]
pub host: String,
#[serde(rename = "deletion_protection", skip_serializing_if = "Option::is_none")]
pub deletion_protection: Option<models::DeletionProtection>,
#[serde(rename = "spec")]
pub spec: Box<models::IndexModelSpec>,
#[serde(rename = "status")]
pub status: Box<models::IndexModelStatus>,
}
impl IndexModel {
/// The IndexModel describes the configuration and status of a Pinecone index.
pub fn new(name: String, dimension: i32, metric: Metric, host: String, spec: models::IndexModelSpec, status: models::IndexModelStatus) -> IndexModel {
IndexModel {
name,
dimension,
metric,
host,
deletion_protection: None,
spec: Box::new(spec),
status: Box::new(status),
}
}
}
/// The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Metric {
#[serde(rename = "cosine")]
Cosine,
#[serde(rename = "euclidean")]
Euclidean,
#[serde(rename = "dotproduct")]
Dotproduct,
}
impl Default for Metric {
fn default() -> Metric {
Self::Cosine
}
}