Update the VecotorStore pom versions

- update boot to 3.2.1
  - update vector-stores: postgresql (42.7.1) , pgvecgor (0.1.4), pinecone (0.7.1)
    azure-search (11.6.1), weaviate (4.5.0)
  - clean the  auto-configuraito properties
  - resolve Milvus auto-conf property expossing external API.
This commit is contained in:
Christian Tzolov
2023-12-23 14:45:48 +01:00
parent b73a9ea6f9
commit 472fadda61
9 changed files with 60 additions and 41 deletions

12
pom.xml
View File

@@ -93,7 +93,7 @@
<maven.compiler.target>17</maven.compiler.target>
<!-- production dependencies -->
<spring-boot.version>3.2.0</spring-boot.version>
<spring-boot.version>3.2.1</spring-boot.version>
<spring-framework.version>6.1.1</spring-framework.version>
<stringtemplate.version>4.0.2</stringtemplate.version>
<azure-open-ai-client.version>1.0.0-beta.6</azure-open-ai-client.version>
@@ -104,14 +104,14 @@
<!-- readers/writer/stores dependencies-->
<pdfbox.version>3.0.0</pdfbox.version>
<pgvector.version>0.1.3</pgvector.version>
<postgresql.version>42.6.0</postgresql.version>
<pgvector.version>0.1.4</pgvector.version>
<postgresql.version>42.7.1</postgresql.version>
<milvus.version>2.3.3</milvus.version>
<pinecone.version>0.6.0</pinecone.version>
<pinecone.version>0.7.1</pinecone.version>
<protobuf-java-util.version>3.24.4</protobuf-java-util.version>
<fastjson.version>2.0.42</fastjson.version>
<azure-search.version>11.6.0</azure-search.version>
<weaviate-client.version>4.4.1</weaviate-client.version>
<azure-search.version>11.6.1</azure-search.version>
<weaviate-client.version>4.5.0</weaviate-client.version>
<!-- testing dependencies -->
<testcontainers.version>1.19.0</testcontainers.version>

View File

@@ -132,7 +132,7 @@
<version>${project.parent.version}</version>
<optional>true</optional>
</dependency>
<!-- Redis Vector Store-->
<dependency>
<groupId>org.springframework.ai</groupId>
@@ -140,13 +140,13 @@
<version>${project.parent.version}</version>
<optional>true</optional>
</dependency>
<!-- Override Jedis version -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>5.1.0</version>
</dependency>
</dependency>
<!-- Vertex AI LLM -->
<dependency>
@@ -192,6 +192,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
<scope>test</scope>
</dependency>
@@ -208,7 +209,7 @@
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.redis</groupId>
<artifactId>testcontainers-redis</artifactId>

View File

