Commit Graph

332 Commits

Author SHA1 Message Date
Mark Pollack
a562b8d8cb Remove explicit versioning of slf4j in pom.xml 2025-02-03 15:38:29 -05:00
Ilayaperumal Gopinathan
2932769883 Switch back to use slf4j logging
- Revert the changes to update to use Apache Commons Logging and re-add the previously used slf4j logging
2025-02-03 15:31:43 -05:00
Soby Chacko
16a596f8b7 Add getNativeClient API to VectorStore interface
Adds getNativeClient API to VectorStore interface allowing access to the underlying native client implementation.

This change:
- Adds getNativeClient() default method to VectorStore interface returning Optional<T>
- Implements getNativeClient() in all vector store implementations exposing their respective native clients
- Adds integration tests verifying native client access for all implementations

Fixes: #2137

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-03 14:49:36 -05:00
Soby Chacko
69200e621d Introduce Step Builder pattern for PineconeVectorStore
Replace the existing builder implementation with a type-safe Step Builder pattern
to enforce required field initialization in a specific order. This change:

- Introduces a new builder() method that guides users through required fields
- Deprecates the old builder method with all parameters
- Makes field configuration more explicit and type-safe
- Updates all usage points to use the new builder pattern

The required fields must now be provided in sequence:
1. embeddingModel
2. apiKey
3. projectId
4. environment
5. indexName

