Since the builders for HTTP clients are mutable and shared, they should
only be configured with globally applicable settings. The current use
leaks specific details into other usages and affects newly instantiated
clients. This PR applies the clone() method right before mutation
happens as it probably is the strategy that avoids multiple unnecessary
copies.
feat: improve RestClient and WebClient instantiation and configuration across AI modules
- Ensure RestClient.Builder and WebClient.Builder are properly cloned before setting base URLs and headers in Mistral, OpenAI, and Ollama API classes to prevent side effects.
- Add WebClientAutoConfiguration to auto-configuration classes for Anthropic and Mistral AI modules.
- Update Mistral AI auto-configuration to inject and use WebClient.Builder.
- Clean up test and annotation usage (remove unnecessary @Nullable, fix test builder usage in AnthropicApiIT).
- Improve consistency and reliability of HTTP client configuration across model integrations.
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Co-authored-by: Christian Tzolov <christian.tzolov@broadcom.com>
* Update remaining Advisors and related classes to use the new APIs.
* In AbstractChatMemoryAdvisor, the “doNextWithProtectFromBlockingBefore()” protected method has been changed from accepting AdvisedRequest to ChatClientRequest. It’s a breaking change since the alternative was not part of M8.
* MessageAggregator has a new method to aggregate messages from ChatClientRequest. The previous method aggregating messages from AdvisedRequest has been removed. Warning since it wasn’t marked as deprecated in M8.
* In SimpleLoggerAdvisor, the “requestToString” input argument needs to be updated to use ChatClientRequest. It’s a breaking change since the alternative was not part of M8. Same thing about the constructor.
* The “getTemplateRenderer” method has been removed from BaseAdvisorChain. Each Advisor is encouraged to accept a PromptTemplate to achieve self-contained prompt augmentation operations.
* Remove deprecations in ChatClient and Advisors, and update tests accordingly.
* When building a Prompt from the ChatClient input, the SystemMessage passed via systemText() is placed first in the message list. Before, it was put last, resulting in errors with several model providers.
Relates to gh-2655
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
- Remove deprecated constructors from OllamaApi and AnthropicApi
- Modify AnthropicApi's public constructor to be private so that only the builder method can use it to construct
- Update OllamApiAutoConfiguration and AnthropicChatAutoconfiguration to use the builder methods to construct the respective
Apis
- Fix other constructor usages to builder methods
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
Update multiple dependency versions including:
- Milvus from 2.5.4 to 2.5.7
- Azure Search from 11.6.1 to 11.7.6
- Weaviate client from 5.0.1 to 5.2.0
- Typesense from 0.5.0 to 1.3.0 (with matching code update)
- OpenSearch client from 2.10.1 to 2.23.0
- MariaDB from 3.5.1 to 3.5.3
- Couchbase from 3.7.8 to 3.8.0
- Neo4j Cypher DSL from 2024.0.2 to 2024.5.1
- Jedis from 5.1.0 to 5.2.0
Updates TypesenseVectorStore to use IndexAction enum instead of string literal.
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
- 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
- Remove batch strategy usage as it is taken care by the vector store parent builder
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
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>
- 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>
- 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>
- 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
- 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>
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>
- 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>
- 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
- 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>