@@ -20,14 +20,12 @@ import java.util.concurrent.TimeUnit;
import org.springframework.boot.context.properties.ConfigurationProperties;
import static org.springframework.ai.autoconfigure.vectorstore.milvus.MilvusServiceClientProperties.CONFIG_PREFIX;
/**
* Parameters for Milvus client connection.
*
* @author Christian Tzolov
*/
@ConfigurationProperties(CONFIG_PREFIX)
@ConfigurationProperties(MilvusServiceClientProperties.CONFIG_PREFIX)
public class MilvusServiceClientProperties {
public static final String CONFIG_PREFIX = "spring.ai.vectorstore.milvus.client";

View File

@@ -20,6 +20,8 @@ import java.util.concurrent.TimeUnit;
import io.milvus.client.MilvusServiceClient;
import io.milvus.param.ConnectParam;
import io.milvus.param.IndexType;
import io.milvus.param.MetricType;
import org.springframework.ai.embedding.EmbeddingClient;
import org.springframework.ai.vectorstore.MilvusVectorStore;
@@ -48,8 +50,8 @@ public class MilvusVectorStoreAutoConfiguration {
MilvusVectorStoreConfig config = MilvusVectorStoreConfig.builder()
.withCollectionName(properties.getCollectionName())
.withDatabaseName(properties.getDatabaseName())
.withIndexType(properties.getIndexType())
.withMetricType(properties.getMetricType())
.withIndexType(IndexType.valueOf(properties.getIndexType().name()))
.withMetricType(MetricType.valueOf(properties.getMetricType().name()))
.withIndexParameters(properties.getIndexParameters())
.build();

View File

@@ -16,19 +16,14 @@
package org.springframework.ai.autoconfigure.vectorstore.milvus;
import io.milvus.param.IndexType;
import io.milvus.param.MetricType;
import org.springframework.ai.vectorstore.MilvusVectorStore;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.Assert;
import static org.springframework.ai.autoconfigure.vectorstore.milvus.MilvusVectorStoreProperties.CONFIG_PREFIX;
/**
* @author Christian Tzolov
*/
@ConfigurationProperties(CONFIG_PREFIX)
@ConfigurationProperties(MilvusVectorStoreProperties.CONFIG_PREFIX)
public class MilvusVectorStoreProperties {
public static final String CONFIG_PREFIX = "spring.ai.vectorstore.milvus";
@@ -42,14 +37,46 @@ public class MilvusVectorStoreProperties {
private int embeddingDimension = MilvusVectorStore.OPENAI_EMBEDDING_DIMENSION_SIZE;
private IndexType indexType = IndexType.IVF_FLAT;
private MilvusIndexType indexType = MilvusIndexType.IVF_FLAT;
private MetricType metricType = MetricType.COSINE;
private MilvusMetricType metricType = MilvusMetricType.COSINE;
private String indexParameters = "{\"nlist\":1024}";
public static String getConfigPrefix() {
return CONFIG_PREFIX;
public enum MilvusMetricType {
/**
* Invalid metric type
*/
INVALID,
/**
* Euclidean distance
*/
L2,
/**
* Inner product
*/
IP,
/**
* Cosine distance
*/
COSINE,
/**
* Hamming distance
*/
HAMMING,
/**
* Jaccard distance
*/
JACCARD;
}
public enum MilvusIndexType {
INVALID, FLAT, IVF_FLAT, IVF_SQ8, IVF_PQ, HNSW, DISKANN, AUTOINDEX, SCANN, GPU_IVF_FLAT, GPU_IVF_PQ, BIN_FLAT,
BIN_IVF_FLAT, TRIE, STL_SORT;
}
public String getDatabaseName() {
@@ -79,20 +106,20 @@ public class MilvusVectorStoreProperties {
this.embeddingDimension = embeddingDimension;
}
public IndexType getIndexType() {
public MilvusIndexType getIndexType() {
return indexType;
}
public void setIndexType(IndexType indexType) {
public void setIndexType(MilvusIndexType indexType) {
Assert.notNull(indexType, "Index type can not be null");
this.indexType = indexType;
}
public MetricType getMetricType() {
public MilvusMetricType getMetricType() {
return metricType;
}
public void setMetricType(MetricType metricType) {
public void setMetricType(MilvusMetricType metricType) {
Assert.notNull(metricType, "MetricType can not be null");
this.metricType = metricType;
}

View File

@@ -17,7 +17,6 @@
package org.springframework.ai.autoconfigure.vectorstore.pgvector;
import javax.sql.DataSource;
import org.springframework.ai.embedding.EmbeddingClient;
import org.springframework.ai.vectorstore.PgVectorStore;
import org.springframework.ai.vectorstore.VectorStore;

View File

@@ -20,12 +20,11 @@ import org.springframework.ai.vectorstore.PgVectorStore;
import org.springframework.ai.vectorstore.PgVectorStore.PgDistanceType;
import org.springframework.ai.vectorstore.PgVectorStore.PgIndexType;
import org.springframework.boot.context.properties.ConfigurationProperties;
import static org.springframework.ai.autoconfigure.vectorstore.pgvector.PgVectorStoreProperties.CONFIG_PREFIX;
/**
* @author Christian Tzolov
*/
@ConfigurationProperties(CONFIG_PREFIX)
@ConfigurationProperties(PgVectorStoreProperties.CONFIG_PREFIX)
public class PgVectorStoreProperties {
public static final String CONFIG_PREFIX = "spring.ai.vectorstore.pgvector";
@@ -38,10 +37,6 @@ public class PgVectorStoreProperties {
private boolean removeExistingVectorStoreTable = false;
public static String getConfigPrefix() {
return CONFIG_PREFIX;
}
public int getDimensions() {
return dimensions;
}

View File

@@ -19,12 +19,11 @@ package org.springframework.ai.autoconfigure.vectorstore.pinecone;
import java.time.Duration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import static org.springframework.ai.autoconfigure.vectorstore.pinecone.PineconeVectorStoreProperties.CONFIG_PREFIX;
/**
* @author Christian Tzolov
*/
@ConfigurationProperties(CONFIG_PREFIX)
@ConfigurationProperties(PineconeVectorStoreProperties.CONFIG_PREFIX)
public class PineconeVectorStoreProperties {
public static final String CONFIG_PREFIX = "spring.ai.vectorstore.pinecone";

View File

@@ -18,12 +18,10 @@ package org.springframework.ai.autoconfigure.vectorstore.redis;
import org.springframework.boot.context.properties.ConfigurationProperties;
import static org.springframework.ai.autoconfigure.vectorstore.redis.RedisVectorStoreProperties.CONFIG_PREFIX;
/**
* @author Julien Ruaux
*/
@ConfigurationProperties(CONFIG_PREFIX)
@ConfigurationProperties(RedisVectorStoreProperties.CONFIG_PREFIX)
public class RedisVectorStoreProperties {
public static final String CONFIG_PREFIX = "spring.ai.vectorstore.redis";