diff --git a/src/openapi/README.md b/src/openapi/README.md index 78a411c..368d39f 100644 --- a/src/openapi/README.md +++ b/src/openapi/README.md @@ -27,7 +27,7 @@ All URIs are relative to *https://api.pinecone.io* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*InferenceApi* | [**embed**](docs/InferenceApi.md#embed) | **POST** /embed | Embed data +*InferenceApi* | [**embed**](docs/InferenceApi.md#embed) | **POST** /embed | Generate vectors *ManageIndexesApi* | [**configure_index**](docs/ManageIndexesApi.md#configure_index) | **PATCH** /indexes/{index_name} | Configure an index *ManageIndexesApi* | [**create_collection**](docs/ManageIndexesApi.md#create_collection) | **POST** /collections | Create a collection *ManageIndexesApi* | [**create_index**](docs/ManageIndexesApi.md#create_index) | **POST** /indexes | Create an index diff --git a/src/openapi/apis/configuration.rs b/src/openapi/apis/configuration.rs index ef6b88f..67256cb 100644 --- a/src/openapi/apis/configuration.rs +++ b/src/openapi/apis/configuration.rs @@ -8,6 +8,8 @@ * Generated by: https://openapi-generator.tech */ + + #[derive(Debug, Clone)] pub struct Configuration { pub base_path: String, @@ -28,6 +30,7 @@ pub struct ApiKey { pub key: String, } + impl Configuration { pub fn new() -> Configuration { Configuration::default() @@ -44,6 +47,7 @@ impl Default for Configuration { oauth_access_token: None, bearer_access_token: None, api_key: None, + } } } diff --git a/src/openapi/apis/inference_api.rs b/src/openapi/apis/inference_api.rs index fef45c6..0572dc1 100644 --- a/src/openapi/apis/inference_api.rs +++ b/src/openapi/apis/inference_api.rs @@ -8,10 +8,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::openapi::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::openapi::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`embed`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -23,22 +25,18 @@ pub enum EmbedError { UnknownValue(serde_json::Value), } -/// Generate embeddings for input data -pub async fn embed( - configuration: &configuration::Configuration, - embed_request: Option, -) -> Result> { + +/// Generate vector embeddings for input data. This endpoint uses Pinecone's [hosted embedding models](https://docs.pinecone.io/guides/index-data/create-an-index#embedding-models). +pub async fn embed(configuration: &configuration::Configuration, embed_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/embed", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -60,11 +58,8 @@ pub async fn embed( serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/openapi/apis/manage_indexes_api.rs b/src/openapi/apis/manage_indexes_api.rs index 2b0af4f..814c5c7 100644 --- a/src/openapi/apis/manage_indexes_api.rs +++ b/src/openapi/apis/manage_indexes_api.rs @@ -8,10 +8,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::openapi::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::openapi::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`configure_index`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -68,6 +70,7 @@ pub enum DeleteCollectionError { #[serde(untagged)] pub enum DeleteIndexError { Status401(models::ErrorResponse), + Status403(models::ErrorResponse), Status404(models::ErrorResponse), Status412(models::ErrorResponse), Status500(models::ErrorResponse), @@ -112,27 +115,18 @@ pub enum ListIndexesError { UnknownValue(serde_json::Value), } -/// This operation configures an existing index. For serverless indexes, you can configure only index deletion protection. For pod-based indexes, you can configure the pod size, number of replicas, and index deletion protection. It is not possible to change the pod type of a pod-based index. However, you can create a collection from a pod-based index and then [create a new pod-based index with a different pod type](http://docs.pinecone.io/guides/indexes/create-an-index#create-an-index-from-a-collection) from the collection. For guidance and examples, see [Configure an index](http://docs.pinecone.io/guides/indexes/configure-an-index). -pub async fn configure_index( - configuration: &configuration::Configuration, - index_name: &str, - configure_index_request: models::ConfigureIndexRequest, -) -> Result> { + +/// Configure an existing index. For serverless indexes, you can configure only index deletion protection. For pod-based indexes, you can configure the pod size, number of replicas, and index deletion protection. It is not possible to change the pod type of a pod-based index. However, you can create a collection from a pod-based index and then [create a new pod-based index with a different pod type](http://docs.pinecone.io/guides/indexes/pods/create-a-pod-based-index#create-a-pod-index-from-a-collection) from the collection. For guidance and examples, see [Configure an index](http://docs.pinecone.io/guides/indexes/pods/manage-pod-based-indexes). +pub async fn configure_index(configuration: &configuration::Configuration, index_name: &str, configure_index_request: models::ConfigureIndexRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/indexes/{index_name}", - local_var_configuration.base_path, - index_name = crate::openapi::apis::urlencode(index_name) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/indexes/{index_name}", local_var_configuration.base_path, index_name=crate::openapi::apis::urlencode(index_name)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -153,33 +147,23 @@ pub async fn configure_index( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -/// This operation creates a Pinecone collection. Serverless indexes do not support collections. -pub async fn create_collection( - configuration: &configuration::Configuration, - create_collection_request: models::CreateCollectionRequest, -) -> Result> { +/// This operation creates a Pinecone collection. Serverless indexes do not support collections. +pub async fn create_collection(configuration: &configuration::Configuration, create_collection_request: models::CreateCollectionRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/collections", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -200,33 +184,23 @@ pub async fn create_collection( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -/// This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). -pub async fn create_index( - configuration: &configuration::Configuration, - create_index_request: models::CreateIndexRequest, -) -> Result> { +/// Create an index for vectors created with an external embedding model. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/index-data/create-an-index). +pub async fn create_index(configuration: &configuration::Configuration, create_index_request: models::CreateIndexRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/indexes", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -247,37 +221,23 @@ pub async fn create_index( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -/// This operation deletes an existing collection. Serverless indexes do not support collections. -pub async fn delete_collection( - configuration: &configuration::Configuration, - collection_name: &str, -) -> Result<(), Error> { +/// This operation deletes an existing collection. Serverless indexes do not support collections. +pub async fn delete_collection(configuration: &configuration::Configuration, collection_name: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/collections/{collection_name}", - local_var_configuration.base_path, - collection_name = crate::openapi::apis::urlencode(collection_name) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/collections/{collection_name}", local_var_configuration.base_path, collection_name=crate::openapi::apis::urlencode(collection_name)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -297,37 +257,23 @@ pub async fn delete_collection( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -/// This operation deletes an existing index. -pub async fn delete_index( - configuration: &configuration::Configuration, - index_name: &str, -) -> Result<(), Error> { +/// Delete an existing index. +pub async fn delete_index(configuration: &configuration::Configuration, index_name: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/indexes/{index_name}", - local_var_configuration.base_path, - index_name = crate::openapi::apis::urlencode(index_name) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/indexes/{index_name}", local_var_configuration.base_path, index_name=crate::openapi::apis::urlencode(index_name)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -347,37 +293,23 @@ pub async fn delete_index( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -/// This operation gets a description of a collection. Serverless indexes do not support collections. -pub async fn describe_collection( - configuration: &configuration::Configuration, - collection_name: &str, -) -> Result> { +/// This operation gets a description of a collection. Serverless indexes do not support collections. +pub async fn describe_collection(configuration: &configuration::Configuration, collection_name: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/collections/{collection_name}", - local_var_configuration.base_path, - collection_name = crate::openapi::apis::urlencode(collection_name) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/collections/{collection_name}", local_var_configuration.base_path, collection_name=crate::openapi::apis::urlencode(collection_name)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -397,37 +329,23 @@ pub async fn describe_collection( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Get a description of an index. -pub async fn describe_index( - configuration: &configuration::Configuration, - index_name: &str, -) -> Result> { +pub async fn describe_index(configuration: &configuration::Configuration, index_name: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/indexes/{index_name}", - local_var_configuration.base_path, - index_name = crate::openapi::apis::urlencode(index_name) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/indexes/{index_name}", local_var_configuration.base_path, index_name=crate::openapi::apis::urlencode(index_name)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -447,32 +365,23 @@ pub async fn describe_index( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -/// This operation returns a list of all collections in a project. Serverless indexes do not support collections. -pub async fn list_collections( - configuration: &configuration::Configuration, -) -> Result> { +/// This operation returns a list of all collections in a project. Serverless indexes do not support collections. +pub async fn list_collections(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/collections", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -492,32 +401,23 @@ pub async fn list_collections( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// This operation returns a list of all indexes in a project. -pub async fn list_indexes( - configuration: &configuration::Configuration, -) -> Result> { +pub async fn list_indexes(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/indexes", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -537,13 +437,9 @@ pub async fn list_indexes( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/openapi/apis/mod.rs b/src/openapi/apis/mod.rs index a38c3c1..6508d4a 100644 --- a/src/openapi/apis/mod.rs +++ b/src/openapi/apis/mod.rs @@ -16,7 +16,7 @@ pub enum Error { ResponseError(ResponseContent), } -impl fmt::Display for Error { +impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (module, e) = match self { Error::Reqwest(e) => ("reqwest", e.to_string()), @@ -28,7 +28,7 @@ impl fmt::Display for Error { } } -impl error::Error for Error { +impl error::Error for Error { fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(match self { Error::Reqwest(e) => e, @@ -39,19 +39,19 @@ impl error::Error for Error { } } -impl From for Error { +impl From for Error { fn from(e: reqwest::Error) -> Self { Error::Reqwest(e) } } -impl From for Error { +impl From for Error { fn from(e: serde_json::Error) -> Self { Error::Serde(e) } } -impl From for Error { +impl From for Error { fn from(e: std::io::Error) -> Self { Error::Io(e) } @@ -78,10 +78,8 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String value, )); } - } - serde_json::Value::String(s) => { - params.push((format!("{}[{}]", prefix, key), s.clone())) - } + }, + serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), } } diff --git a/src/openapi/mod.rs b/src/openapi/mod.rs index e438d1b..a1837b9 100644 --- a/src/openapi/mod.rs +++ b/src/openapi/mod.rs @@ -1,11 +1,10 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] -#![allow(clippy::enum_variant_names)] -#![allow(clippy::empty_docs)] -extern crate reqwest; + extern crate serde; extern crate serde_json; extern crate url; +extern crate reqwest; pub mod apis; pub mod models; diff --git a/src/openapi/models/collection_list.rs b/src/openapi/models/collection_list.rs index 29dcbd5..14b421c 100644 --- a/src/openapi/models/collection_list.rs +++ b/src/openapi/models/collection_list.rs @@ -21,6 +21,9 @@ pub struct CollectionList { impl CollectionList { /// The list of collections that exist in the project. pub fn new() -> CollectionList { - CollectionList { collections: None } + CollectionList { + collections: None, + } } } + diff --git a/src/openapi/models/collection_model.rs b/src/openapi/models/collection_model.rs index 4f7f513..7043f6a 100644 --- a/src/openapi/models/collection_model.rs +++ b/src/openapi/models/collection_model.rs @@ -63,3 +63,4 @@ impl Default for Status { Self::Initializing } } + diff --git a/src/openapi/models/configure_index_request.rs b/src/openapi/models/configure_index_request.rs index e41acd4..466ea57 100644 --- a/src/openapi/models/configure_index_request.rs +++ b/src/openapi/models/configure_index_request.rs @@ -16,10 +16,7 @@ use serde::{Deserialize, Serialize}; pub struct ConfigureIndexRequest { #[serde(rename = "spec", skip_serializing_if = "Option::is_none")] pub spec: Option>, - #[serde( - rename = "deletion_protection", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "deletion_protection", skip_serializing_if = "Option::is_none")] pub deletion_protection: Option, } @@ -32,3 +29,4 @@ impl ConfigureIndexRequest { } } } + diff --git a/src/openapi/models/configure_index_request_spec.rs b/src/openapi/models/configure_index_request_spec.rs index fa1ed64..4566af6 100644 --- a/src/openapi/models/configure_index_request_spec.rs +++ b/src/openapi/models/configure_index_request_spec.rs @@ -19,6 +19,9 @@ pub struct ConfigureIndexRequestSpec { impl ConfigureIndexRequestSpec { pub fn new(pod: models::ConfigureIndexRequestSpecPod) -> ConfigureIndexRequestSpec { - ConfigureIndexRequestSpec { pod: Box::new(pod) } + ConfigureIndexRequestSpec { + pod: Box::new(pod), + } } } + diff --git a/src/openapi/models/configure_index_request_spec_pod.rs b/src/openapi/models/configure_index_request_spec_pod.rs index 7fc4c48..e583b06 100644 --- a/src/openapi/models/configure_index_request_spec_pod.rs +++ b/src/openapi/models/configure_index_request_spec_pod.rs @@ -29,3 +29,4 @@ impl ConfigureIndexRequestSpecPod { } } } + diff --git a/src/openapi/models/create_collection_request.rs b/src/openapi/models/create_collection_request.rs index 6c848b3..cbc7b7a 100644 --- a/src/openapi/models/create_collection_request.rs +++ b/src/openapi/models/create_collection_request.rs @@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize}; /// CreateCollectionRequest : The configuration needed to create a Pinecone collection. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateCollectionRequest { - /// The name of the collection to be created. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'. + /// The name of the collection to be created. 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 name of the index to be used as the source for the collection. @@ -25,6 +25,10 @@ pub struct CreateCollectionRequest { impl CreateCollectionRequest { /// The configuration needed to create a Pinecone collection. pub fn new(name: String, source: String) -> CreateCollectionRequest { - CreateCollectionRequest { name, source } + CreateCollectionRequest { + name, + source, + } } } + diff --git a/src/openapi/models/create_index_from_dataset_request.rs b/src/openapi/models/create_index_from_dataset_request.rs new file mode 100644 index 0000000..f3c1b12 --- /dev/null +++ b/src/openapi/models/create_index_from_dataset_request.rs @@ -0,0 +1,61 @@ +/* + * 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: unstable + * Contact: support@pinecone.io + * Generated by: https://openapi-generator.tech + */ + +use crate::openapi::models; +use serde::{Deserialize, Serialize}; + +/// CreateIndexFromDatasetRequest : The configuration needed to create a Pinecone index from a dataset. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateIndexFromDatasetRequest { + /// 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", skip_serializing_if = "Option::is_none")] + pub metric: Option, + /// The name of the dataset to create the index from. This must correlate to the collection name. + #[serde(rename = "dataset_name", skip_serializing_if = "Option::is_none")] + pub dataset_name: Option, + #[serde(rename = "spec", deserialize_with = "Option::deserialize")] + pub spec: Option>, +} + +impl CreateIndexFromDatasetRequest { + /// The configuration needed to create a Pinecone index from a dataset. + pub fn new(name: String, dimension: i32, spec: Option) -> CreateIndexFromDatasetRequest { + CreateIndexFromDatasetRequest { + name, + dimension, + metric: None, + dataset_name: None, + spec: if let Some(x) = spec {Some(Box::new(x))} else {None}, + } + } +} +/// 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 + } +} + diff --git a/src/openapi/models/create_index_from_dataset_request_spec.rs b/src/openapi/models/create_index_from_dataset_request_spec.rs new file mode 100644 index 0000000..3afd358 --- /dev/null +++ b/src/openapi/models/create_index_from_dataset_request_spec.rs @@ -0,0 +1,32 @@ +/* + * 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: unstable + * Contact: support@pinecone.io + * Generated by: https://openapi-generator.tech + */ + +use crate::openapi::models; +use serde::{Deserialize, Serialize}; + +/// CreateIndexFromDatasetRequestSpec : The spec object defines how the index should be deployed. For serverless indexes, you define only the cloud and region where the index should be hosted. For pod-based indexes, you define the environment where the index should be hosted, the pod type and size to use, and other index characteristics. Serverless indexes are in public preview and are available only on AWS in the us-west-2 and us-east-1 regions. Test thoroughly before using serverless indexes in production. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateIndexFromDatasetRequestSpec { + #[serde(rename = "serverless", skip_serializing_if = "Option::is_none")] + pub serverless: Option>, + #[serde(rename = "deletion_protection", skip_serializing_if = "Option::is_none")] + pub deletion_protection: Option, +} + +impl CreateIndexFromDatasetRequestSpec { + /// The spec object defines how the index should be deployed. For serverless indexes, you define only the cloud and region where the index should be hosted. For pod-based indexes, you define the environment where the index should be hosted, the pod type and size to use, and other index characteristics. Serverless indexes are in public preview and are available only on AWS in the us-west-2 and us-east-1 regions. Test thoroughly before using serverless indexes in production. + pub fn new() -> CreateIndexFromDatasetRequestSpec { + CreateIndexFromDatasetRequestSpec { + serverless: None, + deletion_protection: None, + } + } +} + diff --git a/src/openapi/models/create_index_request.rs b/src/openapi/models/create_index_request.rs index 0a4c786..e17fba5 100644 --- a/src/openapi/models/create_index_request.rs +++ b/src/openapi/models/create_index_request.rs @@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize}; /// CreateIndexRequest : The configuration needed to create a Pinecone index. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CreateIndexRequest { - /// 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 '-'. + /// 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. @@ -23,10 +23,7 @@ pub struct CreateIndexRequest { /// The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. #[serde(rename = "metric", skip_serializing_if = "Option::is_none")] pub metric: Option, - #[serde( - rename = "deletion_protection", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "deletion_protection", skip_serializing_if = "Option::is_none")] pub deletion_protection: Option, #[serde(rename = "spec", deserialize_with = "Option::deserialize")] pub spec: Option>, @@ -34,17 +31,13 @@ pub struct CreateIndexRequest { impl CreateIndexRequest { /// The configuration needed to create a Pinecone index. - pub fn new( - name: String, - dimension: i32, - spec: Option, - ) -> CreateIndexRequest { + pub fn new(name: String, dimension: i32, spec: Option) -> CreateIndexRequest { CreateIndexRequest { name, dimension, metric: None, deletion_protection: None, - spec: spec.map(Box::new), + spec: if let Some(x) = spec {Some(Box::new(x))} else {None}, } } } @@ -64,3 +57,4 @@ impl Default for Metric { Self::Cosine } } + diff --git a/src/openapi/models/create_index_request_spec.rs b/src/openapi/models/create_index_request_spec.rs new file mode 100644 index 0000000..51a3129 --- /dev/null +++ b/src/openapi/models/create_index_request_spec.rs @@ -0,0 +1,35 @@ +/* + * 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: unstable + * Contact: support@pinecone.io + * Generated by: https://openapi-generator.tech + */ + +use crate::openapi::models; +use serde::{Deserialize, Serialize}; + +/// CreateIndexRequestSpec : The spec object defines how the index should be deployed. For serverless indexes, you define only the cloud and region where the index should be hosted. For pod-based indexes, you define the environment where the index should be hosted, the pod type and size to use, and other index characteristics. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateIndexRequestSpec { + #[serde(rename = "serverless", skip_serializing_if = "Option::is_none")] + pub serverless: Option>, + #[serde(rename = "pod", skip_serializing_if = "Option::is_none")] + pub pod: Option>, + #[serde(rename = "deletion_protection", skip_serializing_if = "Option::is_none")] + pub deletion_protection: Option, +} + +impl CreateIndexRequestSpec { + /// The spec object defines how the index should be deployed. For serverless indexes, you define only the cloud and region where the index should be hosted. For pod-based indexes, you define the environment where the index should be hosted, the pod type and size to use, and other index characteristics. + pub fn new() -> CreateIndexRequestSpec { + CreateIndexRequestSpec { + serverless: None, + pod: None, + deletion_protection: None, + } + } +} + diff --git a/src/openapi/models/deletion_protection.rs b/src/openapi/models/deletion_protection.rs index 9686167..758655a 100644 --- a/src/openapi/models/deletion_protection.rs +++ b/src/openapi/models/deletion_protection.rs @@ -11,14 +11,15 @@ use crate::openapi::models; use serde::{Deserialize, Serialize}; -/// DeletionProtection : Whether [deletion protection](http://docs.pinecone.io/guides/indexes/prevent-index-deletion) is enabled/disabled for the index. -/// Whether [deletion protection](http://docs.pinecone.io/guides/indexes/prevent-index-deletion) is enabled/disabled for the index. +/// DeletionProtection : Whether [deletion protection](http://docs.pinecone.io/guides/manage-data/manage-indexes#configure-deletion-protection) is enabled/disabled for the index. +/// Whether [deletion protection](http://docs.pinecone.io/guides/manage-data/manage-indexes#configure-deletion-protection) is enabled/disabled for the index. #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum DeletionProtection { #[serde(rename = "disabled")] Disabled, #[serde(rename = "enabled")] Enabled, + } impl std::fmt::Display for DeletionProtection { @@ -35,3 +36,4 @@ impl Default for DeletionProtection { Self::Disabled } } + diff --git a/src/openapi/models/embed_request.rs b/src/openapi/models/embed_request.rs index 81d3001..c88758c 100644 --- a/src/openapi/models/embed_request.rs +++ b/src/openapi/models/embed_request.rs @@ -11,7 +11,7 @@ use crate::openapi::models; use serde::{Deserialize, Serialize}; -/// EmbedRequest : Generate embeddings for inputs +/// EmbedRequest : Generate embeddings for inputs. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EmbedRequest { #[serde(rename = "model")] @@ -23,7 +23,7 @@ pub struct EmbedRequest { } impl EmbedRequest { - /// Generate embeddings for inputs + /// Generate embeddings for inputs. pub fn new(model: String, inputs: Vec) -> EmbedRequest { EmbedRequest { model, @@ -32,3 +32,4 @@ impl EmbedRequest { } } } + diff --git a/src/openapi/models/embed_request_inputs_inner.rs b/src/openapi/models/embed_request_inputs_inner.rs index 2713a8a..90920e1 100644 --- a/src/openapi/models/embed_request_inputs_inner.rs +++ b/src/openapi/models/embed_request_inputs_inner.rs @@ -19,6 +19,9 @@ pub struct EmbedRequestInputsInner { impl EmbedRequestInputsInner { pub fn new() -> EmbedRequestInputsInner { - EmbedRequestInputsInner { text: None } + EmbedRequestInputsInner { + text: None, + } } } + diff --git a/src/openapi/models/embed_request_parameters.rs b/src/openapi/models/embed_request_parameters.rs index 06b5780..41d0a6e 100644 --- a/src/openapi/models/embed_request_parameters.rs +++ b/src/openapi/models/embed_request_parameters.rs @@ -31,3 +31,4 @@ impl EmbedRequestParameters { } } } + diff --git a/src/openapi/models/embedding.rs b/src/openapi/models/embedding.rs index abae85b..470b252 100644 --- a/src/openapi/models/embedding.rs +++ b/src/openapi/models/embedding.rs @@ -22,6 +22,9 @@ pub struct Embedding { impl Embedding { /// Embedding of a single input pub fn new() -> Embedding { - Embedding { values: None } + Embedding { + values: None, + } } } + diff --git a/src/openapi/models/embeddings_list.rs b/src/openapi/models/embeddings_list.rs index bdb7643..3393cfb 100644 --- a/src/openapi/models/embeddings_list.rs +++ b/src/openapi/models/embeddings_list.rs @@ -32,3 +32,4 @@ impl EmbeddingsList { } } } + diff --git a/src/openapi/models/embeddings_list_usage.rs b/src/openapi/models/embeddings_list_usage.rs index eed4f99..1727268 100644 --- a/src/openapi/models/embeddings_list_usage.rs +++ b/src/openapi/models/embeddings_list_usage.rs @@ -11,7 +11,7 @@ use crate::openapi::models; use serde::{Deserialize, Serialize}; -/// EmbeddingsListUsage : Usage statistics for model inference including any instruction prefixes +/// EmbeddingsListUsage : Usage statistics for the model inference. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EmbeddingsListUsage { #[serde(rename = "total_tokens", skip_serializing_if = "Option::is_none")] @@ -19,8 +19,11 @@ pub struct EmbeddingsListUsage { } impl EmbeddingsListUsage { - /// Usage statistics for model inference including any instruction prefixes + /// Usage statistics for the model inference. pub fn new() -> EmbeddingsListUsage { - EmbeddingsListUsage { total_tokens: None } + EmbeddingsListUsage { + total_tokens: None, + } } } + diff --git a/src/openapi/models/error_response.rs b/src/openapi/models/error_response.rs index 708d4d0..b235722 100644 --- a/src/openapi/models/error_response.rs +++ b/src/openapi/models/error_response.rs @@ -30,3 +30,4 @@ impl ErrorResponse { } } } + diff --git a/src/openapi/models/error_response_error.rs b/src/openapi/models/error_response_error.rs index f339140..54e5b86 100644 --- a/src/openapi/models/error_response_error.rs +++ b/src/openapi/models/error_response_error.rs @@ -33,7 +33,7 @@ impl ErrorResponseError { } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Code { #[serde(rename = "OK")] @@ -81,3 +81,4 @@ impl Default for Code { Self::Ok } } + diff --git a/src/openapi/models/index_list.rs b/src/openapi/models/index_list.rs index 7555142..5e6ddd8 100644 --- a/src/openapi/models/index_list.rs +++ b/src/openapi/models/index_list.rs @@ -21,6 +21,9 @@ pub struct IndexList { impl IndexList { /// The list of indexes that exist in the project. pub fn new() -> IndexList { - IndexList { indexes: None } + IndexList { + indexes: None, + } } } + diff --git a/src/openapi/models/index_model.rs b/src/openapi/models/index_model.rs index bee1b58..f0bf11e 100644 --- a/src/openapi/models/index_model.rs +++ b/src/openapi/models/index_model.rs @@ -14,7 +14,7 @@ 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 '-'. + /// 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. @@ -26,10 +26,7 @@ pub struct IndexModel { /// The URL address where the index is hosted. #[serde(rename = "host")] pub host: String, - #[serde( - rename = "deletion_protection", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "deletion_protection", skip_serializing_if = "Option::is_none")] pub deletion_protection: Option, #[serde(rename = "spec")] pub spec: Box, @@ -39,14 +36,7 @@ pub struct IndexModel { 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 { + pub fn new(name: String, dimension: i32, metric: Metric, host: String, spec: models::IndexModelSpec, status: models::IndexModelStatus) -> IndexModel { IndexModel { name, dimension, @@ -74,3 +64,4 @@ impl Default for Metric { Self::Cosine } } + diff --git a/src/openapi/models/index_model_spec.rs b/src/openapi/models/index_model_spec.rs index 30dbc2b..a69b786 100644 --- a/src/openapi/models/index_model_spec.rs +++ b/src/openapi/models/index_model_spec.rs @@ -27,3 +27,4 @@ impl IndexModelSpec { } } } + diff --git a/src/openapi/models/index_model_status.rs b/src/openapi/models/index_model_status.rs index cfbd242..960c96c 100644 --- a/src/openapi/models/index_model_status.rs +++ b/src/openapi/models/index_model_status.rs @@ -21,10 +21,13 @@ pub struct IndexModelStatus { impl IndexModelStatus { pub fn new(ready: bool, state: State) -> IndexModelStatus { - IndexModelStatus { ready, state } + IndexModelStatus { + ready, + state, + } } } -/// +/// #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum State { #[serde(rename = "Initializing")] @@ -50,3 +53,4 @@ impl Default for State { Self::Initializing } } + diff --git a/src/openapi/models/index_spec.rs b/src/openapi/models/index_spec.rs index 5b69823..656105e 100644 --- a/src/openapi/models/index_spec.rs +++ b/src/openapi/models/index_spec.rs @@ -11,7 +11,7 @@ use crate::openapi::models; use serde::{Deserialize, Serialize}; -/// IndexSpec : The spec object defines how the index should be deployed. For serverless indexes, you define only the [cloud and region](http://docs.pinecone.io/guides/indexes/understanding-indexes#cloud-regions) where the index should be hosted. For pod-based indexes, you define the [environment](http://docs.pinecone.io/guides/indexes/understanding-indexes#pod-environments) where the index should be hosted, the [pod type and size](http://docs.pinecone.io/guides/indexes/understanding-indexes#pod-types) to use, and other index characteristics. +/// IndexSpec : The spec object defines how the index should be deployed. For serverless indexes, you define only the [cloud and region](http://docs.pinecone.io/guides/index-data/create-an-index#cloud-regions) where the index should be hosted. For pod-based indexes, you define the [environment](http://docs.pinecone.io/guides/indexes/pods/understanding-pod-based-indexes#pod-environments) where the index should be hosted, the [pod type and size](http://docs.pinecone.io/guides/indexes/pods/understanding-pod-based-indexes#pod-types) to use, and other index characteristics. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct IndexSpec { #[serde(rename = "serverless", skip_serializing_if = "Option::is_none")] @@ -21,7 +21,7 @@ pub struct IndexSpec { } impl IndexSpec { - /// The spec object defines how the index should be deployed. For serverless indexes, you define only the [cloud and region](http://docs.pinecone.io/guides/indexes/understanding-indexes#cloud-regions) where the index should be hosted. For pod-based indexes, you define the [environment](http://docs.pinecone.io/guides/indexes/understanding-indexes#pod-environments) where the index should be hosted, the [pod type and size](http://docs.pinecone.io/guides/indexes/understanding-indexes#pod-types) to use, and other index characteristics. + /// The spec object defines how the index should be deployed. For serverless indexes, you define only the [cloud and region](http://docs.pinecone.io/guides/index-data/create-an-index#cloud-regions) where the index should be hosted. For pod-based indexes, you define the [environment](http://docs.pinecone.io/guides/indexes/pods/understanding-pod-based-indexes#pod-environments) where the index should be hosted, the [pod type and size](http://docs.pinecone.io/guides/indexes/pods/understanding-pod-based-indexes#pod-types) to use, and other index characteristics. pub fn new() -> IndexSpec { IndexSpec { serverless: None, @@ -29,3 +29,4 @@ impl IndexSpec { } } } + diff --git a/src/openapi/models/list_indexes_401_response.rs b/src/openapi/models/list_indexes_401_response.rs index fc93b4d..001e0b5 100644 --- a/src/openapi/models/list_indexes_401_response.rs +++ b/src/openapi/models/list_indexes_401_response.rs @@ -3,7 +3,7 @@ * * 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 + * The version of the OpenAPI document: unstable * Contact: support@pinecone.io * Generated by: https://openapi-generator.tech */ diff --git a/src/openapi/models/list_indexes_401_response_error.rs b/src/openapi/models/list_indexes_401_response_error.rs index 8fe9bd3..4d590d2 100644 --- a/src/openapi/models/list_indexes_401_response_error.rs +++ b/src/openapi/models/list_indexes_401_response_error.rs @@ -3,7 +3,7 @@ * * 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 + * The version of the OpenAPI document: unstable * Contact: support@pinecone.io * Generated by: https://openapi-generator.tech */ diff --git a/src/openapi/models/operation_model.rs b/src/openapi/models/operation_model.rs new file mode 100644 index 0000000..2a00091 --- /dev/null +++ b/src/openapi/models/operation_model.rs @@ -0,0 +1,55 @@ +/* + * 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: unstable + * Contact: support@pinecone.io + * Generated by: https://openapi-generator.tech + */ + +use crate::openapi::models; +use serde::{Deserialize, Serialize}; + +/// OperationModel : The OpeartionModel descriptions the status of an ongoing server operation +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationModel { + #[serde(rename = "operation_id")] + pub operation_id: String, + /// The status of the operation + #[serde(rename = "status")] + pub status: Status, + /// The progress made by the operation out of 100 + #[serde(rename = "percent_complete")] + pub percent_complete: f32, +} + +impl OperationModel { + /// The OpeartionModel descriptions the status of an ongoing server operation + pub fn new(operation_id: String, status: Status, percent_complete: f32) -> OperationModel { + OperationModel { + operation_id, + status, + percent_complete, + } + } +} +/// The status of the operation +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "Pending")] + Pending, + #[serde(rename = "Failed")] + Failed, + #[serde(rename = "Completed")] + Completed, + #[serde(rename = "Cancelled")] + Cancelled, +} + +impl Default for Status { + fn default() -> Status { + Self::Pending + } +} + diff --git a/src/openapi/models/pod_spec.rs b/src/openapi/models/pod_spec.rs index 4e37c4f..264dcd1 100644 --- a/src/openapi/models/pod_spec.rs +++ b/src/openapi/models/pod_spec.rs @@ -18,17 +18,17 @@ pub struct PodSpec { #[serde(rename = "environment")] pub environment: String, /// The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change. - #[serde(rename = "replicas")] - pub replicas: i32, + #[serde(rename = "replicas", skip_serializing_if = "Option::is_none")] + pub replicas: Option, /// The number of shards. Shards split your data across multiple pods so you can fit more data into an index. - #[serde(rename = "shards")] - pub shards: i32, + #[serde(rename = "shards", skip_serializing_if = "Option::is_none")] + pub shards: Option, /// The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`. #[serde(rename = "pod_type")] pub pod_type: String, /// The number of pods to be used in the index. This should be equal to `shards` x `replicas`.' - #[serde(rename = "pods")] - pub pods: i32, + #[serde(rename = "pods", skip_serializing_if = "Option::is_none")] + pub pods: Option, #[serde(rename = "metadata_config", skip_serializing_if = "Option::is_none")] pub metadata_config: Option>, /// The name of the collection to be used as the source for the index. @@ -38,21 +38,16 @@ pub struct PodSpec { impl PodSpec { /// Configuration needed to deploy a pod-based index. - pub fn new( - environment: String, - replicas: i32, - shards: i32, - pod_type: String, - pods: i32, - ) -> PodSpec { + pub fn new(environment: String, pod_type: String) -> PodSpec { PodSpec { environment, - replicas, - shards, + replicas: None, + shards: None, pod_type, - pods, + pods: None, metadata_config: None, source_collection: None, } } } + diff --git a/src/openapi/models/pod_spec_metadata_config.rs b/src/openapi/models/pod_spec_metadata_config.rs index 7eb8974..76c6bac 100644 --- a/src/openapi/models/pod_spec_metadata_config.rs +++ b/src/openapi/models/pod_spec_metadata_config.rs @@ -22,6 +22,9 @@ pub struct PodSpecMetadataConfig { impl PodSpecMetadataConfig { /// Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed. These configurations are only valid for use with pod-based indexes. pub fn new() -> PodSpecMetadataConfig { - PodSpecMetadataConfig { indexed: None } + PodSpecMetadataConfig { + indexed: None, + } } } + diff --git a/src/openapi/models/pod_upgrade_request.rs b/src/openapi/models/pod_upgrade_request.rs new file mode 100644 index 0000000..a73d37c --- /dev/null +++ b/src/openapi/models/pod_upgrade_request.rs @@ -0,0 +1,37 @@ +/* + * 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: unstable + * Contact: support@pinecone.io + * Generated by: https://openapi-generator.tech + */ + +use crate::openapi::models; +use serde::{Deserialize, Serialize}; + +/// PodUpgradeRequest : The configuration needed to upgrade an index. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PodUpgradeRequest { + /// 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 = "index_name")] + pub index_name: String, + /// 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 = "target_name")] + pub target_name: String, + #[serde(rename = "target")] + pub target: Box, +} + +impl PodUpgradeRequest { + /// The configuration needed to upgrade an index. + pub fn new(index_name: String, target_name: String, target: models::PodUpgradeTarget) -> PodUpgradeRequest { + PodUpgradeRequest { + index_name, + target_name, + target: Box::new(target), + } + } +} + diff --git a/src/openapi/models/pod_upgrade_target.rs b/src/openapi/models/pod_upgrade_target.rs new file mode 100644 index 0000000..136ac34 --- /dev/null +++ b/src/openapi/models/pod_upgrade_target.rs @@ -0,0 +1,29 @@ +/* + * 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: unstable + * Contact: support@pinecone.io + * Generated by: https://openapi-generator.tech + */ + +use crate::openapi::models; +use serde::{Deserialize, Serialize}; + +/// PodUpgradeTarget : The configuration for the target index. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PodUpgradeTarget { + #[serde(rename = "serverless", skip_serializing_if = "Option::is_none")] + pub serverless: Option>, +} + +impl PodUpgradeTarget { + /// The configuration for the target index. + pub fn new() -> PodUpgradeTarget { + PodUpgradeTarget { + serverless: None, + } + } +} + diff --git a/src/openapi/models/serverless_spec.rs b/src/openapi/models/serverless_spec.rs index bf1e68f..15ebd52 100644 --- a/src/openapi/models/serverless_spec.rs +++ b/src/openapi/models/serverless_spec.rs @@ -17,7 +17,7 @@ pub struct ServerlessSpec { /// The public cloud where you would like your index hosted. #[serde(rename = "cloud")] pub cloud: Cloud, - /// The region where you would like your index to be created. + /// The region where you would like your index to be created. #[serde(rename = "region")] pub region: String, } @@ -25,7 +25,10 @@ pub struct ServerlessSpec { impl ServerlessSpec { /// Configuration needed to deploy a serverless index. pub fn new(cloud: Cloud, region: String) -> ServerlessSpec { - ServerlessSpec { cloud, region } + ServerlessSpec { + cloud, + region, + } } } /// The public cloud where you would like your index hosted. @@ -44,3 +47,4 @@ impl Default for Cloud { Self::Gcp } } + diff --git a/src/openapi/models/upgrade_starter_request.rs b/src/openapi/models/upgrade_starter_request.rs new file mode 100644 index 0000000..2596edc --- /dev/null +++ b/src/openapi/models/upgrade_starter_request.rs @@ -0,0 +1,33 @@ +/* + * 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: unstable + * Contact: support@pinecone.io + * Generated by: https://openapi-generator.tech + */ + +use crate::openapi::models; +use serde::{Deserialize, Serialize}; + +/// UpgradeStarterRequest : The configuration needed to upgrade an index. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpgradeStarterRequest { + /// 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 = "index_name")] + pub index_name: String, + #[serde(rename = "target")] + pub target: Box, +} + +impl UpgradeStarterRequest { + /// The configuration needed to upgrade an index. + pub fn new(index_name: String, target: models::UpgradeStarterRequestTarget) -> UpgradeStarterRequest { + UpgradeStarterRequest { + index_name, + target: Box::new(target), + } + } +} + diff --git a/src/openapi/models/upgrade_starter_request_target.rs b/src/openapi/models/upgrade_starter_request_target.rs new file mode 100644 index 0000000..57c4c1e --- /dev/null +++ b/src/openapi/models/upgrade_starter_request_target.rs @@ -0,0 +1,29 @@ +/* + * 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: unstable + * Contact: support@pinecone.io + * Generated by: https://openapi-generator.tech + */ + +use crate::openapi::models; +use serde::{Deserialize, Serialize}; + +/// UpgradeStarterRequestTarget : The configuration for the target index. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpgradeStarterRequestTarget { + #[serde(rename = "serverless", skip_serializing_if = "Option::is_none")] + pub serverless: Option>, +} + +impl UpgradeStarterRequestTarget { + /// The configuration for the target index. + pub fn new() -> UpgradeStarterRequestTarget { + UpgradeStarterRequestTarget { + serverless: None, + } + } +} + diff --git a/src/openapi/models/upgrade_starter_request_target_serverless.rs b/src/openapi/models/upgrade_starter_request_target_serverless.rs new file mode 100644 index 0000000..29d667a --- /dev/null +++ b/src/openapi/models/upgrade_starter_request_target_serverless.rs @@ -0,0 +1,51 @@ +/* + * 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: unstable + * Contact: support@pinecone.io + * Generated by: https://openapi-generator.tech + */ + +use crate::openapi::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpgradeStarterRequestTargetServerless { + /// The public cloud where you would like your index hosted. Serverless indexes can be hosted only in AWS at this time. + #[serde(rename = "cloud")] + pub cloud: Cloud, + /// The region where you would like your index to be created. Serverless indexes can be created only in the us-east-1,us-west-2, and eu-west-1 regions of AWS at this time. + #[serde(rename = "region")] + pub region: String, + #[serde(rename = "source_collection", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub source_collection: Option>, +} + +impl UpgradeStarterRequestTargetServerless { + pub fn new(cloud: Cloud, region: String) -> UpgradeStarterRequestTargetServerless { + UpgradeStarterRequestTargetServerless { + cloud, + region, + source_collection: None, + } + } +} +/// The public cloud where you would like your index hosted. Serverless indexes can be hosted only in AWS at this time. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum Cloud { + #[serde(rename = "gcp")] + Gcp, + #[serde(rename = "aws")] + Aws, + #[serde(rename = "azure")] + Azure, +} + +impl Default for Cloud { + fn default() -> Cloud { + Self::Gcp + } +} + diff --git a/src/pinecone/control.rs b/src/pinecone/control.rs index 6c43f79..4359d4e 100644 --- a/src/pinecone/control.rs +++ b/src/pinecone/control.rs @@ -162,10 +162,10 @@ impl PineconeClient { let pod_spec = PodSpec { environment: environment.to_string(), - replicas, - shards, + replicas: Some(replicas), + shards: Some(shards), pod_type: pod_type.to_string(), - pods, + pods: Some(pods), metadata_config: Some(Box::new(PodSpecMetadataConfig { indexed })), source_collection: source_collection.map(|s| s.to_string()), }; @@ -1196,9 +1196,9 @@ mod tests { "imdb_rating".to_string() ]) ); - assert_eq!(pod_spec.pods, 1); - assert_eq!(pod_spec.replicas, 1); - assert_eq!(pod_spec.shards, 1); + assert_eq!(pod_spec.pods, Some(1)); + assert_eq!(pod_spec.replicas, Some(1)); + assert_eq!(pod_spec.shards, Some(1)); mock.assert(); @@ -1272,9 +1272,9 @@ mod tests { assert_eq!(pod_spec.environment, "us-east-1-aws"); assert_eq!(pod_spec.pod_type, "p1.x1"); assert_eq!(pod_spec.metadata_config.as_ref().unwrap().indexed, None); - assert_eq!(pod_spec.pods, 1); - assert_eq!(pod_spec.replicas, 1); - assert_eq!(pod_spec.shards, 1); + assert_eq!(pod_spec.pods, Some(1)); + assert_eq!(pod_spec.replicas, Some(1)); + assert_eq!(pod_spec.shards, Some(1)); mock.assert(); @@ -1595,7 +1595,7 @@ mod tests { assert_eq!(configure_index_response.name, "index-name"); let spec = configure_index_response.spec.pod.unwrap(); - assert_eq!(spec.replicas, 6); + assert_eq!(spec.replicas, Some(6)); assert_eq!(spec.pod_type.as_str(), "p1.x1"); mock.assert(); diff --git a/src/protos/mod.rs b/src/protos/mod.rs index 1ea4ebf..e2e9507 100644 --- a/src/protos/mod.rs +++ b/src/protos/mod.rs @@ -66,7 +66,7 @@ pub mod request_union { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpsertRequest { - /// An array containing the vectors to upsert. Recommended batch limit is 100 vectors. + /// An array containing the vectors to upsert. Recommended batch limit is up to 1000 vectors. #[prost(message, repeated, tag = "1")] pub vectors: ::prost::alloc::vec::Vec, /// The namespace where you upsert vectors. @@ -96,8 +96,7 @@ pub struct DeleteRequest { pub namespace: ::prost::alloc::string::String, /// If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive /// with specifying ids to delete in the ids param or using `delete_all=True`. - /// For guidance and examples, see [Filter with metadata](). - /// Serverless indexes do not support delete by metadata. Instead, you can use the `list` operation to fetch the vector IDs based on their common ID prefix and then delete the records by ID. + /// For guidance and examples, see [Delete data](). #[prost(message, optional, tag = "4")] pub filter: ::core::option::Option<::prost_types::Struct>, } @@ -204,7 +203,7 @@ pub struct QueryRequest { /// The number of results to return for each query. #[prost(uint32, tag = "2")] pub top_k: u32, - /// The filter to apply. You can use vector metadata to limit your search. See [Filter with metadata](). + /// The filter to apply. You can use vector metadata to limit your search. See [Understanding metadata](). You can use vector metadata to limit your search. See [Understanding metadata](). #[prost(message, optional, tag = "3")] pub filter: ::core::option::Option<::prost_types::Struct>, /// Indicates whether vector values are included in the response. @@ -213,17 +212,17 @@ pub struct QueryRequest { /// Indicates whether metadata is included in the response as well as the ids. #[prost(bool, tag = "5")] pub include_metadata: bool, - /// DEPRECATED. The query vectors. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`. + /// DEPRECATED. Use `vector` or `id` instead. #[deprecated] #[prost(message, repeated, tag = "6")] pub queries: ::prost::alloc::vec::Vec, - /// The query vector. This should be the same length as the dimension of the index being queried. Each `query()` request can contain only one of the parameters `id` or `vector`. + /// The query vector. This should be the same length as the dimension of the index being queried. Each request can contain either the `id` or `vector` parameter. #[prost(float, repeated, tag = "7")] pub vector: ::prost::alloc::vec::Vec, /// The query sparse values. #[prost(message, optional, tag = "9")] pub sparse_vector: ::core::option::Option, - /// The unique ID of the vector to be used as a query vector. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`. + /// The unique ID of the vector to be used as a query vector. Each request can contain either the `vector` or `id` parameter. #[prost(string, tag = "8")] pub id: ::prost::alloc::string::String, } @@ -260,8 +259,8 @@ pub struct QueryResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Usage { /// The number of read units consumed by this operation. - #[prost(uint32, optional, tag = "1")] - pub read_units: ::core::option::Option, + #[prost(float, optional, tag = "1")] + pub read_units: ::core::option::Option, } /// The request for the `update` operation. #[allow(clippy::derive_partial_eq_without_eq)] @@ -313,7 +312,10 @@ pub struct DescribeIndexStatsResponse { /// summary of its contents. If a metadata filter expression is present, the /// summary will reflect only vectors matching that expression. #[prost(map = "string, message", tag = "1")] - pub namespaces: ::std::collections::HashMap<::prost::alloc::string::String, NamespaceSummary>, + pub namespaces: ::std::collections::HashMap< + ::prost::alloc::string::String, + NamespaceSummary, + >, /// The dimension of the indexed vectors. #[prost(uint32, tag = "2")] pub dimension: u32, @@ -321,7 +323,7 @@ pub struct DescribeIndexStatsResponse { /// /// Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. /// - /// The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](). + /// The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](). #[prost(float, tag = "3")] pub index_fullness: f32, /// The total number of vectors in the index, regardless of whether a metadata filter expression was passed @@ -331,8 +333,8 @@ pub struct DescribeIndexStatsResponse { /// Generated client implementations. pub mod vector_service_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::http::Uri; use tonic::codegen::*; + use tonic::codegen::http::Uri; /// The `VectorService` interface is exposed by Pinecone's vector index services. /// This service could also be called a `gRPC` service or a `REST`-like api. #[derive(Debug, Clone)] @@ -378,8 +380,9 @@ pub mod vector_service_client { >::ResponseBody, >, >, - >>::Error: - Into + Send + Sync, + , + >>::Error: Into + Send + Sync, { VectorServiceClient::new(InterceptedService::new(inner, interceptor)) } @@ -418,66 +421,72 @@ pub mod vector_service_client { /// /// The `upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. /// - /// For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data). + /// For guidance, examples, and limits, see [Upsert data](https://docs.pinecone.io/guides/index-data/upsert-data). pub async fn upsert( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/VectorService/Upsert"); let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("VectorService", "Upsert")); + req.extensions_mut().insert(GrpcMethod::new("VectorService", "Upsert")); self.inner.unary(req, path, codec).await } /// Delete vectors /// /// The `delete` operation deletes vectors, by id, from a single namespace. /// - /// For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data). + /// For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/manage-data/delete-data). pub async fn delete( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/VectorService/Delete"); let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("VectorService", "Delete")); + req.extensions_mut().insert(GrpcMethod::new("VectorService", "Delete")); self.inner.unary(req, path, codec).await } /// Fetch vectors /// /// The `fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. /// - /// For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data). + /// For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/manage-data/fetch-data). pub async fn fetch( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/VectorService/Fetch"); let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("VectorService", "Fetch")); + req.extensions_mut().insert(GrpcMethod::new("VectorService", "Fetch")); self.inner.unary(req, path, codec).await } /// List vector IDs @@ -486,68 +495,74 @@ pub mod vector_service_client { /// /// `list` returns up to 100 IDs at a time by default in sorted order (bitwise/"C" collation). If the `limit` parameter is set, `list` returns up to that number of IDs instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of IDs. When the response does not include a `pagination_token`, there are no more IDs to return. /// - /// For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/data/list-record-ids). + /// For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/manage-data/list-record-ids). /// /// **Note:** `list` is supported only for serverless indexes. pub async fn list( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/VectorService/List"); let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("VectorService", "List")); + req.extensions_mut().insert(GrpcMethod::new("VectorService", "List")); self.inner.unary(req, path, codec).await } /// Query vectors /// /// The `query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. /// - /// For guidance and examples, see [Query data](https://docs.pinecone.io/guides/data/query-data). + /// For guidance, examples, and limits, see [Search](https://docs.pinecone.io/guides/search/search-overview). pub async fn query( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/VectorService/Query"); let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("VectorService", "Query")); + req.extensions_mut().insert(GrpcMethod::new("VectorService", "Query")); self.inner.unary(req, path, codec).await } /// Update a vector /// /// The `update` operation updates a vector in a namespace. If a value is included, it will overwrite the previous value. If a `set_metadata` is included, the values of the fields specified in it will be added or overwrite the previous value. /// - /// For guidance and examples, see [Update data](https://docs.pinecone.io/guides/data/update-data). + /// For guidance and examples, see [Update data](https://docs.pinecone.io/guides/manage-data/update-data). pub async fn update( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static("/VectorService/Update"); let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("VectorService", "Update")); + req.extensions_mut().insert(GrpcMethod::new("VectorService", "Update")); self.inner.unary(req, path, codec).await } /// Get index stats @@ -555,21 +570,26 @@ pub mod vector_service_client { /// The `describe_index_stats` operation returns statistics about the contents of an index, including the vector count per namespace, the number of dimensions, and the index fullness. /// /// Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. - /// - /// For pod-based indexes, the index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://docs.pinecone.io/reference/api/control-plane/describe_index). pub async fn describe_index_stats( &mut self, request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> - { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/VectorService/DescribeIndexStats"); + let path = http::uri::PathAndQuery::from_static( + "/VectorService/DescribeIndexStats", + ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("VectorService", "DescribeIndexStats")); @@ -588,7 +608,7 @@ pub mod vector_service_server { /// /// The `upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. /// - /// For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data). + /// For guidance, examples, and limits, see [Upsert data](https://docs.pinecone.io/guides/index-data/upsert-data). async fn upsert( &self, request: tonic::Request, @@ -597,7 +617,7 @@ pub mod vector_service_server { /// /// The `delete` operation deletes vectors, by id, from a single namespace. /// - /// For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data). + /// For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/manage-data/delete-data). async fn delete( &self, request: tonic::Request, @@ -606,7 +626,7 @@ pub mod vector_service_server { /// /// The `fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. /// - /// For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data). + /// For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/manage-data/fetch-data). async fn fetch( &self, request: tonic::Request, @@ -617,7 +637,7 @@ pub mod vector_service_server { /// /// `list` returns up to 100 IDs at a time by default in sorted order (bitwise/"C" collation). If the `limit` parameter is set, `list` returns up to that number of IDs instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of IDs. When the response does not include a `pagination_token`, there are no more IDs to return. /// - /// For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/data/list-record-ids). + /// For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/manage-data/list-record-ids). /// /// **Note:** `list` is supported only for serverless indexes. async fn list( @@ -628,7 +648,7 @@ pub mod vector_service_server { /// /// The `query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. /// - /// For guidance and examples, see [Query data](https://docs.pinecone.io/guides/data/query-data). + /// For guidance, examples, and limits, see [Search](https://docs.pinecone.io/guides/search/search-overview). async fn query( &self, request: tonic::Request, @@ -637,7 +657,7 @@ pub mod vector_service_server { /// /// The `update` operation updates a vector in a namespace. If a value is included, it will overwrite the previous value. If a `set_metadata` is included, the values of the fields specified in it will be added or overwrite the previous value. /// - /// For guidance and examples, see [Update data](https://docs.pinecone.io/guides/data/update-data). + /// For guidance and examples, see [Update data](https://docs.pinecone.io/guides/manage-data/update-data). async fn update( &self, request: tonic::Request, @@ -647,12 +667,13 @@ pub mod vector_service_server { /// The `describe_index_stats` operation returns statistics about the contents of an index, including the vector count per namespace, the number of dimensions, and the index fullness. /// /// Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. - /// - /// For pod-based indexes, the index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://docs.pinecone.io/reference/api/control-plane/describe_index). async fn describe_index_stats( &self, request: tonic::Request, - ) -> std::result::Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; } /// The `VectorService` interface is exposed by Pinecone's vector index services. /// This service could also be called a `gRPC` service or a `REST`-like api. @@ -679,7 +700,10 @@ pub mod vector_service_server { max_encoding_message_size: None, } } - pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService where F: tonic::service::Interceptor, { @@ -735,16 +759,23 @@ pub mod vector_service_server { "/VectorService/Upsert" => { #[allow(non_camel_case_types)] struct UpsertSvc(pub Arc); - impl tonic::server::UnaryService for UpsertSvc { + impl< + T: VectorService, + > tonic::server::UnaryService + for UpsertSvc { type Response = super::UpsertResponse; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = - async move { ::upsert(&inner, request).await }; + let fut = async move { + ::upsert(&inner, request).await + }; Box::pin(fut) } } @@ -774,16 +805,23 @@ pub mod vector_service_server { "/VectorService/Delete" => { #[allow(non_camel_case_types)] struct DeleteSvc(pub Arc); - impl tonic::server::UnaryService for DeleteSvc { + impl< + T: VectorService, + > tonic::server::UnaryService + for DeleteSvc { type Response = super::DeleteResponse; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = - async move { ::delete(&inner, request).await }; + let fut = async move { + ::delete(&inner, request).await + }; Box::pin(fut) } } @@ -813,16 +851,22 @@ pub mod vector_service_server { "/VectorService/Fetch" => { #[allow(non_camel_case_types)] struct FetchSvc(pub Arc); - impl tonic::server::UnaryService for FetchSvc { + impl< + T: VectorService, + > tonic::server::UnaryService for FetchSvc { type Response = super::FetchResponse; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = - async move { ::fetch(&inner, request).await }; + let fut = async move { + ::fetch(&inner, request).await + }; Box::pin(fut) } } @@ -852,16 +896,22 @@ pub mod vector_service_server { "/VectorService/List" => { #[allow(non_camel_case_types)] struct ListSvc(pub Arc); - impl tonic::server::UnaryService for ListSvc { + impl< + T: VectorService, + > tonic::server::UnaryService for ListSvc { type Response = super::ListResponse; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = - async move { ::list(&inner, request).await }; + let fut = async move { + ::list(&inner, request).await + }; Box::pin(fut) } } @@ -891,16 +941,22 @@ pub mod vector_service_server { "/VectorService/Query" => { #[allow(non_camel_case_types)] struct QuerySvc(pub Arc); - impl tonic::server::UnaryService for QuerySvc { + impl< + T: VectorService, + > tonic::server::UnaryService for QuerySvc { type Response = super::QueryResponse; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = - async move { ::query(&inner, request).await }; + let fut = async move { + ::query(&inner, request).await + }; Box::pin(fut) } } @@ -930,16 +986,23 @@ pub mod vector_service_server { "/VectorService/Update" => { #[allow(non_camel_case_types)] struct UpdateSvc(pub Arc); - impl tonic::server::UnaryService for UpdateSvc { + impl< + T: VectorService, + > tonic::server::UnaryService + for UpdateSvc { type Response = super::UpdateResponse; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = - async move { ::update(&inner, request).await }; + let fut = async move { + ::update(&inner, request).await + }; Box::pin(fut) } } @@ -969,19 +1032,23 @@ pub mod vector_service_server { "/VectorService/DescribeIndexStats" => { #[allow(non_camel_case_types)] struct DescribeIndexStatsSvc(pub Arc); - impl - tonic::server::UnaryService - for DescribeIndexStatsSvc - { + impl< + T: VectorService, + > tonic::server::UnaryService + for DescribeIndexStatsSvc { type Response = super::DescribeIndexStatsResponse; - type Future = BoxFuture, tonic::Status>; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::describe_index_stats(&inner, request).await + ::describe_index_stats(&inner, request) + .await }; Box::pin(fut) } @@ -1009,14 +1076,18 @@ pub mod vector_service_server { }; Box::pin(fut) } - _ => Box::pin(async move { - Ok(http::Response::builder() - .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") - .body(empty_body()) - .unwrap()) - }), + _ => { + Box::pin(async move { + Ok( + http::Response::builder() + .status(200) + .header("grpc-status", "12") + .header("content-type", "application/grpc") + .body(empty_body()) + .unwrap(), + ) + }) + } } } }