Commit Graph

363 Commits

Author SHA1 Message Date
Ilayaperumal Gopinathan
8ca3d41e68 Refactoring cleanup
- Update Spring AI BOM with the newly added modules
 - Remove unnecessary dependencies from the modules' POM file
2025-04-03 10:11:03 -04:00
Soby Chacko
bd82e73193 Rename spring-ai parent from spring-ai to spring-ai-parent
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-04-03 10:11:03 -04:00
Soby Chacko
21c2b4de81 Migrate Cassandra chat memory implementation to its own module
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-04-03 10:11:03 -04:00
Mark Pollack
278db764b3 Refactorings
- Avoid overlapping package names
  Changed in spring-ai-commons package from org.sf.ai.model to org.sf.ai.content
  Refactor advisor module name to be spring-ai-advisors-vector-store
    Moved advisors into org.springframework.ai.chat.client.advisor.vectorstore

- Created top level memory directory
- Create new module spring-ai-model-chat-memory-neo4j and moved neo4j memory classes out of the vectorstore module
  Updated neo4j autoconfiguation
2025-04-03 10:11:03 -04:00
Mark Pollack
85555003ad rename spring-ai-core to spring-ai-client-chat 2025-04-03 10:11:03 -04:00
Mark Pollack
148534d511 remove duplicated deps in spring-ai-pgvector-store pom.xml 2025-04-03 10:11:03 -04:00
Mark Pollack
e75137cce1 Move rag classes out of spring-ai-core and into new module spring-ai-rag 2025-04-03 10:11:03 -04:00
Mark Pollack
9c0262e50e Move advisors that depend on vector store to spring-ai-advisors module 2025-04-03 10:11:03 -04:00
vker
2294c5a807 Fix: Add missing placeholder for TABLE_NAME in MariaDB table existence check
Signed-off-by: vker <6492178@gmail.com>
2025-04-01 20:04:03 +01:00
CChuYong
c02430ea6b Add PgIdType based schema generation for PgVectorStore
Signed-off-by: CChuYong <yeongmin1061@gmail.com>
2025-04-01 19:27:33 +01:00
jonghoon park
4f4da3076a Make the embedding field name configurable for the ElasticSearchVectorStore
Signed-off-by: jonghoon park <dev@jonghoonpark.com>
2025-03-31 12:45:17 +01:00
Ilayaperumal Gopinathan
b0668700ec Code cleanup: Neo4j vector store
- Remove batch strategy usage as it is taken care by the vector store parent builder

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-03-26 20:14:39 +00:00
Enrico Rampazzo
1d4bde80e5 Neo4j chatmemory implementation
- Add chatmemory implementation for Neo4j
  - Add autoconfiguration for Neo4jChatMemory
  - Add tests