This change improves API usability by preventing parameter confusion and ensuring
all required fields are set before optional configuration.
2025-01-31 16:07:54 -05:00
Soby Chacko
8162029cc6 Add filter-based deletion to Weaviate vector store (#2150)
Implement filter-based deletion for WeaviateVectorStore by leveraging the
existing ID-based deletion mechanism.

Key changes:

- Add doDelete(Filter.Expression) implementation that delegates to the existing
  ID-based deletion method
- Use similarity search with filter to find matching documents first
- Delete matched documents by their IDs
- Add integration tests for filter deletion scenarios:
  * Deleting by simple equality filter
  * Deleting by string-based filter expression

This maintains consistency with other vector store implementations while
working around Weaviate's limitations in direct filtered deletion.
2025-01-31 15:46:54 -05:00
Soby Chacko
b9549d5ed2 Add filter-based deletion to Cassandra Vector Store (#2143)
Implement filter-based deletion for CassandraVectorStore to support more
    flexible document removal based on metadata filters.

    Key changes:

    - Add doDelete(Filter.Expression) implementation
    - Implement workaround for Cassandra's limitations in direct filtered deletion
    - Fetch matching documents first, then delete by IDs
    - Add integration tests for various filter deletion scenarios
    - Support simple and complex filter expressions
    - Includes tests for:
      * Deleting by simple equality filter
      * Deleting by string-based filter expression
      * Deleting by complex AND filter expression

    Provides consistent deletion capabilities across vector store implementations
    while addressing Cassandra-specific constraints.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-01-29 15:42:55 -05:00
Soby Chacko
bd52786de7 Add filter-based deletion and refactor tests for Pinecone vector store (#2142)
Add string-based filter deletion alongside the Filter.Expression-based deletion
for Pinecone vector store and improve test organization through refactoring.

Key changes:
- Add delete(Filter.Expression) implementation using two-step process:
  * Search for documents matching filter
  * Delete matching documents by ID
- Leverage existing search functionality to maintain filter consistency
- Extract common test patterns into helper methods
- Create reusable document factory methods for test data
- Add comprehensive integration tests for filter deletion
- Standardize test cleanup and verification patterns

This maintains consistency with other vector store implementations while
working within Pinecone's API limitations. The test refactoring improves
maintainability and makes the test patterns clearer and more consistent.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-01-29 15:34:16 -05:00
Soby Chacko
49f2320c38 Add filter-based deletion to Typesense vector store (#2140)
Add string-based filter deletion alongside the Filter.Expression-based deletion
for Typesense vector store, providing consistent deletion capabilities with
other vector store implementations.

Key changes:
- Add delete(Filter.Expression) implementation using Typesense filter expressions
- Leverage existing TypesenseFilterExpressionConverter for filter translation
- Use Typesense's DeleteDocumentsParameters for filtered deletion
- Add comprehensive integration tests for filter deletion
- Support both simple and complex filter expressions

This maintains consistency with other vector store implementations while
utilizing Typesense's native filtering capabilities for efficient metadata-based
deletion.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-01-29 15:29:51 -05:00
Ilayaperumal Gopinathan
78a58a15e8 Update commons logging for the latest changes 2025-01-29 10:21:20 +00:00
Soby Chacko
bca65de6ae Add filter-based deletion to Redis vector store
Add string-based filter deletion alongside the Filter.Expression-based deletion
for Redis vector store, providing consistent deletion capabilities with
other vector store implementations.

Key changes:
- Add delete(Filter.Expression) implementation using Redis FT.SEARCH and JSON.DEL
- Configure metadata fields properly to support numeric and tag operations
- Support both simple and complex filter expressions
- Handle Redis-specific JSON string responses in tests
- Add comprehensive integration tests for filter deletion cases

This maintains consistency with other vector store implementations while
utilizing Redis Search capabilities for efficient metadata-based deletion.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-01-28 12:29:42 -05:00
Soby Chacko
81d5618b3a Add filter-based deletion to Qdrant vector store
Add string-based filter deletion alongside the Filter.Expression-based deletion
for Qdrant vector store, providing consistent deletion capabilities with
other vector store implementations.

Key changes:
- Add delete(Filter.Expression) implementation using Qdrant's filter API
- Leverage existing QdrantFilterExpressionConverter for filter translation
- Use Qdrant's native deleteAsync with filter capabilities
- Add comprehensive integration tests for filter deletion
- Support both simple and complex filter expressions

This maintains consistency with other vector store implementations while
utilizing Qdrant's native filtering capabilities for efficient metadata-based
deletion.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-01-28 12:28:27 -05:00
Soby Chacko
b30713e8e3 Add filter-based deletion to Oracle vector store
Add string-based filter deletion alongside the Filter.Expression-based deletion
for Oracle vector store, providing consistent deletion capabilities with
other vector store implementations.

Key changes:
- Add delete(Filter.Expression) implementation using Oracle JSON_EXISTS
- Leverage existing SqlJsonPathFilterExpressionConverter for JSON path expressions
- Add comprehensive integration tests for filter deletion
- Support both simple and complex filter expressions
- Handle Oracle-specific JSON types in test assertions

This maintains consistency with other vector store implementations while
utilizing Oracle's JSON path capabilities for efficient metadata-based deletion.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-01-28 12:21:34 -05:00
Soby Chacko
07b905896a Add filter-based deletion to Neo4j and OpenSearch vector stores
Add string-based filter deletion alongside the Filter.Expression-based deletion
for Neo4j and OpenSearch vector stores, providing consistent deletion capabilities
with other vector store implementations.

Key changes:
- Add delete(Filter.Expression) implementation for Neo4j store using Cypher queries
- Add delete(Filter.Expression) implementation for OpenSearch store using query_string
- Leverage existing filter expression converters for both stores
- Use Neo4j's transaction batching for efficient large-scale deletions
- Use OpenSearch's delete_by_query API for metadata-based deletion
- Add comprehensive integration tests for both stores covering:
  * Simple equality filters
  * String-based filter expressions
  * Complex filter expressions with multiple conditions

This maintains consistency with other vector store implementations while utilizing
store-specific features for efficient metadata-based deletion.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-01-28 11:55:48 -05:00
Soby Chacko
ef0bade409 Add filter-based deletion to MongoDB Atlas vector store
Add string-based filter deletion alongside the Filter.Expression-based deletion
for MongoDB Atlas vector store, providing consistent deletion capabilities with
other vector store implementations.

Key changes:
- Add delete(Filter.Expression) implementation for MongoDB Atlas store
- Leverage existing MongoDBAtlasFilterExpressionConverter for filter translation
- Use MongoTemplate's native query capabilities for deletion
- Add comprehensive integration tests for filter deletion
- Support both simple and complex filter expressions

This maintains consistency with other vector store implementations while
utilizing MongoDB-specific query capabilities for efficient metadata-based deletion.
2025-01-28 11:39:14 -05:00
Ilayaperumal Gopinathan
c5dd7683b6 Fix LogAccessor formatting 2025-01-28 15:34:07 +00:00
Soby Chacko
946657fd77 Add filter-based deletion to Milvus vector store (#2127)
Add string-based filter deletion alongside the Filter.Expression-based deletion
for Milvus vector store, providing consistent deletion capabilities with
other vector store implementations.

Key changes:
- Add delete(Filter.Expression) implementation for Milvus store
- Leverage existing MilvusFilterExpressionConverter for filter translation
- Use Milvus client's native delete API with filter expressions
- Add comprehensive integration tests for filter deletion
- Support both simple and complex filter expressions

This maintains consistency with other vector store implementations while
utilizing Milvus-specific APIs for efficient metadata-based deletion.
2025-01-28 09:32:32 -05:00
Soby Chacko
fc1e90cf49 Add filter-based deletion to MariaDB vector store (#2125)
Add string-based filter deletion alongside the Filter.Expression-based deletion
for MariaDB vector store, providing consistent deletion capabilities with
other vector store implementations.

Key changes:
- Add delete(Filter.Expression) implementation for MariaDB store
- Integrate with existing MariaDBFilterExpressionConverter
- Add comprehensive integration tests for filter deletion
- Support both simple and complex filter expressions

This maintains consistency with other vector store implementations and
enables flexible document deletion based on metadata filters.
2025-01-28 09:22:39 -05:00
Ilayaperumal Gopinathan
8303a52611 Use Apache Commons Logging
- Remove existing spring-boot-starter-logging
 - Update to use Springframework's LogAccessor to use commons logging

Resolves #2095
2025-01-28 11:00:05 +00:00
Eddú Meléndez
840304955e Use TypesenseContainer for Service Connection
Testcontainers 1.20.4 provides a new module for typesense with
TypesenseContainer implementation.

Signed-off-by: Eddú Meléndez <eddu.melendez@gmail.com>
2025-01-27 13:57:22 -05:00
Soby Chacko
f588716b41 Add filter-based deletion and string filter API to VectorStore
Add string-based filter deletion alongside the Filter.Expression-based deletion
for vector stores. This provides a more convenient API for simple filter cases
while maintaining the full flexibility of expression-based filtering.

Key changes:
- Add delete(Filter.Expression) and delete(String) methods to VectorStore
- Add default string filter implementation in VectorStore interface
- Implement filter deletion in Chroma/Elasticsearch/PgVector stores
- Add integration tests for both filter APIs across implementations

This extends vector store deletion capabilities while maintaining consistent
behavior across implementations.
2025-01-24 14:15:46 -05:00
jitokim
822576bf91 Fix typo in PgDistanceType enum class
Signed-off-by: jitokim <pigberger70@gmail.com>
2025-01-24 16:59:00 +00:00
Ilayaperumal Gopinathan
224191aea7 Revert "Remove UUID Enforcement for ID Column in PGVectorStore"
This reverts commit bac507c62a.
2025-01-24 12:40:35 +00:00
jitokim
bac507c62a Remove UUID Enforcement for ID Column in PGVectorStore
Signed-off-by: jitokim <pigberger70@gmail.com>
2025-01-24 11:48:09 +00:00
Gerrit Meier
387de95ac5 Neo4j module: remove unnecessary property removal.
Closes #1932

Signed-off-by: Gerrit Meier <meistermeier@gmail.com>
2025-01-15 19:26:45 -05:00
dafriz
95675a85f8 Set ElasticSearch size to match requested topK used in KNN search 2025-01-15 12:16:43 +00:00
Soby Chacko
329e6c0219 Remove superfluous batchingStrategy implementation in CosmosDBVectorStore 2025-01-09 11:16:11 -05:00
Ilayaperumal Gopinathan
7634342ed6 Make vector store builders extensible (#2058)
- The VectorStore builders shouldn't be final as they are meant to be extensible
 - Suppress the `FinalClass` checkstyle errors on VectorStore classes
2025-01-09 11:03:38 -05:00
Ilayaperumal Gopinathan
bd687958c7 Remove deprecated HanaCloudVectorStoreConfig 2025-01-09 15:07:16 +00:00
Soby Chacko
9844a18983 Move batching strategy to base vector store builder
Moving BatchingStrategy configuration from individual vector store implementations
to the base AbstractVectorStoreBuilder to reduce code duplication and provide consistent
batching behavior across all vector stores.

The default TokenCountBatchingStrategy is now set in the base builder class.
2025-01-09 12:30:59 +00:00
Soby Chacko
6a5326816c Addressing vector store releated checkstyle issues 2025-01-08 16:55:19 -05:00
Soby Chacko
ebe30acba2 Remove deprecations in Coherence and Qdrant vector stores 2025-01-08 16:16:12 -05:00
Ilayaperumal Gopinathan
825de11f9e Fix javadoc error
- Remove unused type from RedisVectorStore
2025-01-08 12:45:00 +00:00
Soby Chacko
eff7a80b07 Remove vector store related deprecations introduced in 1.0.0-M5 2025-01-08 09:34:17 +00:00
Ilayaperumal Gopinathan
977500f7a1 Remove deprecated classes and methods in spring-ai-core
* Remove use of Document.getContext method from spring-ai-core, use getText
* Remove deprecated ChatOptionsBuilder class
* Remove deprecated FunctionCallingOptionsBuilder class
2025-01-06 16:57:55 -05:00
Ilayaperumal Gopinathan
7fe3b389c4 Fix checkstyle errors 2025-01-02 13:43:58 +00:00
Mark Pollack
d7fe07b0f1 Next development version 2024-12-23 14:25:21 -05:00
Mark Pollack
ab022fa956 Release version 1.0.0-M5 2024-12-23 14:24:55 -05:00
Mark Pollack
4b4d48603b Change milvus package from org.sf.ai.milvus.vectorstore to org.sf.ai.vectorstore.milvus 2024-12-23 12:40:25 -05:00
Mark Pollack
3bb49c3fd6 Update class level javadoc in some vector stores to match builder signatures 2024-12-23 10:41:01 -05:00
Ilayaperumal Gopinathan
fe3db2a64d Fix the usage of deprecated methods
- Fix GemFireVectorStorePropertiesTests to remove deprecated config
   - Replace the deprecated methods in CoherenceVectorStore
2024-12-22 11:11:01 +00:00
Mark Pollack
86b155d6ff Update VectorStore docs to use inner builder class
Updated the manual configuration examples in the following docs to show
the correct usage of the inner builder class:

- azure.adoc: Show builder(searchIndexClient, embeddingModel) with all available options
- chroma.adoc: Show builder(chromaApi, embeddingModel) with collection config
- oracle.adoc: Show builder(jdbcTemplate, embeddingModel) with database options

The examples now reflect the current implementation where the builder takes
both the client and embedding model as constructor arguments.
2024-12-21 20:22:59 -05:00
Soby Chacko
f9d741dd85 Standardize builder class names in vector stores
- Rename all specific builder inner classes (PineconeBuilder, MongoDBBuilder, etc.)
  to simply Builder for consistency across vector store implementations
- Update code references to use the new standardized Builder class names

The change establishes a consistent naming convention for builder classes
across the vector store implementations, improving code uniformity.
2024-12-21 11:28:39 -05:00
Ilayaperumal Gopinathan
1dd9de422d Fix javadoc errors 2024-12-21 00:13:06 +00:00
Ilayaperumal Gopinathan
80317e2de6 Fix CassandraVectorStore
- Remove non-null session check from CassandraBuilder constructor
2024-12-20 22:34:16 +00:00
Ilayaperumal Gopinathan
a0ef1179c4 Fix PgVectorStoreWithChatMemoryAdvisorIT
- Use the PgVectorStoreBuilder to create the instance of PgVectorStore
2024-12-20 20:38:41 +00:00
Ilayaperumal Gopinathan
2804604933 Refactor SearchRequest builder methods
- Add a new Builder inner class to move all the builder methods and deprecate the existing builder methods
 - Update docs and references
2024-12-20 19:35:17 +00:00
Thomas Vitale
97e58ccfc4 Fix Qdrant failing test
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2024-12-20 13:35:00 -05:00
Soby Chacko
1a6e79cbb9 Enhance vector stores with consistent APIs and null safety
- Replace Document.getContent() with getText() across all vector store implementations
- Fix incorrect package declarations in package-info.java files
- Make builder constructors private and implement proper builder patterns
- Add @Nullable annotations for better null safety
- Simplify PineconeVectorStore builder API by requiring essential parameters in factory method
- Make static Map fields final
- Clean up code and improve JavaDoc documentation

The changes focus on making the vector store APIs more consistent,
type-safe, and maintainable while following best practices for
builder patterns and null safety.
2024-12-20 12:19:12 -05:00
Soby Chacko
ee8bf37359 Require essential dependencies in vector store builder constructors
This commit refactors the builder pattern implementation across all VectorStore
implementations to make the EmbeddingModel a required constructor parameter
rather than an optional builder method. Key changes include:

- Move embeddingModel from being a builder method to a required constructor parameter
- Make embeddingModel final in AbstractVectorStoreBuilder
- Remove redundant validate() methods since EmbeddingModel validation now happens
  in constructor
- Update all VectorStore builder instantiations to pass EmbeddingModel in builder
  creation
- Add @Nullable annotations to appropriate methods in VectorStore interface

This change improves the API design by:
1. Enforcing that EmbeddingModel is provided at builder creation time
2. Removing the possibility of forgotten EmbeddingModel configuration
3. Simplifying the builder implementation by moving validation to construction
4. Making the dependency on EmbeddingModel more explicit in the API

Breaking Changes:
- VectorStore builders must now be created with an EmbeddingModel parameter
- The embeddingModel() builder method has been removed from all implementations
2024-12-20 12:15:58 -05:00
Mark Pollack
a4acd8e4fa Add builder pattern to PineconeVectorStore and refactor package name 2024-12-19 13:50:21 -05:00