Skip to content

Commit c91163b

Browse files
Upgrade Pinecone java client to 4.0.1 (#2328)
- Upgrade the java client from 0.8.0 to 4.0.1 - Use io.pinecone.clients.Pinecone to setup the client configuration with the API key - Remove projectId, environment and other deprecated client configurations - Update upsert, delete, search operations with the new client - Remove the projectID and Environment configurations from the builder - Updated the Pinecone vectorstore autoconfiguration - Update tests Signed-off-by: Ilayaperumal Gopinathan <[email protected]> Disable autoconfig IT until the auto-configuration is modularised
1 parent 96c8157 commit c91163b

File tree

9 files changed

+52
-210
lines changed

9 files changed

+52
-210
lines changed

Diff for: pom.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@
217217
<coherence.version>24.09</coherence.version>
218218
<milvus.version>2.5.4</milvus.version>
219219
<gemfire.testcontainers.version>2.3.0</gemfire.testcontainers.version>
220-
<pinecone.version>0.8.0</pinecone.version>
220+
221+
<pinecone.version>4.0.1</pinecone.version>
222+
<pinecone.protobuf-java-util.version>4.29.3</pinecone.protobuf-java-util.version>
223+
221224
<fastjson2.version>2.0.46</fastjson2.version>
222225
<azure-core.version>1.53.0</azure-core.version>
223226
<azure-json.version>1.3.0</azure-json.version>

Diff for: spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/pinecone.adoc

+1-9
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ link:https://www.pinecone.io/[Pinecone] is a popular cloud-based vector database
77
== Prerequisites
88

99
1. Pinecone Account: Before you start, sign up for a link:https://app.pinecone.io/[Pinecone account].
10-
2. Pinecone Project: Once registered, create a new project, an index, and generate an API key. You'll need these details for configuration.
10+
2. Pinecone Project: Once registered, generate an API key and create and index. You'll need these details for configuration.
1111
3. `EmbeddingModel` instance to compute the document embeddings. Several options are available:
1212
- If required, an API key for the xref:api/embeddings.adoc#available-implementations[EmbeddingModel] to generate the embeddings stored by the `PineconeVectorStore`.
1313

1414
To set up `PineconeVectorStore`, gather the following details from your Pinecone account:
1515

1616
* Pinecone API Key
17-
* Pinecone Environment
18-
* Pinecone Project ID
1917
* Pinecone Index Name
2018
* Pinecone Namespace
2119

@@ -70,8 +68,6 @@ A simple configuration can either be provided via Spring Boot's _application.pro
7068
[source,properties]
7169
----
7270
spring.ai.vectorstore.pinecone.apiKey=<your api key>
73-
spring.ai.vectorstore.pinecone.environment=<your environment>
74-
spring.ai.vectorstore.pinecone.projectId=<your project id>
7571
spring.ai.vectorstore.pinecone.index-name=<your index name>
7672
7773
# API key if needed, e.g. OpenAI
@@ -109,8 +105,6 @@ You can use the following properties in your Spring Boot configuration to custom
109105
|Property| Description | Default value
110106

111107
|`spring.ai.vectorstore.pinecone.api-key`| Pinecone API Key | -
112-
|`spring.ai.vectorstore.pinecone.environment`| Pinecone environment | `gcp-starter`
113-
|`spring.ai.vectorstore.pinecone.project-id`| Pinecone project ID | -
114108
|`spring.ai.vectorstore.pinecone.index-name`| Pinecone index name | -
115109
|`spring.ai.vectorstore.pinecone.namespace`| Pinecone namespace | -
116110
|`spring.ai.vectorstore.pinecone.content-field-name`| Pinecone metadata field name used to store the original text content. | `document_content`
@@ -191,8 +185,6 @@ To configure Pinecone in your application, you can use the following setup:
191185
public VectorStore pineconeVectorStore(EmbeddingModel embeddingModel) {
192186
return PineconeVectorStore.builder(embeddingModel)
193187
.apiKey(PINECONE_API_KEY)
194-
.projectId(PINECONE_PROJECT_ID)
195-
.environment(PINECONE_ENVIRONMENT)
196188
.indexName(PINECONE_INDEX_NAME)
197189
.namespace(PINECONE_NAMESPACE) // the free tier doesn't support namespaces.
198190
.contentFieldName(CUSTOM_CONTENT_FIELD_NAME) // optional field to store the original content. Defaults to `document_content`

Diff for: spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/pinecone/PineconeVectorStoreAutoConfiguration.java

-3
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,10 @@ public PineconeVectorStore vectorStore(EmbeddingModel embeddingModel, PineconeVe
5656

5757
return PineconeVectorStore.builder(embeddingModel)
5858
.apiKey(properties.getApiKey())
59-
.projectId(properties.getProjectId())
60-
.environment(properties.getEnvironment())
6159
.indexName(properties.getIndexName())
6260
.namespace(properties.getNamespace())
6361
.contentFieldName(properties.getContentFieldName())
6462
.distanceMetadataFieldName(properties.getDistanceMetadataFieldName())
65-
.serverSideTimeout(properties.getServerSideTimeout())
6663
.observationRegistry(observationRegistry.getIfUnique(() -> ObservationRegistry.NOOP))
6764
.customObservationConvention(customObservationConvention.getIfAvailable(() -> null))
6865
.batchingStrategy(batchingStrategy)

Diff for: spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/vectorstore/pinecone/PineconeVectorStoreAutoConfigurationIT.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import io.micrometer.observation.tck.TestObservationRegistry;
2727
import org.awaitility.Awaitility;
2828
import org.junit.jupiter.api.BeforeAll;
29+
import org.junit.jupiter.api.Disabled;
2930
import org.junit.jupiter.api.Test;
3031
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
3132

@@ -51,14 +52,13 @@
5152
* @author Thomas Vitale
5253
*/
5354
@EnabledIfEnvironmentVariable(named = "PINECONE_API_KEY", matches = ".+")
55+
@Disabled("Can be re-enabled once the auto-configuration is modularised")
5456
public class PineconeVectorStoreAutoConfigurationIT {
5557

5658
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
5759
.withConfiguration(AutoConfigurations.of(PineconeVectorStoreAutoConfiguration.class))
5860
.withUserConfiguration(Config.class)
5961
.withPropertyValues("spring.ai.vectorstore.pinecone.apiKey=" + System.getenv("PINECONE_API_KEY"),
60-
"spring.ai.vectorstore.pinecone.environment=gcp-starter",
61-
"spring.ai.vectorstore.pinecone.projectId=814621f",
6262
"spring.ai.vectorstore.pinecone.indexName=spring-ai-test-index",
6363
"spring.ai.vectorstore.pinecone.contentFieldName=customContentField",
6464
"spring.ai.vectorstore.pinecone.distanceMetadataFieldName=customDistanceField");

Diff for: spring-ai-test/src/main/java/org/springframework/ai/test/vectorstore/BaseVectorStoreTests.java

+2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818

1919
import org.junit.jupiter.api.Test;
2020

21+
import static org.assertj.core.api.Assertions.anyOf;
2122
import static org.assertj.core.api.Assertions.assertThat;
2223
import static org.awaitility.Awaitility.await;
24+
import static org.hamcrest.Matchers.either;
2325

2426
import java.time.Duration;
2527
import java.util.HashMap;

Diff for: vector-stores/spring-ai-pinecone-store/pom.xml

+1-32
Original file line numberDiff line numberDiff line change
@@ -50,43 +50,13 @@
5050
<dependency>
5151
<groupId>io.pinecone</groupId>
5252
<artifactId>pinecone-client</artifactId>
53-
<exclusions>
54-
<exclusion>
55-
<groupId>io.grpc</groupId>
56-
<artifactId>grpc-netty</artifactId>
57-
</exclusion>
58-
<exclusion>
59-
<groupId>io.grpc</groupId>
60-
<artifactId>grpc-protobuf</artifactId>
61-
</exclusion>
62-
<exclusion>
63-
<groupId>io.grpc</groupId>
64-
<artifactId>grpc-stub</artifactId>
65-
</exclusion>
66-
</exclusions>
6753
<version>${pinecone.version}</version>
6854
</dependency>
6955

70-
<dependency>
71-
<groupId>io.grpc</groupId>
72-
<artifactId>grpc-netty</artifactId>
73-
<version>1.59.1</version>
74-
</dependency>
75-
<dependency>
76-
<groupId>io.grpc</groupId>
77-
<artifactId>grpc-protobuf</artifactId>
78-
<version>1.59.1</version>
79-
</dependency>
80-
<dependency>
81-
<groupId>io.grpc</groupId>
82-
<artifactId>grpc-stub</artifactId>
83-
<version>1.59.1</version>
84-
</dependency>
85-
8656
<dependency>
8757
<groupId>com.google.protobuf</groupId>
8858
<artifactId>protobuf-java-util</artifactId>
89-
<version>${protobuf-java.version}</version>
59+
<version>${pinecone.protobuf-java-util.version}</version>
9060
</dependency>
9161

9262
<!-- TESTING -->
@@ -113,7 +83,6 @@
11383
<dependency>
11484
<groupId>org.awaitility</groupId>
11585
<artifactId>awaitility</artifactId>
116-
<version>3.0.0</version>
11786
<scope>test</scope>
11887
</dependency>
11988

0 commit comments

Comments
 (0)