Commit Graph

1946 Commits

Author SHA1 Message Date
Christian Tzolov
fc955c74eb feat(mcp): Refactor MCP server API to use Specification pattern
- 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>
2025-03-25 14:23:12 -04:00
Ilayaperumal Gopinathan
3ca8d703df Update chat client autoconfiguration into Chat model starters 2025-03-25 09:58:39 +00:00
Ilayaperumal Gopinathan
958dbd3089 Fix TransformersEmbeddingModelAutoConfigurationIT
- Update the right settings to enable the configuration properties
2025-03-25 06:46:31 +00:00
Mark Pollack
c11cc739b3 update reference docs for upgrade 2025-03-24 23:07:27 -04:00
Ilayaperumal Gopinathan
5461e8338e Fix Ollam test configuration
- Add missing jackson-module-kotlin for the kotlin tests
  - Fix Function calling options to use ToolCallingChatOptions

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-03-24 15:34:23 -04:00
Soby Chacko
989971f641 Remove coherence vector store boot starter since it is missing the autoconfig (#2565)
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-03-24 15:34:23 -04:00
Soby Chacko
ddf7748786 Add missing vector store autoconfig coorindates to spring-ai-bom (#2564)
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-03-24 15:34:23 -04:00
Soby Chacko
3d494961c2 Migrate Couchbase vector store auto-configuration to dedicated module
- 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>
2025-03-24 15:34:23 -04:00
Mark Pollack
31c953903a Add update prompt 2025-03-24 15:34:23 -04:00
Ilayaperumal Gopinathan
46e4c77e41 Fix autoconfiguration dependencies
- Fix OpenAI autoconfiguration observation dependencies
 - Fix Huggingface autoconfiguration OpenAI test dependency

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-03-24 15:34:23 -04:00
Ilayaperumal Gopinathan
2d778e8a0c Update vector store docs for Spring AI starters
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-03-24 15:34:23 -04:00
Ilayaperumal Gopinathan
ce00204914 Update docs references for the Spring AI model starters
- Update the documentation references to replace the artifact ID name change for the model starters

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-03-24 15:34:23 -04:00
Ilayaperumal Gopinathan
83ff0133cd Update MCP starters
- Update starters for MCP and docs
2025-03-24 15:34:23 -04:00
Ilayaperumal Gopinathan
962f17915b Spring AI BOM updates
- Update the latest changes to autoconfigurations, starters for the Spring AI autoconfigurations and starters

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-03-24 15:34:23 -04:00
Ilayaperumal Gopinathan
4ba932b42a Refactor auto-configurations
- 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>
2025-03-24 15:34:22 -04:00
Soby Chacko
8a1dcfc225 Conditionally enable invidividual vector store implementations
- Introduce top level properties to support conditional logic
- The properties will have the format like "spring.ai.vectorstore.type=<vectorstore provider>" to enable specific vectore store implementation
- 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"

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-03-24 15:34:22 -04:00
Ilayaperumal Gopinathan
6b12ff5ae1 Refactor autoconfigurations for models
- 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>
2025-03-24 15:34:22 -04:00
Soby Chacko
31bc8c470d Migrate vector store observation autoconfiguration to dedicated module
Update the vector store starters with the new observation autoconfig dependency

Other maven configuraiton changes

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-03-24 15:34:22 -04:00
Soby Chacko
fd1f0d9431 Migrate Azure and CosmosDB vector store auto-configurations to dedicated modules
Update dependencies and module names in maven pom.xml files

Update corresponding starter modules

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-03-24 15:34:22 -04:00
Soby Chacko
505046749f Migrate vector store auto-configurations to dedicated modules
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>
2025-03-24 15:34:22 -04:00
Ilayaperumal Gopinathan
448a1aecc9 Fix model autoconfiguration updates for vertext ai and zhipuai 2025-03-24 15:34:22 -04:00
Soby Chacko
7f24740690 Migrate vector store auto-configurations to dedicated modules
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>
2025-03-24 15:34:22 -04:00
Ilayaperumal Gopinathan
0453fc55d5 Modularise Spring AI Spring Boot autoconfigurations
- 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>
2025-03-24 15:34:22 -04:00
P.Sri Varshan
d8ef6efa9c Fix: Added missing return statement in Couchbase Cluster bean example (#2557)
Signed-off-by: PSriVarshan <psvvarshan@gmail.com>
2025-03-24 11:43:24 +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
ghdcksgml1
e4357ba2c1 Refact onFinishReason method to utility class
Test AdvisedResponseStreamUtils

Add java docs

Signed-off-by: ghdcksgml1 <ghdcksgml2@naver.com>
2025-03-21 11:10:07 +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
gongzhongqiang
6b25b62771 fix: Update import and remove qodana configuration
- Update ToolCallback import to use relative package path
- Remove qodana.yaml file from the project

Signed-off-by: gongzhongqiang <gongzhongqiang@apache.org>
2025-03-19 16:17:46 +00:00
gongzhongqiang
f167fd8b3c fix: Update testNonExistingUrl to testNonExistingHtmlResource, use not exist classpath resource
Signed-off-by: gongzhongqiang <gongzhongqiang@apache.org>
2025-03-19 15:43:59 +00:00
Hu Shihao
4c0813dfb3 Update tools.adoc Corrected incorrect punctuation usage (#2503)
Original:
ChatOptions chatOptions = ToolCallingChatOptions.builder()
    .toolCallbacks(customerTools)
    .toolContext(Map.of("tenantId", "acme"))
    .build():

After Change:
ChatOptions chatOptions = ToolCallingChatOptions.builder()
    .toolCallbacks(customerTools)
    .toolContext(Map.of("tenantId", "acme"))
    .build();

Signed-off-by: Hu Shihao <122598964+Hushihaoooooo@users.noreply.github.com>
2025-03-19 11:52:08 +00:00
cc0824
61c60a6126 Update deepseek-chat.adoc (#2515)
Signed-off-by: cc0824 <45746445+cc0824@users.noreply.github.com>
2025-03-19 11:49:15 +00:00
Alexandros Pappas
4fc6edd80c chore: remove unused imports from core - tests - autoconfigure (#2471)
Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-03-17 15:55:04 +00:00
Alexandros Pappas
1f2713801c chore: remove unused imports (#2470)
Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-03-17 15:53:52 +00:00
shown
0164b5dcf9 optimize: OpenAI chat model code cleanup (#2483)
* optimize: use already defined variables

Signed-off-by: yuluo-yx <yuluo08290126@gmail.com>
2025-03-17 15:51:10 +00:00
gongzhongqiang
3f344a311d fix: Fix validate prefix and toolName logic in prefixedToolName method
Signed-off-by: gongzhongqiang <gongzhongqiang@apache.org>
2025-03-17 15:47:31 +00:00
jonghoon park
77ee57cec0 allow null usage for openai embedding model
Signed-off-by: jonghoon park <dev@jonghoonpark.com>
2025-03-17 15:43:27 +00:00
MagicalConch
cdac6ee42f Update mcp-client-boot-starter-docs.adoc
Signed-off-by: MagicalConch <37917403+git102347501@users.noreply.github.com>
2025-03-17 15:36:46 +00:00
Christian Tzolov
690d242c22 feat: Add AOP proxy support to MethodToolCallbackProvider
This change ensures that @Tool annotated methods can be properly discovered even when the tool objects are wrapped
in Spring AOP proxies, which is common when using aspects or other proxy-based features.

- Enhance MethodToolCallbackProvider to properly handle AOP proxied tool objects by detecting proxies
  and retrieving their target classes when scanning for @Tool annotated methods.
- Add test suite in MethodToolCallbackProviderAopTests.java to verify AOP proxy handling

Resolves #2356

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-03-14 10:47:53 +01:00
Alexandros Pappas
bc375ab961 This commit enhances AzureOpenAiChatOptions by:
- Adding `equals` and `hashCode` methods for proper object comparison.
- Implementing a deep `copy()` method, creating new instances of mutable collections (List, Set, Map, Metadata) to prevent shared state.
- Adding `AzureOpenAiChatOptionsTests` to verify `copy()`, builders, setters, and default values.

Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-03-13 11:39:49 +01:00
Gareth Evans
beb81ef409 chore: add missing toolCallbacks(vargs) to vertex chat options
Signed-off-by: Gareth Evans <gareth@bryncynfelin.co.uk>
2025-03-13 07:57:10 +01:00
Christian Tzolov
9e390c11a8 docs: Update repository configuration in getting-started guide
- Reorganize sections to focus on Milestones vs Snapshots instead of specific versions
- Add Central Portal Snapshots repository configuration for both Maven and Gradle

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-03-12 14:03:36 -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
Soby Chacko
d5203ed038 Fix array comparison and add final modifiers in embedding classes
- Fix Embedding equals() using Arrays.equals() for embedding array comparison
- Fix Embedding hashCode() using Arrays.hashCode() for proper array hashing
- Add final modifiers to fields in Embedding classes

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-03-12 16:56:44 +00:00
ivy
127f7009eb fix: Improve error handling in MCP tool callbacks
- Add null check for isError() method in SyncMcpToolCallback
- Implement consistent error handling in AsyncMcpToolCallback to match SyncMcpToolCallback behavior
- Throw IllegalStateException with error content when tool calls fail

Resolves #2447

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Co-authored-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-03-12 14:17:00 +01:00
Manuel Andreo Garcia
e4853d757a fix azure openai chat model doc OpenAIClientBuilderCustomizer usage example
Signed-off-by: Manuel Andreo Garcia <manuel@magware.dev>
2025-03-12 10:30:49 +00:00
Christian Tzolov
a3b2462f1c Add condition tests for MCP client transport auto-configurations
- Add SseHttpClientTransportAutoConfigurationTests to verify conditional bean creation for HTTP client transports
- Add SseWebFluxTransportAutoConfigurationTests to verify conditional bean creation for WebFlux client transports
- Test both auto-configurations with various conditions including presence/absence of WebFluxSseClientTransport and MCP client enabled/disabled states

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-03-12 10:27:04 +00:00
Justin Martz
dcc91487b4 Update openai-chat.adoc
Existing example displays a typo in the code example for Runtime Options:

ChatResponse response = chatModel.call(
    new Prompt(
        "Generate the names of 5 famous pirates.",
        OpenAiChatOptions.builder()
            .model("gpt-4-o")
            .temperature(0.4)
        .build()
    ));

Using gpt-4-0 generates this error:
org.springframework.ai.retry.NonTransientAiException: 404 - {
    "error": {
        "message": "The model `gpt-4-o` does not exist or you do not have access to it.",
        "type": "invalid_request_error",
        "param": null,
        "code": "model_not_found"
    }
}

Changing the model String in the example to "gpt-4o" resolves this.
2025-03-12 07:28:10 +00:00
虎鸣
66e8d88815 chore: Remove unnecessary public modifier in ToolCallbackProvider.
Signed-off-by: 虎鸣 <hepin.p@alibaba-inc.com>
2025-03-11 21:03:30 +00:00
Alexandros Pappas
e81f64c0fc feat(spring-ai-azure-openai): update azure-open-ai-client to 1.0.0-beta.14
resolves https://github.com/spring-projects/spring-ai/issues/2424

Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-03-11 16:09:37 -04:00
Christian Tzolov
0b5da6b8c8 refactor: replace direct dependencies with ObjectProvider in MCP transports
Replace direct dependencies with ObjectProvider pattern in SSE transport auto-configurations.

- Uses ObjectProvider for ObjectMapper and WebClient.Builder dependencies
- Removes redundant @ConditionalOnMissingBean methods
- Provides fallback instantiation when dependencies are not available

Resolves #2440

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-03-11 17:44:50 +01:00