@@ -55,7 +55,6 @@ resources on idle pools. More details on the OkHttpClient can be found [here](ht
55
55
56
56
``` java
57
57
import io.pinecone.clients.Pinecone ;
58
- import org.openapitools.client.model.* ;
59
58
60
59
public class InitializeClientExample {
61
60
public static void main (String [] args ) {
@@ -71,6 +70,7 @@ If you need to provide a custom `OkHttpClient`, you can do so by using the `with
71
70
72
71
``` java
73
72
import io.pinecone.clients.Pinecone ;
73
+ import okhttp3.OkHttpClient ;
74
74
75
75
public class InitializeClientExample {
76
76
public static void main (String [] args ) {
@@ -96,7 +96,7 @@ import io.pinecone.clients.Index;
96
96
import io.pinecone.clients.Pinecone ;
97
97
import io.pinecone.proto.UpsertResponse ;
98
98
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices ;
99
- import org.openapitools.control .client.model.IndexModel ;
99
+ import org.openapitools.db_control .client.model.IndexModel ;
100
100
101
101
import java.util.Arrays ;
102
102
@@ -169,9 +169,8 @@ serverless and regional availability, see [Understanding indexes](https://docs.p
169
169
170
170
``` java
171
171
import io.pinecone.clients.Pinecone ;
172
- import org.openapitools.client.model.IndexModel ;
173
- import org.openapitools.control.client.model.DeletionProtection ;
174
-
172
+ import org.openapitools.db_control.client.model.IndexModel ;
173
+ import org.openapitools.db_control.client.model.DeletionProtection ;
175
174
...
176
175
177
176
Pinecone pinecone = new Pinecone .Builder (" PINECONE_API_KEY" ). build();
@@ -192,9 +191,7 @@ The following is a minimal example of creating a pod-based index. For all the po
192
191
193
192
``` java
194
193
import io.pinecone.clients.Pinecone ;
195
- import org.openapitools.client.model.IndexModel ;
196
- import org.openapitools.control.client.model.DeletionProtection ;
197
-
194
+ import org.openapitools.db_control.client.model.IndexModel ;
198
195
...
199
196
200
197
Pinecone pinecone = new Pinecone .Builder (" PINECONE_API_KEY" ). build();
@@ -235,7 +232,7 @@ The following example returns all indexes (and their corresponding metadata) in
235
232
236
233
``` java
237
234
import io.pinecone.clients.Pinecone ;
238
- import org.openapitools.client.model.IndexList ;
235
+ import org.openapitools.db_control. client.model.IndexList ;
239
236
...
240
237
241
238
Pinecone pinecone = new Pinecone .Builder (" PINECONE_API_KEY" ). build();
@@ -248,7 +245,7 @@ The following example returns metadata about an index.
248
245
249
246
``` java
250
247
import io.pinecone.clients.Pinecone ;
251
- import org.openapitools.client.model.IndexModel ;
248
+ import org.openapitools.db_control. client.model.IndexModel ;
252
249
...
253
250
254
251
Pinecone pinecone = new Pinecone .Builder (" PINECONE_API_KEY" ). build();
@@ -261,7 +258,8 @@ The following example deletes an index.
261
258
262
259
``` java
263
260
import io.pinecone.clients.Pinecone ;
264
-
261
+ ...
262
+
265
263
Pinecone pinecone = new Pinecone .Builder (" PINECONE_API_KEY" ). build();
266
264
pinecone. deleteIndex(" example-index" );
267
265
```
@@ -274,16 +272,17 @@ Note: scaling replicas is only applicable to pod-based indexes.
274
272
275
273
``` java
276
274
import io.pinecone.clients.Pinecone ;
277
- import org.openapitools.client.model.IndexModel ;
275
+ import org.openapitools.db_control. client.model.DeletionProtection ;
278
276
...
279
277
280
278
Pinecone pinecone = new Pinecone .Builder (" PINECONE_API_KEY" ). build();
281
279
282
280
String indexName = " example-index" ;
283
281
String podType = " p1.x1" ;
284
282
int newNumberOfReplicas = 7 ;
285
-
286
- pinecone. configurePodsIndex(indexName, podType, newNumberOfReplicas);
283
+ DeletionProtection deletionProtection = DeletionProtection . DISABLED ;
284
+
285
+ pinecone. configurePodsIndex(indexName, podType, newNumberOfReplicas, deletionProtection);
287
286
```
288
287
289
288
## Enable deletion protection for pod index
@@ -292,11 +291,15 @@ The following example enables deletion protection for a pod-based index.
292
291
293
292
``` java
294
293
import io.pinecone.clients.Pinecone ;
294
+ import org.openapitools.db_control.client.model.DeletionProtection ;
295
295
...
296
296
297
297
Pinecone pinecone = new Pinecone .Builder (" PINECONE_API_KEY" ). build();
298
298
299
- pinecone. configurePodsIndex(indexName, DeletionProtection . ENABLED );
299
+ String indexName = " example-index" ;
300
+ DeletionProtection deletionProtection = DeletionProtection . ENABLED ;
301
+
302
+ pinecone. configurePodsIndex(indexName, deletionProtection);
300
303
```
301
304
302
305
## Enable deletion protection for serverless index
@@ -305,10 +308,12 @@ The following example enables deletion protection for a serverless index.
305
308
306
309
``` java
307
310
import io.pinecone.clients.Pinecone ;
311
+ import org.openapitools.db_control.client.model.DeletionProtection ;
308
312
...
309
313
310
314
Pinecone pinecone = new Pinecone .Builder (" PINECONE_API_KEY" ). build();
311
315
316
+ String indexName = " example-index" ;
312
317
pinecone. configureServerlessIndex(indexName, DeletionProtection . ENABLED );
313
318
```
314
319
@@ -320,7 +325,8 @@ The following example returns statistics about an index.
320
325
import io.pinecone.clients.Index ;
321
326
import io.pinecone.clients.Pinecone ;
322
327
import io.pinecone.proto.DescribeIndexStatsResponse ;
323
-
328
+ ...
329
+
324
330
Pinecone pinecone = new Pinecone .Builder (" PINECONE_API_KEY" ). build();
325
331
326
332
Index index = pinecone. getIndexConnection(" example-index" );
@@ -452,8 +458,8 @@ The following example lists up to 100 vector IDs from a Pinecone index.
452
458
453
459
This method accepts optional parameters for ` namespace ` , ` prefix ` , ` limit ` , and ` paginationToken ` .
454
460
455
- The following
456
- demonstrates how to use the ` list ` endpoint to get vector IDs from a specific ` namespace ` , filtered by a given ` prefix ` .
461
+ The following demonstrates how to use the ` list ` endpoint to get vector IDs from a specific ` namespace ` , filtered by a
462
+ given ` prefix ` .
457
463
458
464
``` java
459
465
import io.pinecone.clients.Index ;
@@ -466,7 +472,6 @@ Index index = pinecone.getIndexConnection(indexName);
466
472
ListResponse listResponse = index. list(" example-namespace" , " prefix-" );
467
473
```
468
474
469
-
470
475
## Update vectors
471
476
472
477
The following example updates vectors by ID.
@@ -496,7 +501,7 @@ The following example creates the collection `example-collection` from
496
501
497
502
``` java
498
503
import io.pinecone.clients.Pinecone ;
499
- import org.openapitools.client.model.CollectionModel ;
504
+ import org.openapitools.db_control. client.model.CollectionModel ;
500
505
...
501
506
502
507
Pinecone pinecone = new Pinecone .Builder (" PINECONE_API_KEY" ). build();
@@ -512,7 +517,7 @@ The following example returns a list of the collections in the current project.
512
517
513
518
``` java
514
519
import io.pinecone.clients.Pinecone ;
515
- import org.openapitools.client.model.CollectionModel ;
520
+ import org.openapitools.db_control. client.model.CollectionModel ;
516
521
import java.util.List ;
517
522
...
518
523
@@ -526,7 +531,7 @@ The following example returns a description of the collection
526
531
527
532
``` java
528
533
import io.pinecone.clients.Pinecone ;
529
- import org.openapitools.client.model.CollectionModel ;
534
+ import org.openapitools.db_control. client.model.CollectionModel ;
530
535
...
531
536
532
537
Pinecone pinecone = new Pinecone .Builder (" PINECONE_API_KEY" ). build();
@@ -550,10 +555,11 @@ pinecone.deleteCollection("example-collection");
550
555
The Pinecone SDK now supports creating embeddings via the [ Inference API] ( https://docs.pinecone.io/guides/inference/understanding-inference ) .
551
556
552
557
``` java
558
+ import io.pinecone.clients.Inference ;
553
559
import io.pinecone.clients.Pinecone ;
554
- import org.openapitools.control .client.ApiException ;
555
- import org.openapitools.control .client.model.Embedding ;
556
- import org.openapitools.control .client.model.EmbeddingsList ;
560
+ import org.openapitools.inference .client.ApiException ;
561
+ import org.openapitools.inference .client.model.Embedding ;
562
+ import org.openapitools.inference .client.model.EmbeddingsList ;
557
563
558
564
import java.util.ArrayList ;
559
565
import java.util.HashMap ;
@@ -589,12 +595,15 @@ The following example shows how to rerank items according to their relevance to
589
595
``` java
590
596
import io.pinecone.clients.Inference ;
591
597
import io.pinecone.clients.Pinecone ;
598
+ import org.openapitools.inference.client.ApiException ;
592
599
import org.openapitools.inference.client.model.RerankResult ;
593
600
594
601
import java.util.* ;
595
-
596
602
...
597
603
604
+ Pinecone pinecone = new Pinecone .Builder (System . getenv(" PINECONE_API_KEY" )). build();
605
+ Inference inference = pinecone. getInferenceClient();
606
+
598
607
// The model to use for reranking
599
608
String model = " bge-reranker-v2-m3" ;
600
609
0 commit comments