Signed-off-by: Enrico Rampazzo <enrico.rampazzo@live.com>
2025-03-26 20:04:08 +00:00
Alexandros Pappas
29002dfc0d chore: remove unused imports (#2542)
Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-03-21 12:20:29 +00:00
Laurent Doguin
d25d37ab12 GH-938: Add Couchbase vector store support
Fixes: #938

Issue link: https://github.com/spring-projects/spring-ai/issues/938

This commit integrates Couchbase as a vector store option in Spring AI, providing:

- CouchbaseSearchVectorStore implementation with vector similarity search capabilities
- Support for metadata filtering with SQL++ expression conversion
- Spring Boot auto-configuration and starter module for easy integration
- Comprehensive documentation covering setup, configuration, and usage examples
- Integration tests using TestContainers with Couchbase 7.6

The implementation supports configuring dimensions, similarity functions (dot_product/l2_norm),
and optimization strategies (recall/latency). Schema initialization is now opt-in via
the initializeSchema property. Documentation includes both auto-configuration and
manual configuration instructions, along with property configuration details.

Signed-off-by: Abhiraj <abhiraj.official15@gmail.com>

co-authored-by: Laurent Doguin <laurent.doguin@gmail.com>
2025-03-20 18:59:56 -04:00
CChuYong
268248ba3c Fix PgVectorStore doDelete function as batch
Signed-off-by: CChuYong <yeongmin1061@gmail.com>
2025-03-12 17:51:39 +00:00
Ilayaperumal Gopinathan
ded9facfe5 Remove deprecations from 1.0.0-M6
- Remove deprecations from models, vector stores and usage
- Deprecations from FunctionCallback and ObservationContext/Convention will be in a separate PR

Models updates
  - Remove AbstractToolCallSupport from the models which use ToolCallingManager
  - Remove deprecated constructors and their usage
  - Remove FunctionCallbackResolver and FunctionCallbacks usage in the models

- Add back deprecations for VectorStoreChatMemoryAdvisor until builder is fixed

- Update OpenAiPaymentTransactionIT to use ToolCallbackResolver in config

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-03-11 10:42:03 -04:00
waileong
e128a39ec3 Updates the SearchRequest class to be non-final and adds a MilvusSearchRequest subclass that includes Milvus-specific fields for native expressions and search parameters.
- Updated `SearchRequest.java` to make the class non-final.
- Added `MilvusSearchRequest` with specific Milvus parameters such as `nativeExpression` and `searchParamsJson`.
- Modified `doSimilaritySearch` method in `MilvusVectorStore` to handle these new fields from `MilvusSearchRequest`.

Add unit tests for MilvusVectorStore and MilvusSearchRequest

Introduce comprehensive unit tests to validate the functionality of MilvusVectorStore and MilvusSearchRequest, including scenarios for native and filter expressions. Refactor MilvusVectorStore to improve filter expression handling by introducing a helper method for converted expressions.

Add detailed documentation for MilvusSearchRequest usage

Introduced sections explaining MilvusSearchRequest's parameters, `nativeExpression`, and `searchParamsJson`, with examples for enhanced clarity. This update provides guidance on leveraging Milvus-specific features for precise filtering and optimal search performance.

Signed-off-by: waileong <wai_leong1015@hotmail.com>
2025-03-05 11:33:07 +00:00
Ilayaperumal Gopinathan
c91163b6a3 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 <ilayaperumal.gopinathan@broadcom.com>

Disable autoconfig IT until the auto-configuration is modularised
2025-02-26 18:09:34 -05:00
Ilayaperumal Gopinathan
0065949d5f Upgrade Milvus java sdk to 2.5.4
- Upgrade Milvus java sdk to 2.5.4
  - Remove use of fastjson
    - Use com.google.gson.JsonObject as Milvus SDK replaces fastjson with gson
  - Change SearchResult RowRecord similarity metric name to score
     - Milvus SDK 2.5.4 uses "score" instead of "distance"

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-02-26 14:39:26 -05:00
Soby Chacko
8e23422dc0 Vector store classes checkstyle fix
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-18 19:40:22 -05:00
Jonas Muribø
fcc56f4abf Fix issue with CosmosDBVectorStore.Builder where the different Assert.hasText(..., "... must not be empty") evaluates the current value (null) rather than the argument passes to each builder function. Fix issue where partitionKeyPath is required, yet is never configured via CosmosDBVectorStoreAutoConfiguration
Signed-off-by: Jonas Muribø <jmurib@gmail.com>
2025-02-17 17:31:49 +00:00
Soby Chacko
4d692a542b Add missing integration tests for delete by ID API in vector store implementations.
Extract common vector store delete tests to base class

This commit extracts shared delete operation tests into a reusable BaseVectorStoreTests class.
This reduces code duplication and provides a consistent test suite for delete operations across
different vector store implementations. The base class includes tests for:

Deleting by ID
Deleting by filter expressions
Deleting by string filter expressions

Most of the vector store implementation now extends this base class and inherits these
common tests while maintaining the ability to add vector store specific tests.

Adding javadoc

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-12 20:09:08 +00:00
Soby Chacko
3f0557b8b3 Vector store impls: code cleanup and checkstyle fixes
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-11 16:16:57 -05:00
Soby Chacko
a36a987167 Fix OpenSearch vector store test failures
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-06 15:26:36 -05:00
Soby Chacko
1fee0827e4 Fixing ElasticsearchVectorStoreIT test failures
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-06 14:10:02 -05:00
ogbozoyan
cd871eaddc VectorStoreChatMemoryAdvisor constructors cleanup
- Deprecate all constructors except one with all fields
 - Update the build method to include order in the VectorStoreChatMemoryAdvisor's constructor
2025-02-06 17:32:42 +00:00
Soby Chacko
6035516044 GH-2165: Simplify VectorStore delete method to return void
- Change VectorStore.delete() and related implementations to return void instead of Optional<Boolean>
- Remove unnecessary boolean return values and success status checks across all vector store implementations
- Clean up tests by removing redundant assertions
- Implementations continue using runtime exceptions for error signaling

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-06 15:10:47 +00:00
Ilayaperumal Gopinathan
1c6132caf4 Update to Spring Boot 3.4.2 for dependency management (#2176)
- Spring AI's dependencies management to derive from Spring Boot 3.4.2
    - Remove explicit versioning of dependencies
  - Update upgrade notes for Spring Boot 3.4.2
  - Fix ElasticSearch client changes with the latest dependency derived from Spring Boot 3.4.2
2025-02-05 23:25:18 -05:00
Ilayaperumal Gopinathan
54f49b5580 Fix PgVectorAutoconfiguration to use PgIDType 2025-02-05 23:39:34 +00:00
jitokim
4dbe73433a Refactor ID handling for different IdType formats
- Add handling for UUID, TEXT, INTEGER, SERIAL, BIGSERIAL formats in `convertIdToPgType` function.
- Implemented type conversion logic based on the IdType value (UUID, TEXT, INTEGER, SERIAL, BIGSERIAL).
- Add unit tests to validate correct conversion for UUID and non-UUID IdType formats.
  - `testToPgTypeWithUuidIdType`: Validates UUID handling.
  - `testToPgTypeWithNonUuidIdType`: Validates handling for non-UUID IdTypes.

Signed-off-by: jitokim <pigberger70@gmail.com>
2025-02-05 23:39:34 +00:00
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