pinecone_sdk/protos/
mod.rs

1// This file is @generated by prost-build.
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct SparseValues {
5    #[prost(uint32, repeated, packed = "false", tag = "1")]
6    pub indices: ::prost::alloc::vec::Vec<u32>,
7    #[prost(float, repeated, packed = "false", tag = "2")]
8    pub values: ::prost::alloc::vec::Vec<f32>,
9}
10#[allow(clippy::derive_partial_eq_without_eq)]
11#[derive(Clone, PartialEq, ::prost::Message)]
12pub struct Vector {
13    /// This is the vector's unique id.
14    #[prost(string, tag = "1")]
15    pub id: ::prost::alloc::string::String,
16    /// This is the vector data included in the request.
17    #[prost(float, repeated, packed = "false", tag = "2")]
18    pub values: ::prost::alloc::vec::Vec<f32>,
19    #[prost(message, optional, tag = "4")]
20    pub sparse_values: ::core::option::Option<SparseValues>,
21    /// This is the metadata included in the request.
22    #[prost(message, optional, tag = "3")]
23    pub metadata: ::core::option::Option<::prost_types::Struct>,
24}
25#[allow(clippy::derive_partial_eq_without_eq)]
26#[derive(Clone, PartialEq, ::prost::Message)]
27pub struct ScoredVector {
28    /// This is the vector's unique id.
29    #[prost(string, tag = "1")]
30    pub id: ::prost::alloc::string::String,
31    /// This is a measure of similarity between this vector and the query vector.  The higher the score, the more they are similar.
32    #[prost(float, tag = "2")]
33    pub score: f32,
34    /// This is the vector data, if it is requested.
35    #[prost(float, repeated, tag = "3")]
36    pub values: ::prost::alloc::vec::Vec<f32>,
37    /// This is the sparse data, if it is requested.
38    #[prost(message, optional, tag = "5")]
39    pub sparse_values: ::core::option::Option<SparseValues>,
40    /// This is the metadata, if it is requested.
41    #[prost(message, optional, tag = "4")]
42    pub metadata: ::core::option::Option<::prost_types::Struct>,
43}
44/// This is a container to hold mutating vector requests. This is not actually used
45/// in any public APIs.
46#[allow(clippy::derive_partial_eq_without_eq)]
47#[derive(Clone, PartialEq, ::prost::Message)]
48pub struct RequestUnion {
49    #[prost(oneof = "request_union::RequestUnionInner", tags = "1, 2, 3")]
50    pub request_union_inner: ::core::option::Option<request_union::RequestUnionInner>,
51}
52/// Nested message and enum types in `RequestUnion`.
53pub mod request_union {
54    #[allow(clippy::derive_partial_eq_without_eq)]
55    #[derive(Clone, PartialEq, ::prost::Oneof)]
56    pub enum RequestUnionInner {
57        #[prost(message, tag = "1")]
58        Upsert(super::UpsertRequest),
59        #[prost(message, tag = "2")]
60        Delete(super::DeleteRequest),
61        #[prost(message, tag = "3")]
62        Update(super::UpdateRequest),
63    }
64}
65/// The request for the `upsert` operation.
66#[allow(clippy::derive_partial_eq_without_eq)]
67#[derive(Clone, PartialEq, ::prost::Message)]
68pub struct UpsertRequest {
69    /// An array containing the vectors to upsert. Recommended batch limit is 100 vectors.
70    #[prost(message, repeated, tag = "1")]
71    pub vectors: ::prost::alloc::vec::Vec<Vector>,
72    /// The namespace where you upsert vectors.
73    #[prost(string, tag = "2")]
74    pub namespace: ::prost::alloc::string::String,
75}
76/// The response for the `upsert` operation.
77#[allow(clippy::derive_partial_eq_without_eq)]
78#[derive(Clone, PartialEq, ::prost::Message)]
79pub struct UpsertResponse {
80    /// The number of vectors upserted.
81    #[prost(uint32, tag = "1")]
82    pub upserted_count: u32,
83}
84/// The request for the `Delete` operation.
85#[allow(clippy::derive_partial_eq_without_eq)]
86#[derive(Clone, PartialEq, ::prost::Message)]
87pub struct DeleteRequest {
88    /// Vectors to delete.
89    #[prost(string, repeated, tag = "1")]
90    pub ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
91    /// This indicates that all vectors in the index namespace should be deleted.
92    #[prost(bool, tag = "2")]
93    pub delete_all: bool,
94    /// The namespace to delete vectors from, if applicable.
95    #[prost(string, tag = "3")]
96    pub namespace: ::prost::alloc::string::String,
97    /// If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive
98    /// with specifying ids to delete in the ids param or using `delete_all=True`.
99    /// For guidance and examples, see [Filter with metadata](<https://docs.pinecone.io/guides/data/filter-with-metadata>).
100    /// 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.
101    #[prost(message, optional, tag = "4")]
102    pub filter: ::core::option::Option<::prost_types::Struct>,
103}
104/// The response for the `Delete` operation.
105#[allow(clippy::derive_partial_eq_without_eq)]
106#[derive(Clone, PartialEq, ::prost::Message)]
107pub struct DeleteResponse {}
108/// The request for the `fetch` operation.
109#[allow(clippy::derive_partial_eq_without_eq)]
110#[derive(Clone, PartialEq, ::prost::Message)]
111pub struct FetchRequest {
112    /// The vector IDs to fetch. Does not accept values containing spaces.
113    #[prost(string, repeated, tag = "1")]
114    pub ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
115    #[prost(string, tag = "2")]
116    pub namespace: ::prost::alloc::string::String,
117}
118/// The response for the `fetch` operation.
119#[allow(clippy::derive_partial_eq_without_eq)]
120#[derive(Clone, PartialEq, ::prost::Message)]
121pub struct FetchResponse {
122    /// The fetched vectors, in the form of a map between the fetched ids and the fetched vectors
123    #[prost(map = "string, message", tag = "1")]
124    pub vectors: ::std::collections::HashMap<::prost::alloc::string::String, Vector>,
125    /// The namespace of the vectors.
126    #[prost(string, tag = "2")]
127    pub namespace: ::prost::alloc::string::String,
128    ///   The usage for this operation.
129    #[prost(message, optional, tag = "3")]
130    pub usage: ::core::option::Option<Usage>,
131}
132/// The request for the `List` operation.
133#[allow(clippy::derive_partial_eq_without_eq)]
134#[derive(Clone, PartialEq, ::prost::Message)]
135pub struct ListRequest {
136    /// The vector IDs to fetch. Does not accept values containing spaces.
137    #[prost(string, optional, tag = "1")]
138    pub prefix: ::core::option::Option<::prost::alloc::string::String>,
139    /// Max number of ids to return
140    #[prost(uint32, optional, tag = "2")]
141    pub limit: ::core::option::Option<u32>,
142    /// Pagination token to continue a previous listing operation
143    #[prost(string, optional, tag = "3")]
144    pub pagination_token: ::core::option::Option<::prost::alloc::string::String>,
145    #[prost(string, tag = "4")]
146    pub namespace: ::prost::alloc::string::String,
147}
148#[allow(clippy::derive_partial_eq_without_eq)]
149#[derive(Clone, PartialEq, ::prost::Message)]
150pub struct Pagination {
151    #[prost(string, tag = "1")]
152    pub next: ::prost::alloc::string::String,
153}
154#[allow(clippy::derive_partial_eq_without_eq)]
155#[derive(Clone, PartialEq, ::prost::Message)]
156pub struct ListItem {
157    #[prost(string, tag = "1")]
158    pub id: ::prost::alloc::string::String,
159}
160/// The response for the `List` operation.
161#[allow(clippy::derive_partial_eq_without_eq)]
162#[derive(Clone, PartialEq, ::prost::Message)]
163pub struct ListResponse {
164    /// A list of ids
165    #[prost(message, repeated, tag = "1")]
166    pub vectors: ::prost::alloc::vec::Vec<ListItem>,
167    /// Pagination token to continue past this listing
168    #[prost(message, optional, tag = "2")]
169    pub pagination: ::core::option::Option<Pagination>,
170    /// The namespace of the vectors.
171    #[prost(string, tag = "3")]
172    pub namespace: ::prost::alloc::string::String,
173    ///   The usage for this operation.
174    #[prost(message, optional, tag = "4")]
175    pub usage: ::core::option::Option<Usage>,
176}
177/// A single query vector within a `QueryRequest`.
178#[allow(clippy::derive_partial_eq_without_eq)]
179#[derive(Clone, PartialEq, ::prost::Message)]
180pub struct QueryVector {
181    /// The query vector values. This should be the same length as the dimension of the index being queried.
182    #[prost(float, repeated, packed = "false", tag = "1")]
183    pub values: ::prost::alloc::vec::Vec<f32>,
184    /// The query sparse values.
185    #[prost(message, optional, tag = "5")]
186    pub sparse_values: ::core::option::Option<SparseValues>,
187    /// An override for the number of results to return for this query vector.
188    #[prost(uint32, tag = "2")]
189    pub top_k: u32,
190    /// An override the namespace to search.
191    #[prost(string, tag = "3")]
192    pub namespace: ::prost::alloc::string::String,
193    /// An override for the metadata filter to apply. This replaces the request-level filter.
194    #[prost(message, optional, tag = "4")]
195    pub filter: ::core::option::Option<::prost_types::Struct>,
196}
197/// The request for the `query` operation.
198#[allow(clippy::derive_partial_eq_without_eq)]
199#[derive(Clone, PartialEq, ::prost::Message)]
200pub struct QueryRequest {
201    /// The namespace to query.
202    #[prost(string, tag = "1")]
203    pub namespace: ::prost::alloc::string::String,
204    /// The number of results to return for each query.
205    #[prost(uint32, tag = "2")]
206    pub top_k: u32,
207    /// The filter to apply. You can use vector metadata to limit your search. See [Filter with metadata](<https://docs.pinecone.io/guides/data/filter-with-metadata>).
208    #[prost(message, optional, tag = "3")]
209    pub filter: ::core::option::Option<::prost_types::Struct>,
210    /// Indicates whether vector values are included in the response.
211    #[prost(bool, tag = "4")]
212    pub include_values: bool,
213    /// Indicates whether metadata is included in the response as well as the ids.
214    #[prost(bool, tag = "5")]
215    pub include_metadata: bool,
216    /// DEPRECATED. The query vectors. Each `query()` request can contain only one of the parameters `queries`, `vector`, or  `id`.
217    #[deprecated]
218    #[prost(message, repeated, tag = "6")]
219    pub queries: ::prost::alloc::vec::Vec<QueryVector>,
220    /// 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`.
221    #[prost(float, repeated, tag = "7")]
222    pub vector: ::prost::alloc::vec::Vec<f32>,
223    /// The query sparse values.
224    #[prost(message, optional, tag = "9")]
225    pub sparse_vector: ::core::option::Option<SparseValues>,
226    /// 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`.
227    #[prost(string, tag = "8")]
228    pub id: ::prost::alloc::string::String,
229}
230/// The query results for a single `QueryVector`
231#[allow(clippy::derive_partial_eq_without_eq)]
232#[derive(Clone, PartialEq, ::prost::Message)]
233pub struct SingleQueryResults {
234    /// The matches for the vectors.
235    #[prost(message, repeated, tag = "1")]
236    pub matches: ::prost::alloc::vec::Vec<ScoredVector>,
237    /// The namespace for the vectors.
238    #[prost(string, tag = "2")]
239    pub namespace: ::prost::alloc::string::String,
240}
241/// The response for the `query` operation. These are the matches found for a particular query vector. The matches are ordered from most similar to least similar.
242#[allow(clippy::derive_partial_eq_without_eq)]
243#[derive(Clone, PartialEq, ::prost::Message)]
244pub struct QueryResponse {
245    /// DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`.
246    #[deprecated]
247    #[prost(message, repeated, tag = "1")]
248    pub results: ::prost::alloc::vec::Vec<SingleQueryResults>,
249    /// The matches for the vectors.
250    #[prost(message, repeated, tag = "2")]
251    pub matches: ::prost::alloc::vec::Vec<ScoredVector>,
252    /// The namespace for the vectors.
253    #[prost(string, tag = "3")]
254    pub namespace: ::prost::alloc::string::String,
255    /// The usage for this operation.
256    #[prost(message, optional, tag = "4")]
257    pub usage: ::core::option::Option<Usage>,
258}
259#[allow(clippy::derive_partial_eq_without_eq)]
260#[derive(Clone, PartialEq, ::prost::Message)]
261pub struct Usage {
262    /// The number of read units consumed by this operation.
263    #[prost(uint32, optional, tag = "1")]
264    pub read_units: ::core::option::Option<u32>,
265}
266/// The request for the `update` operation.
267#[allow(clippy::derive_partial_eq_without_eq)]
268#[derive(Clone, PartialEq, ::prost::Message)]
269pub struct UpdateRequest {
270    /// Vector's unique id.
271    #[prost(string, tag = "1")]
272    pub id: ::prost::alloc::string::String,
273    /// Vector data.
274    #[prost(float, repeated, tag = "2")]
275    pub values: ::prost::alloc::vec::Vec<f32>,
276    #[prost(message, optional, tag = "5")]
277    pub sparse_values: ::core::option::Option<SparseValues>,
278    /// Metadata to set for the vector.
279    #[prost(message, optional, tag = "3")]
280    pub set_metadata: ::core::option::Option<::prost_types::Struct>,
281    /// The namespace containing the vector to update.
282    #[prost(string, tag = "4")]
283    pub namespace: ::prost::alloc::string::String,
284}
285/// The response for the `update` operation.
286#[allow(clippy::derive_partial_eq_without_eq)]
287#[derive(Clone, PartialEq, ::prost::Message)]
288pub struct UpdateResponse {}
289/// The request for the `describe_index_stats` operation.
290#[allow(clippy::derive_partial_eq_without_eq)]
291#[derive(Clone, PartialEq, ::prost::Message)]
292pub struct DescribeIndexStatsRequest {
293    /// If this parameter is present, the operation only returns statistics
294    /// for vectors that satisfy the filter.
295    /// See <https://docs.pinecone.io/guides/data/filtering-with-metadata.>
296    #[prost(message, optional, tag = "1")]
297    pub filter: ::core::option::Option<::prost_types::Struct>,
298}
299/// A summary of the contents of a namespace.
300#[allow(clippy::derive_partial_eq_without_eq)]
301#[derive(Clone, PartialEq, ::prost::Message)]
302pub struct NamespaceSummary {
303    /// The number of vectors stored in this namespace. Note that updates to this field may lag behind updates to the
304    /// underlying index and corresponding query results, etc.
305    #[prost(uint32, tag = "1")]
306    pub vector_count: u32,
307}
308/// The response for the `describe_index_stats` operation.
309#[allow(clippy::derive_partial_eq_without_eq)]
310#[derive(Clone, PartialEq, ::prost::Message)]
311pub struct DescribeIndexStatsResponse {
312    /// A mapping for each namespace in the index from the namespace name to a
313    /// summary of its contents. If a metadata filter expression is present, the
314    /// summary will reflect only vectors matching that expression.
315    #[prost(map = "string, message", tag = "1")]
316    pub namespaces: ::std::collections::HashMap<
317        ::prost::alloc::string::String,
318        NamespaceSummary,
319    >,
320    /// The dimension of the indexed vectors.
321    #[prost(uint32, tag = "2")]
322    pub dimension: u32,
323    /// The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%.
324    ///
325    /// Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes.
326    ///
327    /// 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>).
328    #[prost(float, tag = "3")]
329    pub index_fullness: f32,
330    /// The total number of vectors in the index, regardless of whether a metadata filter expression was passed
331    #[prost(uint32, tag = "4")]
332    pub total_vector_count: u32,
333}
334/// Generated client implementations.
335pub mod vector_service_client {
336    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
337    use tonic::codegen::*;
338    use tonic::codegen::http::Uri;
339    /// The `VectorService` interface is exposed by Pinecone's vector index services.
340    /// This service could also be called a `gRPC` service or a `REST`-like api.
341    #[derive(Debug, Clone)]
342    pub struct VectorServiceClient<T> {
343        inner: tonic::client::Grpc<T>,
344    }
345    impl VectorServiceClient<tonic::transport::Channel> {
346        /// Attempt to create a new client by connecting to a given endpoint.
347        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
348        where
349            D: TryInto<tonic::transport::Endpoint>,
350            D::Error: Into<StdError>,
351        {
352            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
353            Ok(Self::new(conn))
354        }
355    }
356    impl<T> VectorServiceClient<T>
357    where
358        T: tonic::client::GrpcService<tonic::body::BoxBody>,
359        T::Error: Into<StdError>,
360        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
361        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
362    {
363        pub fn new(inner: T) -> Self {
364            let inner = tonic::client::Grpc::new(inner);
365            Self { inner }
366        }
367        pub fn with_origin(inner: T, origin: Uri) -> Self {
368            let inner = tonic::client::Grpc::with_origin(inner, origin);
369            Self { inner }
370        }
371        pub fn with_interceptor<F>(
372            inner: T,
373            interceptor: F,
374        ) -> VectorServiceClient<InterceptedService<T, F>>
375        where
376            F: tonic::service::Interceptor,
377            T::ResponseBody: Default,
378            T: tonic::codegen::Service<
379                http::Request<tonic::body::BoxBody>,
380                Response = http::Response<
381                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
382                >,
383            >,
384            <T as tonic::codegen::Service<
385                http::Request<tonic::body::BoxBody>,
386            >>::Error: Into<StdError> + Send + Sync,
387        {
388            VectorServiceClient::new(InterceptedService::new(inner, interceptor))
389        }
390        /// Compress requests with the given encoding.
391        ///
392        /// This requires the server to support it otherwise it might respond with an
393        /// error.
394        #[must_use]
395        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
396            self.inner = self.inner.send_compressed(encoding);
397            self
398        }
399        /// Enable decompressing responses.
400        #[must_use]
401        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
402            self.inner = self.inner.accept_compressed(encoding);
403            self
404        }
405        /// Limits the maximum size of a decoded message.
406        ///
407        /// Default: `4MB`
408        #[must_use]
409        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
410            self.inner = self.inner.max_decoding_message_size(limit);
411            self
412        }
413        /// Limits the maximum size of an encoded message.
414        ///
415        /// Default: `usize::MAX`
416        #[must_use]
417        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
418            self.inner = self.inner.max_encoding_message_size(limit);
419            self
420        }
421        /// Upsert vectors
422        ///
423        /// 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.
424        ///
425        /// For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data).
426        pub async fn upsert(
427            &mut self,
428            request: impl tonic::IntoRequest<super::UpsertRequest>,
429        ) -> std::result::Result<tonic::Response<super::UpsertResponse>, tonic::Status> {
430            self.inner
431                .ready()
432                .await
433                .map_err(|e| {
434                    tonic::Status::new(
435                        tonic::Code::Unknown,
436                        format!("Service was not ready: {}", e.into()),
437                    )
438                })?;
439            let codec = tonic::codec::ProstCodec::default();
440            let path = http::uri::PathAndQuery::from_static("/VectorService/Upsert");
441            let mut req = request.into_request();
442            req.extensions_mut().insert(GrpcMethod::new("VectorService", "Upsert"));
443            self.inner.unary(req, path, codec).await
444        }
445        /// Delete vectors
446        ///
447        /// The `delete` operation deletes vectors, by id, from a single namespace.
448        ///
449        /// For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data).
450        pub async fn delete(
451            &mut self,
452            request: impl tonic::IntoRequest<super::DeleteRequest>,
453        ) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status> {
454            self.inner
455                .ready()
456                .await
457                .map_err(|e| {
458                    tonic::Status::new(
459                        tonic::Code::Unknown,
460                        format!("Service was not ready: {}", e.into()),
461                    )
462                })?;
463            let codec = tonic::codec::ProstCodec::default();
464            let path = http::uri::PathAndQuery::from_static("/VectorService/Delete");
465            let mut req = request.into_request();
466            req.extensions_mut().insert(GrpcMethod::new("VectorService", "Delete"));
467            self.inner.unary(req, path, codec).await
468        }
469        /// Fetch vectors
470        ///
471        /// The `fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata.
472        ///
473        /// For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data).
474        pub async fn fetch(
475            &mut self,
476            request: impl tonic::IntoRequest<super::FetchRequest>,
477        ) -> std::result::Result<tonic::Response<super::FetchResponse>, tonic::Status> {
478            self.inner
479                .ready()
480                .await
481                .map_err(|e| {
482                    tonic::Status::new(
483                        tonic::Code::Unknown,
484                        format!("Service was not ready: {}", e.into()),
485                    )
486                })?;
487            let codec = tonic::codec::ProstCodec::default();
488            let path = http::uri::PathAndQuery::from_static("/VectorService/Fetch");
489            let mut req = request.into_request();
490            req.extensions_mut().insert(GrpcMethod::new("VectorService", "Fetch"));
491            self.inner.unary(req, path, codec).await
492        }
493        /// List vector IDs
494        ///
495        /// The `list` operation lists the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix.
496        ///
497        /// `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.
498        ///
499        /// For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/data/list-record-ids).
500        ///
501        /// **Note:** `list` is supported only for serverless indexes.
502        pub async fn list(
503            &mut self,
504            request: impl tonic::IntoRequest<super::ListRequest>,
505        ) -> std::result::Result<tonic::Response<super::ListResponse>, tonic::Status> {
506            self.inner
507                .ready()
508                .await
509                .map_err(|e| {
510                    tonic::Status::new(
511                        tonic::Code::Unknown,
512                        format!("Service was not ready: {}", e.into()),
513                    )
514                })?;
515            let codec = tonic::codec::ProstCodec::default();
516            let path = http::uri::PathAndQuery::from_static("/VectorService/List");
517            let mut req = request.into_request();
518            req.extensions_mut().insert(GrpcMethod::new("VectorService", "List"));
519            self.inner.unary(req, path, codec).await
520        }
521        /// Query vectors
522        ///
523        /// 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.
524        ///
525        /// For guidance and examples, see [Query data](https://docs.pinecone.io/guides/data/query-data).
526        pub async fn query(
527            &mut self,
528            request: impl tonic::IntoRequest<super::QueryRequest>,
529        ) -> std::result::Result<tonic::Response<super::QueryResponse>, tonic::Status> {
530            self.inner
531                .ready()
532                .await
533                .map_err(|e| {
534                    tonic::Status::new(
535                        tonic::Code::Unknown,
536                        format!("Service was not ready: {}", e.into()),
537                    )
538                })?;
539            let codec = tonic::codec::ProstCodec::default();
540            let path = http::uri::PathAndQuery::from_static("/VectorService/Query");
541            let mut req = request.into_request();
542            req.extensions_mut().insert(GrpcMethod::new("VectorService", "Query"));
543            self.inner.unary(req, path, codec).await
544        }
545        /// Update a vector
546        ///
547        /// 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.
548        ///
549        /// For guidance and examples, see [Update data](https://docs.pinecone.io/guides/data/update-data).
550        pub async fn update(
551            &mut self,
552            request: impl tonic::IntoRequest<super::UpdateRequest>,
553        ) -> std::result::Result<tonic::Response<super::UpdateResponse>, tonic::Status> {
554            self.inner
555                .ready()
556                .await
557                .map_err(|e| {
558                    tonic::Status::new(
559                        tonic::Code::Unknown,
560                        format!("Service was not ready: {}", e.into()),
561                    )
562                })?;
563            let codec = tonic::codec::ProstCodec::default();
564            let path = http::uri::PathAndQuery::from_static("/VectorService/Update");
565            let mut req = request.into_request();
566            req.extensions_mut().insert(GrpcMethod::new("VectorService", "Update"));
567            self.inner.unary(req, path, codec).await
568        }
569        /// Get index stats
570        ///
571        /// 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.
572        ///
573        /// Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes.
574        ///
575        /// 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).
576        pub async fn describe_index_stats(
577            &mut self,
578            request: impl tonic::IntoRequest<super::DescribeIndexStatsRequest>,
579        ) -> std::result::Result<
580            tonic::Response<super::DescribeIndexStatsResponse>,
581            tonic::Status,
582        > {
583            self.inner
584                .ready()
585                .await
586                .map_err(|e| {
587                    tonic::Status::new(
588                        tonic::Code::Unknown,
589                        format!("Service was not ready: {}", e.into()),
590                    )
591                })?;
592            let codec = tonic::codec::ProstCodec::default();
593            let path = http::uri::PathAndQuery::from_static(
594                "/VectorService/DescribeIndexStats",
595            );
596            let mut req = request.into_request();
597            req.extensions_mut()
598                .insert(GrpcMethod::new("VectorService", "DescribeIndexStats"));
599            self.inner.unary(req, path, codec).await
600        }
601    }
602}
603/// Generated server implementations.
604pub mod vector_service_server {
605    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
606    use tonic::codegen::*;
607    /// Generated trait containing gRPC methods that should be implemented for use with VectorServiceServer.
608    #[async_trait]
609    pub trait VectorService: Send + Sync + 'static {
610        /// Upsert vectors
611        ///
612        /// 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.
613        ///
614        /// For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data).
615        async fn upsert(
616            &self,
617            request: tonic::Request<super::UpsertRequest>,
618        ) -> std::result::Result<tonic::Response<super::UpsertResponse>, tonic::Status>;
619        /// Delete vectors
620        ///
621        /// The `delete` operation deletes vectors, by id, from a single namespace.
622        ///
623        /// For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data).
624        async fn delete(
625            &self,
626            request: tonic::Request<super::DeleteRequest>,
627        ) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status>;
628        /// Fetch vectors
629        ///
630        /// The `fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata.
631        ///
632        /// For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data).
633        async fn fetch(
634            &self,
635            request: tonic::Request<super::FetchRequest>,
636        ) -> std::result::Result<tonic::Response<super::FetchResponse>, tonic::Status>;
637        /// List vector IDs
638        ///
639        /// The `list` operation lists the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix.
640        ///
641        /// `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.
642        ///
643        /// For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/data/list-record-ids).
644        ///
645        /// **Note:** `list` is supported only for serverless indexes.
646        async fn list(
647            &self,
648            request: tonic::Request<super::ListRequest>,
649        ) -> std::result::Result<tonic::Response<super::ListResponse>, tonic::Status>;
650        /// Query vectors
651        ///
652        /// 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.
653        ///
654        /// For guidance and examples, see [Query data](https://docs.pinecone.io/guides/data/query-data).
655        async fn query(
656            &self,
657            request: tonic::Request<super::QueryRequest>,
658        ) -> std::result::Result<tonic::Response<super::QueryResponse>, tonic::Status>;
659        /// Update a vector
660        ///
661        /// 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.
662        ///
663        /// For guidance and examples, see [Update data](https://docs.pinecone.io/guides/data/update-data).
664        async fn update(
665            &self,
666            request: tonic::Request<super::UpdateRequest>,
667        ) -> std::result::Result<tonic::Response<super::UpdateResponse>, tonic::Status>;
668        /// Get index stats
669        ///
670        /// 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.
671        ///
672        /// Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes.
673        ///
674        /// 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).
675        async fn describe_index_stats(
676            &self,
677            request: tonic::Request<super::DescribeIndexStatsRequest>,
678        ) -> std::result::Result<
679            tonic::Response<super::DescribeIndexStatsResponse>,
680            tonic::Status,
681        >;
682    }
683    /// The `VectorService` interface is exposed by Pinecone's vector index services.
684    /// This service could also be called a `gRPC` service or a `REST`-like api.
685    #[derive(Debug)]
686    pub struct VectorServiceServer<T: VectorService> {
687        inner: _Inner<T>,
688        accept_compression_encodings: EnabledCompressionEncodings,
689        send_compression_encodings: EnabledCompressionEncodings,
690        max_decoding_message_size: Option<usize>,
691        max_encoding_message_size: Option<usize>,
692    }
693    struct _Inner<T>(Arc<T>);
694    impl<T: VectorService> VectorServiceServer<T> {
695        pub fn new(inner: T) -> Self {
696            Self::from_arc(Arc::new(inner))
697        }
698        pub fn from_arc(inner: Arc<T>) -> Self {
699            let inner = _Inner(inner);
700            Self {
701                inner,
702                accept_compression_encodings: Default::default(),
703                send_compression_encodings: Default::default(),
704                max_decoding_message_size: None,
705                max_encoding_message_size: None,
706            }
707        }
708        pub fn with_interceptor<F>(
709            inner: T,
710            interceptor: F,
711        ) -> InterceptedService<Self, F>
712        where
713            F: tonic::service::Interceptor,
714        {
715            InterceptedService::new(Self::new(inner), interceptor)
716        }
717        /// Enable decompressing requests with the given encoding.
718        #[must_use]
719        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
720            self.accept_compression_encodings.enable(encoding);
721            self
722        }
723        /// Compress responses with the given encoding, if the client supports it.
724        #[must_use]
725        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
726            self.send_compression_encodings.enable(encoding);
727            self
728        }
729        /// Limits the maximum size of a decoded message.
730        ///
731        /// Default: `4MB`
732        #[must_use]
733        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
734            self.max_decoding_message_size = Some(limit);
735            self
736        }
737        /// Limits the maximum size of an encoded message.
738        ///
739        /// Default: `usize::MAX`
740        #[must_use]
741        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
742            self.max_encoding_message_size = Some(limit);
743            self
744        }
745    }
746    impl<T, B> tonic::codegen::Service<http::Request<B>> for VectorServiceServer<T>
747    where
748        T: VectorService,
749        B: Body + Send + 'static,
750        B::Error: Into<StdError> + Send + 'static,
751    {
752        type Response = http::Response<tonic::body::BoxBody>;
753        type Error = std::convert::Infallible;
754        type Future = BoxFuture<Self::Response, Self::Error>;
755        fn poll_ready(
756            &mut self,
757            _cx: &mut Context<'_>,
758        ) -> Poll<std::result::Result<(), Self::Error>> {
759            Poll::Ready(Ok(()))
760        }
761        fn call(&mut self, req: http::Request<B>) -> Self::Future {
762            let inner = self.inner.clone();
763            match req.uri().path() {
764                "/VectorService/Upsert" => {
765                    #[allow(non_camel_case_types)]
766                    struct UpsertSvc<T: VectorService>(pub Arc<T>);
767                    impl<
768                        T: VectorService,
769                    > tonic::server::UnaryService<super::UpsertRequest>
770                    for UpsertSvc<T> {
771                        type Response = super::UpsertResponse;
772                        type Future = BoxFuture<
773                            tonic::Response<Self::Response>,
774                            tonic::Status,
775                        >;
776                        fn call(
777                            &mut self,
778                            request: tonic::Request<super::UpsertRequest>,
779                        ) -> Self::Future {
780                            let inner = Arc::clone(&self.0);
781                            let fut = async move {
782                                <T as VectorService>::upsert(&inner, request).await
783                            };
784                            Box::pin(fut)
785                        }
786                    }
787                    let accept_compression_encodings = self.accept_compression_encodings;
788                    let send_compression_encodings = self.send_compression_encodings;
789                    let max_decoding_message_size = self.max_decoding_message_size;
790                    let max_encoding_message_size = self.max_encoding_message_size;
791                    let inner = self.inner.clone();
792                    let fut = async move {
793                        let inner = inner.0;
794                        let method = UpsertSvc(inner);
795                        let codec = tonic::codec::ProstCodec::default();
796                        let mut grpc = tonic::server::Grpc::new(codec)
797                            .apply_compression_config(
798                                accept_compression_encodings,
799                                send_compression_encodings,
800                            )
801                            .apply_max_message_size_config(
802                                max_decoding_message_size,
803                                max_encoding_message_size,
804                            );
805                        let res = grpc.unary(method, req).await;
806                        Ok(res)
807                    };
808                    Box::pin(fut)
809                }
810                "/VectorService/Delete" => {
811                    #[allow(non_camel_case_types)]
812                    struct DeleteSvc<T: VectorService>(pub Arc<T>);
813                    impl<
814                        T: VectorService,
815                    > tonic::server::UnaryService<super::DeleteRequest>
816                    for DeleteSvc<T> {
817                        type Response = super::DeleteResponse;
818                        type Future = BoxFuture<
819                            tonic::Response<Self::Response>,
820                            tonic::Status,
821                        >;
822                        fn call(
823                            &mut self,
824                            request: tonic::Request<super::DeleteRequest>,
825                        ) -> Self::Future {
826                            let inner = Arc::clone(&self.0);
827                            let fut = async move {
828                                <T as VectorService>::delete(&inner, request).await
829                            };
830                            Box::pin(fut)
831                        }
832                    }
833                    let accept_compression_encodings = self.accept_compression_encodings;
834                    let send_compression_encodings = self.send_compression_encodings;
835                    let max_decoding_message_size = self.max_decoding_message_size;
836                    let max_encoding_message_size = self.max_encoding_message_size;
837                    let inner = self.inner.clone();
838                    let fut = async move {
839                        let inner = inner.0;
840                        let method = DeleteSvc(inner);
841                        let codec = tonic::codec::ProstCodec::default();
842                        let mut grpc = tonic::server::Grpc::new(codec)
843                            .apply_compression_config(
844                                accept_compression_encodings,
845                                send_compression_encodings,
846                            )
847                            .apply_max_message_size_config(
848                                max_decoding_message_size,
849                                max_encoding_message_size,
850                            );
851                        let res = grpc.unary(method, req).await;
852                        Ok(res)
853                    };
854                    Box::pin(fut)
855                }
856                "/VectorService/Fetch" => {
857                    #[allow(non_camel_case_types)]
858                    struct FetchSvc<T: VectorService>(pub Arc<T>);
859                    impl<
860                        T: VectorService,
861                    > tonic::server::UnaryService<super::FetchRequest> for FetchSvc<T> {
862                        type Response = super::FetchResponse;
863                        type Future = BoxFuture<
864                            tonic::Response<Self::Response>,
865                            tonic::Status,
866                        >;
867                        fn call(
868                            &mut self,
869                            request: tonic::Request<super::FetchRequest>,
870                        ) -> Self::Future {
871                            let inner = Arc::clone(&self.0);
872                            let fut = async move {
873                                <T as VectorService>::fetch(&inner, request).await
874                            };
875                            Box::pin(fut)
876                        }
877                    }
878                    let accept_compression_encodings = self.accept_compression_encodings;
879                    let send_compression_encodings = self.send_compression_encodings;
880                    let max_decoding_message_size = self.max_decoding_message_size;
881                    let max_encoding_message_size = self.max_encoding_message_size;
882                    let inner = self.inner.clone();
883                    let fut = async move {
884                        let inner = inner.0;
885                        let method = FetchSvc(inner);
886                        let codec = tonic::codec::ProstCodec::default();
887                        let mut grpc = tonic::server::Grpc::new(codec)
888                            .apply_compression_config(
889                                accept_compression_encodings,
890                                send_compression_encodings,
891                            )
892                            .apply_max_message_size_config(
893                                max_decoding_message_size,
894                                max_encoding_message_size,
895                            );
896                        let res = grpc.unary(method, req).await;
897                        Ok(res)
898                    };
899                    Box::pin(fut)
900                }
901                "/VectorService/List" => {
902                    #[allow(non_camel_case_types)]
903                    struct ListSvc<T: VectorService>(pub Arc<T>);
904                    impl<
905                        T: VectorService,
906                    > tonic::server::UnaryService<super::ListRequest> for ListSvc<T> {
907                        type Response = super::ListResponse;
908                        type Future = BoxFuture<
909                            tonic::Response<Self::Response>,
910                            tonic::Status,
911                        >;
912                        fn call(
913                            &mut self,
914                            request: tonic::Request<super::ListRequest>,
915                        ) -> Self::Future {
916                            let inner = Arc::clone(&self.0);
917                            let fut = async move {
918                                <T as VectorService>::list(&inner, request).await
919                            };
920                            Box::pin(fut)
921                        }
922                    }
923                    let accept_compression_encodings = self.accept_compression_encodings;
924                    let send_compression_encodings = self.send_compression_encodings;
925                    let max_decoding_message_size = self.max_decoding_message_size;
926                    let max_encoding_message_size = self.max_encoding_message_size;
927                    let inner = self.inner.clone();
928                    let fut = async move {
929                        let inner = inner.0;
930                        let method = ListSvc(inner);
931                        let codec = tonic::codec::ProstCodec::default();
932                        let mut grpc = tonic::server::Grpc::new(codec)
933                            .apply_compression_config(
934                                accept_compression_encodings,
935                                send_compression_encodings,
936                            )
937                            .apply_max_message_size_config(
938                                max_decoding_message_size,
939                                max_encoding_message_size,
940                            );
941                        let res = grpc.unary(method, req).await;
942                        Ok(res)
943                    };
944                    Box::pin(fut)
945                }
946                "/VectorService/Query" => {
947                    #[allow(non_camel_case_types)]
948                    struct QuerySvc<T: VectorService>(pub Arc<T>);
949                    impl<
950                        T: VectorService,
951                    > tonic::server::UnaryService<super::QueryRequest> for QuerySvc<T> {
952                        type Response = super::QueryResponse;
953                        type Future = BoxFuture<
954                            tonic::Response<Self::Response>,
955                            tonic::Status,
956                        >;
957                        fn call(
958                            &mut self,
959                            request: tonic::Request<super::QueryRequest>,
960                        ) -> Self::Future {
961                            let inner = Arc::clone(&self.0);
962                            let fut = async move {
963                                <T as VectorService>::query(&inner, request).await
964                            };
965                            Box::pin(fut)
966                        }
967                    }
968                    let accept_compression_encodings = self.accept_compression_encodings;
969                    let send_compression_encodings = self.send_compression_encodings;
970                    let max_decoding_message_size = self.max_decoding_message_size;
971                    let max_encoding_message_size = self.max_encoding_message_size;
972                    let inner = self.inner.clone();
973                    let fut = async move {
974                        let inner = inner.0;
975                        let method = QuerySvc(inner);
976                        let codec = tonic::codec::ProstCodec::default();
977                        let mut grpc = tonic::server::Grpc::new(codec)
978                            .apply_compression_config(
979                                accept_compression_encodings,
980                                send_compression_encodings,
981                            )
982                            .apply_max_message_size_config(
983                                max_decoding_message_size,
984                                max_encoding_message_size,
985                            );
986                        let res = grpc.unary(method, req).await;
987                        Ok(res)
988                    };
989                    Box::pin(fut)
990                }
991                "/VectorService/Update" => {
992                    #[allow(non_camel_case_types)]
993                    struct UpdateSvc<T: VectorService>(pub Arc<T>);
994                    impl<
995                        T: VectorService,
996                    > tonic::server::UnaryService<super::UpdateRequest>
997                    for UpdateSvc<T> {
998                        type Response = super::UpdateResponse;
999                        type Future = BoxFuture<
1000                            tonic::Response<Self::Response>,
1001                            tonic::Status,
1002                        >;
1003                        fn call(
1004                            &mut self,
1005                            request: tonic::Request<super::UpdateRequest>,
1006                        ) -> Self::Future {
1007                            let inner = Arc::clone(&self.0);
1008                            let fut = async move {
1009                                <T as VectorService>::update(&inner, request).await
1010                            };
1011                            Box::pin(fut)
1012                        }
1013                    }
1014                    let accept_compression_encodings = self.accept_compression_encodings;
1015                    let send_compression_encodings = self.send_compression_encodings;
1016                    let max_decoding_message_size = self.max_decoding_message_size;
1017                    let max_encoding_message_size = self.max_encoding_message_size;
1018                    let inner = self.inner.clone();
1019                    let fut = async move {
1020                        let inner = inner.0;
1021                        let method = UpdateSvc(inner);
1022                        let codec = tonic::codec::ProstCodec::default();
1023                        let mut grpc = tonic::server::Grpc::new(codec)
1024                            .apply_compression_config(
1025                                accept_compression_encodings,
1026                                send_compression_encodings,
1027                            )
1028                            .apply_max_message_size_config(
1029                                max_decoding_message_size,
1030                                max_encoding_message_size,
1031                            );
1032                        let res = grpc.unary(method, req).await;
1033                        Ok(res)
1034                    };
1035                    Box::pin(fut)
1036                }
1037                "/VectorService/DescribeIndexStats" => {
1038                    #[allow(non_camel_case_types)]
1039                    struct DescribeIndexStatsSvc<T: VectorService>(pub Arc<T>);
1040                    impl<
1041                        T: VectorService,
1042                    > tonic::server::UnaryService<super::DescribeIndexStatsRequest>
1043                    for DescribeIndexStatsSvc<T> {
1044                        type Response = super::DescribeIndexStatsResponse;
1045                        type Future = BoxFuture<
1046                            tonic::Response<Self::Response>,
1047                            tonic::Status,
1048                        >;
1049                        fn call(
1050                            &mut self,
1051                            request: tonic::Request<super::DescribeIndexStatsRequest>,
1052                        ) -> Self::Future {
1053                            let inner = Arc::clone(&self.0);
1054                            let fut = async move {
1055                                <T as VectorService>::describe_index_stats(&inner, request)
1056                                    .await
1057                            };
1058                            Box::pin(fut)
1059                        }
1060                    }
1061                    let accept_compression_encodings = self.accept_compression_encodings;
1062                    let send_compression_encodings = self.send_compression_encodings;
1063                    let max_decoding_message_size = self.max_decoding_message_size;
1064                    let max_encoding_message_size = self.max_encoding_message_size;
1065                    let inner = self.inner.clone();
1066                    let fut = async move {
1067                        let inner = inner.0;
1068                        let method = DescribeIndexStatsSvc(inner);
1069                        let codec = tonic::codec::ProstCodec::default();
1070                        let mut grpc = tonic::server::Grpc::new(codec)
1071                            .apply_compression_config(
1072                                accept_compression_encodings,
1073                                send_compression_encodings,
1074                            )
1075                            .apply_max_message_size_config(
1076                                max_decoding_message_size,
1077                                max_encoding_message_size,
1078                            );
1079                        let res = grpc.unary(method, req).await;
1080                        Ok(res)
1081                    };
1082                    Box::pin(fut)
1083                }
1084                _ => {
1085                    Box::pin(async move {
1086                        Ok(
1087                            http::Response::builder()
1088                                .status(200)
1089                                .header("grpc-status", "12")
1090                                .header("content-type", "application/grpc")
1091                                .body(empty_body())
1092                                .unwrap(),
1093                        )
1094                    })
1095                }
1096            }
1097        }
1098    }
1099    impl<T: VectorService> Clone for VectorServiceServer<T> {
1100        fn clone(&self) -> Self {
1101            let inner = self.inner.clone();
1102            Self {
1103                inner,
1104                accept_compression_encodings: self.accept_compression_encodings,
1105                send_compression_encodings: self.send_compression_encodings,
1106                max_decoding_message_size: self.max_decoding_message_size,
1107                max_encoding_message_size: self.max_encoding_message_size,
1108            }
1109        }
1110    }
1111    impl<T: VectorService> Clone for _Inner<T> {
1112        fn clone(&self) -> Self {
1113            Self(Arc::clone(&self.0))
1114        }
1115    }
1116    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
1117        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1118            write!(f, "{:?}", self.0)
1119        }
1120    }
1121    impl<T: VectorService> tonic::server::NamedService for VectorServiceServer<T> {
1122        const NAME: &'static str = "VectorService";
1123    }
1124}