- 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
Extract functionality from spring-ai-core into dedicated modules:
- spring-ai-commons: Common utilities and document handling
- spring-ai-model: Core model interfaces and implementations
- spring-ai-vector-store: Vector store abstraction and implementation
This modularization creates clearer responsibility boundaries and allows
consumers to include only what they need. The restructuring will make the
codebase easier to maintain and extend as the project grows.
- Rename Registration classes to Specification (SyncToolRegistration → SyncToolSpecification)
- Update transport classes to use Provider suffix (WebFluxSseServerTransport → WebFluxSseServerTransportProvider)
- Add exchange parameter to handler methods for better context passing
- Introduce McpBackwardCompatibility class to maintain backward compatibility
- Update MCP Server documentation to reflect new API patterns
- Add tests for backward compatibility
- Update mcp version to 0.8.0
- Add mcp 0.8.0 breaking change note-
The changes align with the MCP specification evolution while maintaining backward compatibility through deprecated APIs.
refactor: Extract MCP tool callback configuration into separate auto-configuration
Extracts the MCP tool callback functionality from McpClientAutoConfiguration into a
new dedicated McpToolCallbackAutoConfiguration that is disabled by default.
- Created new McpToolCallbackAutoConfiguration class that handles tool callback registration
- Made tool callbacks opt-in by requiring explicit configuration with spring.ai.mcp.client.toolcallback.enabled=true
- Removed deprecated tool callback methods from McpClientAutoConfiguration
- Updated ClientMcpTransport references to McpClientTransport to align with MCP library changes
- Added tests for the new auto-configuration and its conditions
refactor: standardize tool names to use underscores instead of hyphens
- Change separator in McpToolUtils.prefixedToolName from hyphen to underscore
- Add conversion of any remaining hyphens to underscores in formatted tool names
- Update affected tests to reflect the new naming convention
- Add comprehensive tests for McpToolUtils.prefixedToolName method
- Add integration test for payment transaction tools with Vertex AI Gemini
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Update dependencies and module names in maven pom.xml files affecting couchbase vector store support
- Rename artifact from spring-ai-couchbase-store-spring-boot-starter to spring-ai-starter-vector-store-couchbase
- Update imports and related cleanup
- Update corresponding documentation references
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
- Split model autoconfigurations based on the model
- Change the autoconfiguration class into model specific autoconfigurations - chat, embedding, image etc.,
- Update/add tests based on this change
- Make sure the conditional logic to enable the model auto configuration is at the class level so that the configuration properties as well as the models are not enabled when the model is explicitly disabled. By default, the condition will allow enabling the beans if not explicitly overridden.
- Remove spring-ai-spring-boot-autoconfigure as a dedicated auto-configuration module
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
- Conditionally enable invidividual models within the provider
- Introduce top level properties to support conditional logic
- The properties will have the format like "spring.ai.model.<chat/embedding/image etc.,>=<provider>" to enable specific chat/embedding/image/audio/moderation models by the provider. By default, these will be enabled when no specific properties are set. To disable, set any value other than the provider name for example, "none"
- For the auto configurations where the provider has multiple models, split the autoconfiguration into per model auto-configuration classes. This will enable the isolated auto-configurations for each provider and its model.
- This PR addresses this for OpenAI and others will follow in subsequent PRs
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
Update the vector store starters with the new observation autoconfig dependency
Other maven configuraiton changes
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
Move vector store auto-configuration classes to dedicated modules under auto-configurations/vector-stores/:
- Creates separate modules for Cassandra, Chroma, Elasticsearch, GemFire, HanaDB, MariaDB, MongoDB Atlas, Neo4j, OpenSearch, Oracle, PGVector, and Redis vector stores
- Updates package names to follow the pattern org.springframework.ai.vectorstore.<implementation>.autoconfigure
- Renames corresponding starter modules to follow the pattern spring-ai-starter-vector-store-<implementation>
- Updates import paths in affected classes
- Relocates test resources alongside their respective implementations
- Updates imports in spring-ai-spring-boot-docker-compose and spring-ai-spring-boot-testcontainers
This change improves modularity by allowing each vector store implementation to be
independently versioned and maintained, following the migration pattern established
with previous vector store autoconfiguraiton and starters .
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
Move vector store auto-configuration classes to dedicated modules under auto-configurations/vector-stores/:
- Creates separate modules for Milvus, Pinecone, Qdrant, and Typesense vector stores
- Moves CommonVectorStoreProperties to spring-ai-core for better reusability
- Updates pom.xml dependencies to maintain proper relationships between modules
- Name the artifacts based on the pattern spring-ai-autoconfigure-vector-store-<implementation>.
For example - spring-ai-autoconfigure-vectore-store-milvus
- Package names follow the pattern org.springframework.ai.vectorstore.<implementation>.autoconfigure
- Naming the correspondinbg starter modules accordingly (spring-ai-starter-vector-store-milvus for example).
This change improves modularity by allowing each vector store implementation to be
independently versioned and maintained, continuing the migration pattern established
with previous vector stores.
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
- Split spring-ai-spring-boot-autoconfigure into modules
- This PR addresses the restructuring of the following spring boot autoconfigurations:
- spring-ai retry -> common
- spring-ai chat client/model/memory -> chat
- spring-ai chat/embedding/image observation -> observation
- spring-ai chat/embedding models -> models
- Update the Spring AI BOM and boot starters with the new autoconfigure modules
- Rename the autoconfiguration and starters
- The package name for the models in autoconfiguration classes will have `org.springframework.ai.model.<name>.autoconfigure`
- Both the autoconfiguration and starters will have the prefix `spring-ai-autoconfigure-model` and `spring-ai-starter-model` respectively
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>
This commit introduces the `JsoupDocumentReader` and `JsoupDocumentReaderConfig` classes, which provide functionality to read and parse HTML documents using the JSoup library.
The reader supports:
- Extracting text from specific HTML elements using CSS selectors.
- Extracting all text from the body of the document.
- Grouping text by element.
- Extracting metadata, including the document title, meta tags, and link URLs.
- Reading from various resource types (files, URLs, byte arrays).
- Configurable character encoding, selector, separator, and metadata extraction.
This new reader enhances Spring AI's ability to process web content and other HTML-based data sources.
Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
- Make MCP client initialization blocking with .block() call
- Upgrade MCP SDK version from 0.7.0 to 0.8.0-SNAPSHOT
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.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>
- Migrate from function calling to tool calling API
- Add support for Gemini 2.0 models (flash, flash-lite)
- Implement JSON schema to OpenAPI schema conversion
- Add builder pattern for improved configuration
- Deprecate legacy function calling constructors and methods
- Update default model to GEMINI_2_0_FLASH
- Add comprehensive test coverage for tool calling
- Upgrade victools dependency to 4.37.0
- Update the Vertex Tool calling docs
Part of the #2207 epic
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Core Architecture Changes:
- Split MCP into dedicated client/server modules
- Created separate starters: spring-ai-starter-mcp-webmvc and spring-ai-starter-mcp-webflux
- Removed property-based transport configuration in favor of auto-configuration
- Added support for multiple transport types (STDIO, WebMVC, WebFlux)
Client Improvements:
- Added support for both synchronous and asynchronous MCP clients
- Fixed client auto-configuration issues
- Added root change notification property to common properties
Configuration Enhancements:
- Improved configuration properties organization and validation
- Added ConditionalOnMissingBean for WebMvc/WebFlux configurations
- Enhanced lifecycle management and customization support
Testing and Documentation:
- Added comprehensive integration tests for McpClientAutoConfiguration
- Updated McpServerAutoConfigurationIT
- Added extensive JavaDoc documentation
- Improved MCP client/server starter documentation
- Added documentation for common utilities
- Updated navigation for new MCP documentation sections
Signed-off-by: Christian Tzolov <christian.tzolov@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
Adds comprehensive Model Context Protocol (MCP) integration to Spring AI, including:
Core Features:
- MCP client implementation with Spring AI tool calling capabilities
- Spring-friendly abstractions for MCP clients and servers
- Both synchronous and asynchronous MCP server operation modes
- Add MCP client autoconfiguration with support for STDIO, WebMVC and WebFlux transports
- Auto-configuration for MCP server components
- Spring Boot starter (spring-ai-starter-mcp) with WebFlux and WebMVC support
- MCP dependency management with BOM
- Add close() method to McpToolCallback for proper resource cleanup
- Add initialize flag to control MCP client initialization
- Add comprehensive integration tests and documentation for MCP client configuration
Technical Improvements:
- Split WebMvc and WebFlux configurations into separate auto-configuration classes
- Server type configurable via 'spring.ai.mcp.server.type' property (SYNC/ASYNC)
- Comprehensive test coverage including McpServerAutoConfigurationIT
- Utility classes for converting between Spring AI tools and MCP tools
- MCP SDK version management in parent pom
Reorganize MCP tool utilities and client configuration
- Rename ToolUtils to McpToolUtils for better MCP-specific naming
- Rename McpToolCallbackProvider to SyncMcpToolCallbackProvider
- Add utility methods for handling tool callbacks in McpToolUtils
- Extract client configuration logic into new McpClientDefinitions class
- Add tool callback support to ChatClient interface and implementations
- Remove redundant integration test
Introduce MCP client customization support
- Add McpSyncClientCustomizer interface for customizing MCP sync clients
- Replace McpClientDefinitions with McpSyncClientConfigurer
- Refactor MCP client initialization to support customization
- Remove redundant close() method from McpToolCallback
- Fix conditional class dependencies in WebMvc/Flux configurations
Add MCP AOT hints
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Introduce a utility class `LoggingMarkers` providing an SLF4J marker for tagging log entries with Personally Identifiable Information (PII). Update `BeanOutputConverter` to use the `PII_MARKER` in error logs for invalid JSON conversions. Enhance tests to verify PII marker usage in logging.
- Set Java version dynamically and configure Kotlin compiler
- Updated Maven configurations to dynamically reference the Java version using `${java.version}`. Added Kotlin compiler settings, including `jvmTarget` alignment with Java version and enabling `javaParameters`. This ensures consistency and better compatibility across builds.
- Fix log assertion in BeanOutputConverterTest to use Java 17
- Updated the test to assert log size explicitly before accessing the first log entry. This ensures the test is more robust and avoids potential issues with accessing logs unexpectedly.
- Use placeholders in logger.error to prevent string concatenation.
- Replaced string concatenation with a placeholder in the logger.error call to improve performance and maintain consistency with logging best practices. This helps avoid unnecessary overhead when logging is disabled.
- Update logging markers and improve data classification
- Replaced `PII_MARKER` with `SENSITIVE_DATA_MARKER`. Introduced `RESTRICTED_DATA_MARKER`, `REGULATED_DATA_MARKER` and `PUBLIC_DATA_MARKER`
- Updated associated logging logic and tests to reflect these changes.
- Fix punctuation in Javadoc comments for LoggingMarkers.
- Added missing periods to improve consistency and clarity in the Javadoc comments. This change ensures proper formatting and adheres to standard writing conventions.
Signed-off-by: Konstantin Pavlov <{ID}+{username}@users.noreply.github.com>
* Introduced new ToolParam annotation for defining a description for tool parameters and marking them as (non)required.
* Improved the JSON Schema generation for tools, solving inconsistencies between methods and functions, and ensuring a predictable outcome.
* Added support for returning tool results directly to the user instead of passing them back to the model. Introduced new ToolExecutionResult API to propagate this information.
* Consolidated naming of tool-related options in ToolCallingChatOptions.
* Fixed varargs issue in ChatClient when passing ToolCallback[].
* Introduced new documentation for the tool calling capabilities in Spring AI, and deprecated the old one.
* Bumped jsonschema dependency to 4.37.0.
Relates to gh-2049
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
- Remove model specific Usage implementations
- Add `Object getNativeUsage()` to Usage interface
- This will allow the model specific Usage data to be returned
- At the client side, client needs to cast the return type of `getNativeUsage` into the corresponding Usage returned by the model API
- Rename `generationTokens` to `completionTokens`
- Since `completion` token name is more common among the models, renaming generation tokens into completion tokens
- Maintain JSON deserialization compatibility for legacy `generationTokens` field
- Remove deprecated Long-based constructors to avoid API ambiguity
- Change the prompt, completion and total token return types from Long to Integer
- This is a breaking change that requires updating all constructor calls
- Integer is sufficient for token counts and aligns better with most model APIs
- Use DefaultUsage for most of the model specific usage handling
- When initializing set the native usage to the model specific usage type
- Ensure immutability by making all fields final and removing setters
- Add comprehensive test coverage for all functionality including edge cases
Resolves#1407