BREAKING CHANGE - Change vector store initialize-schema to false

* Change default schema initialization of vector stores from `true` to `false.`
  Users need to explicitly opt-in for schema initialization by setting the
  `initialize-schema` property on the corresponding vector store.
* Update integration tests
* Update docs

Fixes #907
This commit is contained in:
Soby Chacko
2024-06-21 12:37:36 -04:00
committed by Mark Pollack
parent edf943ec97
commit 50d34b8a48
57 changed files with 329 additions and 167 deletions

View File

@@ -78,6 +78,24 @@ Add these dependencies to your project:
TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file.
== Configuration Properties
You can use the following properties in your Spring Boot configuration to customize the Apache Cassandra vector store.
|===
|Property|Default value
|`spring.ai.vectorstore.cassandra.keyspace`|springframework
|`spring.ai.vectorstore.cassandra.table`|ai_vector_store
|`spring.ai.vectorstore.cassandra.initialze-schema`|false
|`spring.ai.vectorstore.cassandra.index-name`|
|`spring.ai.vectorstore.cassandra.content-column-name`|content
|`spring.ai.vectorstore.cassandra.embedding-column-name`|embedding
|`spring.ai.vectorstore.cassandra.return-embeddings`|false
|`spring.ai.vectorstore.cassandra.fixed-thread-pool-executor-size`|16
|===
== Usage

View File

@@ -12,7 +12,7 @@ link:https://azure.microsoft.com/en-us/products/ai-services/ai-search/[Azure AI
== Configuration
On startup, the `AzureVectorStore` can attempt to create a new index within your AI Search service instance if you've opted in by setting the relevant `initializeSchema` `boolean` property to `true` in the constructor or, if using Spring Boot, setting `...initialize-schema=true` in your `application.properties` file.
On startup, the `AzureVectorStore` can attempt to create a new index within your AI Search service instance if you've opted in by setting the relevant `initialize-schema` `boolean` property to `true` in the constructor or, if using Spring Boot, setting `...initialize-schema=true` in your `application.properties` file.
NOTE: this is a breaking change! In earlier versions of Spring AI, this schema initialization happened by default.
@@ -88,6 +88,24 @@ Add these dependencies to your project:
TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file.
== Configuration Properties
You can use the following properties in your Spring Boot configuration to customize the Azure vector store.
|===
|Property|Default value
|`spring.ai.vectorstore.azure.url`|
|`spring.ai.vectorstore.azure.api-key`|
|`spring.ai.vectorstore.azure.initialze-schema`|false
|`spring.ai.vectorstore.azure.index-name`|spring_ai_azure_vector_store
|`spring.ai.vectorstore.azure.default-top-k`|4
|`spring.ai.vectorstore.azure.default-similarity-threshold`|0.0
|`spring.ai.vectorstore.azure.embedding-property`|embedding
|`spring.ai.vectorstore.azure.index-name`|spring-ai-document-index
|===
== Sample Code
To configure an Azure `SearchIndexClient` in your application, you can use the following code:

View File

@@ -66,7 +66,6 @@ A simple configuration can either be provided via Spring Boot's _application.pro
[source,properties]
----
# Chroma Vector Store connection properties
spring.ai.vectorstore.chroma.client.initialize-schema=<true or false>
spring.ai.vectorstore.chroma.client.host=<your Chroma instance host>
spring.ai.vectorstore.chroma.client.port=<your Chroma instance port>
spring.ai.vectorstore.chroma.client.key-token=<your access token (if configure)>
@@ -74,6 +73,7 @@ spring.ai.vectorstore.chroma.client.username=<your username (if configure)>
spring.ai.vectorstore.chroma.client.password=<your password (if configure)>
# Chroma Vector Store collection properties
spring.ai.vectorstore.chroma.initialize-schema=<true or false>
spring.ai.vectorstore.chroma.collection-name=<your collection name>
# Chroma Vector Store configuration properties
@@ -117,6 +117,7 @@ You can use the following properties in your Spring Boot configuration to custom
|`spring.ai.vectorstore.chroma.client.username`| Access username (if configured) | -
|`spring.ai.vectorstore.chroma.client.password`| Access password (if configured) | -
|`spring.ai.vectorstore.chroma.collection-name`| Collection name | `SpringAiCollection`
|`spring.ai.vectorstore.chroma.initialize-schema`| Whether to initialize the required schema | `false`
|===
[NOTE]

View File

@@ -140,6 +140,7 @@ Properties starting with the `spring.ai.vectorstore.elasticsearch.*` prefix are
|===
|Property | Description | Default Value
|`spring.ai.vectorstore.elasticsearch.initialize-schema`| Whether to initialize the required schema | `false`
|`spring.ai.vectorstore.elasticsearch.index-name` | The name of the index to store the vectors. | spring-ai-document-index
|`spring.ai.vectorstore.elasticsearch.dimensions` | The number of dimensions in the vector. | 1536
|`spring.ai.vectorstore.elasticsearch.similarity` | The similarity function to use. | `cosine`

View File

@@ -44,6 +44,7 @@ You can use the following properties in your Spring Boot configuration to furthe
|`spring.ai.vectorstore.gemfire.host`|localhost
|`spring.ai.vectorstore.gemfire.port`|8080
|`spring.ai.vectorstore.gemfire.initialize-schema`| `false`
|`spring.ai.vectorstore.gemfire.index-name`|spring-ai-gemfire-store
|`spring.ai.vectorstore.gemfire.beam-width`|100
|`spring.ai.vectorstore.gemfire.max-connections`|16

View File

@@ -120,11 +120,11 @@ You can use the following properties in your Spring Boot configuration to custom
|===
|Property| Description | Default value
|`spring.opensearch.uris`| URIs of the OpenSearch cluster endpoints. | -
|`spring.opensearch.username`| Username for accessing the OpenSearch cluster. | -
|`spring.opensearch.password`| Password for the specified username. | -
|`spring.opensearch.indexName`| Name of the default index to be used within the OpenSearch cluster. | `spring-ai-document-index`
|`spring.opensearch.mappingJson`| JSON string defining the mapping for the index; specifies how documents and their
|`spring.ai.vectorstore.opensearch.uris`| URIs of the OpenSearch cluster endpoints. | -
|`spring.ai.vectorstore.opensearch.username`| Username for accessing the OpenSearch cluster. | -
|`spring.ai.vectorstore.opensearch.password`| Password for the specified username. | -
|`spring.ai.vectorstore.opensearch.indexName`| Name of the default index to be used within the OpenSearch cluster. | `spring-ai-document-index`
|`spring.ai.vectorstore.opensearch.mappingJson`| JSON string defining the mapping for the index; specifies how documents and their
fields are stored and indexed. |
{
"properties":{

View File

@@ -108,7 +108,7 @@ You can use the following properties in your Spring Boot configuration to custom
|`spring.ai.vectorstore.redis.uri`| Server connection URI | `redis://localhost:6379`
|`spring.ai.vectorstore.redis.index`| Index name | `default-index`
|`spring.ai.vectorstore.redis.initialize-schema`| whether to initialize the required schema | `false`
|`spring.ai.vectorstore.redis.initialize-schema`| Whether to initialize the required schema | `false`
|`spring.ai.vectorstore.redis.prefix`| Prefix | `default:`
|===

View File

@@ -103,8 +103,9 @@ You can use the following properties in your Spring Boot configuration to custom
|`spring.ai.vectorstore.typesense.client.host`| Hostname | `localhost`
|`spring.ai.vectorstore.typesense.client.port`| Port | `8108`
|`spring.ai.vectorstore.typesense.client.apiKey`| ApiKey | `xyz`
|`spring.ai.vectorstore.typesense.collectionName`| Collection Name | `vector_store`
|`spring.ai.vectorstore.typesense.embeddingDimension`| Embedding Dimension | `1536`
|`spring.ai.vectorstore.typesense.initialize-schema`| Whether to initialize the required schema | `false`
|`spring.ai.vectorstore.typesense.collection-name`| Collection Name | `vector_store`
|`spring.ai.vectorstore.typesense.embedding-dimension`| Embedding Dimension | `1536`
|===

View File

@@ -5,6 +5,16 @@
* The configuration prefix for the Chroma Vector Store has been changes from `spring.ai.vectorstore.chroma.store` to `spring.ai.vectorstore.chroma` in order to align with the naming conventions of other vector stores.
* The default value of the `initialize-schema` property on vector stores capable of initializing a schema is now set to `false`.
This implies that the applications now need to explicitly opt-in for schema initialization on supported vector stores, if the schema is expected to be created at application startup.
Not all vector stores support this property.
See the corresponding vector store documentation for more details.
The following are the vector stores that currently don't support the `initialize-schema` property.
1. Hana
2. Pinecone
3. Weaviate
== Upgrading to 1.0.0.M1
On our march to release 1.0.0 M1 we have made several breaking changes. Apologies, it is for the best!