Commit Graph

675 Commits

Author SHA1 Message Date
jonghoon park
0719f44016 rename files from Mpc to Mcp for consistency
Signed-off-by: jonghoon park <dev@jonghoonpark.com>
2025-02-20 18:25:24 +09:00
jonghoon park
b97531bc25 fix sample code in bedrock-converse.adoc
Signed-off-by: jonghoon park <dev@jonghoonpark.com>
2025-02-19 17:25:36 +00:00
Christian Tzolov
fd9f388724 fix blroken doc link
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-14 16:47:32 +01:00
Christian Tzolov
7bc79f51d1 chore(openai): update default chat model to gpt-4o-mini
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-14 14:46:17 +01:00
Christian Tzolov
1fdda61db8 feat(autoconfigure): Support both FunctionCallback and ToolCallback in ToolCallingAutoConfiguration
- Extends the ToolCallingAutoConfiguration to support both FunctionCallback and ToolCallback types.
- The toolCallbackResolver bean now handles both callback types through ObjectProvider injection.
- Added comprehensive tests to verify the resolution of multiple function and tool callbacks.
- Introduce new StaticToolCallbackProvider implementation
- Update ToolCallbackProvider to return FunctionCallback[]
- Migrate from List to ToolCallbackProvider in configurations
- Update tests to use new provider pattern
- Enhance tool callback providers to support multiple clients
  - Refactor AsyncMcpToolCallbackProvider and SyncMcpToolCallbackProvider to handle multiple MCP clients
  - Add ToolCallbackProvider support to ChatClient API
  - Deprecate direct tool callback list methods in favor of providers
  - Fix typos in Closeable class names
  - Update MCP documentation with new examples and usage patterns

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-13 20:31:20 +01:00
Thomas Vitale
68ad742f4a Update Maven Central reference
Spring AI milestones are now published to Maven Central. This PR updates all the places where we used to reference Spring Milestones repository.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-02-13 19:07:44 +01:00
Mark Pollack
33ca0cc9ac Update docs to show artifacts for M6 and later are in Maven Central 2025-02-13 12:28:16 -05:00
Thomas Vitale
b7dcfc1198 Anthropic - Adopt ToolCallingManager API
- Update AnthropicChatModel to use the new ToolCallingManager API, while ensuring full API backward compatibility.
- Introduce Builder to instantiate a new AnthropicChatModel since the number of overloaded constructors is growing too big.
- Update documentation about tool calling and Anthropic support for that.

Part of the #2207 epic

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-02-13 09:48:34 +01:00
Christian Tzolov
d50174f242 minor vertex doc fix
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-13 08:44:28 +01:00
Christian Tzolov
710bb05f19 feat(vertex-ai): Refactor Gemini for new tool calling API
- 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>
2025-02-12 22:48:24 -05:00
Christian Tzolov
a8e305d28a refactor(bedrock): Migrate from function calling to tool calling
- Replace function calling with tool calling in BedrockProxyChatModel
- Deprecate function calling related code and APIs
- Add new tool calling manager and options
- Update builder pattern to remove "with" prefix from methods
- Update tests and documentation for tool calling

Part of the #2207 epic

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-12 18:29:48 +00:00
Manuel Andreo Garcia
5ebe485c26 document AzureOpenAIClientBuilderCustomizer (#2224)
Signed-off-by: Manuel Andreo Garcia <manuel@magware.dev>
2025-02-12 12:20:52 -05:00
ddobrin
4d0caa2aff Fixes #1543 Inaccurate warning for VertexAI Gemini Function Calling
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-12 13:57:50 +01:00
Ilayaperumal Gopinathan
7e4b90dc48 AzureOpenAI - Adopt ToolCallingManager API
- Use the new ToolCallingManager API for AzureOpenAI chat model
 - Add Builder to construct AzureOpenAI chat model instance
   - Deprecate existing constructors
 - Update documentation about the change

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-02-12 12:17:25 +00:00
Christian Tzolov
ee9eb0582d Minor doc link fix
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-12 12:46:09 +01:00
Thomas Vitale
6c3a2c39fc Mistral AI - Adopt ToolCallingManager API
- Update MistralAiChatModel to use the new ToolCallingManager API, while ensuring full API backward compatibility.
- Introduce Builder to instantiate a new MistralAiChatModel since the number of overloaded constructors is growing too big.
- Update documentation about tool calling and Mistral AI support for that.
- Add extra validation to ensure the uniqueness of tool names when aggregated from different sources.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-02-12 11:56:03 +01:00
Soby Chacko
0d0eafec6c Update Pinecone vector store docs for the builder pattern 2025-02-12 07:33:47 +00:00
Soby Chacko
86a73f9e87 Add vector store delete API ref docs with examples
- Document delete APIs with ID lists and filter expressions
- Add versioning use case with metadata-based updates

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-11 16:51:21 -05:00
Thomas Vitale
52198ed9d7 OpenAI - Adopt ToolCallingManager API
- Update OpenAiChatModel to use the new ToolCallingManager API, while ensuring full API backward compatibility.
- Introduce Builder to instantiate a new OpenAiChatModel since the number of overloaded constructors is growing too big.
- Update documentation about tool calling and OpenAI support for that.
- Add extra validation to ensure the uniqueness of tool names when aggregated from different sources.
- Ensure consistent merging of options, following Spring Boot strategy.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-02-11 10:54:43 +01:00
Christian Tzolov
9710f780e3 docs: consolidate MCP documentation into Antora structure
- Enhance MCP server boot starter documentation with:
- Improved formatting and organization
- More detailed examples and code snippets
- Better explanations of features and capabilities
- Links to MCP specification
- Example applications section
- Remove standalone documentation files in favor of Antora structure

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-11 10:23:02 +01:00
Christian Tzolov
0f1aca5518 docs: enhance MCP documentation with customization details and examples
- Expand client customization documentation with detailed sections
- Add comprehensive descriptions of MCP components and capabilities
- Improve code examples and explanations
- Add example applications sections for both client and server
- Fix typos and enhance overall documentation structure

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-11 09:56:50 +01:00
Christian Tzolov
fe377ee5e1 Refactor: MCP Autoconfig Modularization
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>
2025-02-11 00:52:00 -05:00
Jinho Lee
015662a118 fix sample code in perplexity-chat.adoc (#2205)
Signed-off-by: birariro <vps32@naver.com>
2025-02-10 15:09:31 -05:00
Robby Zhao
1b216ab17e Fix code indent for the sample code in deepseek-chat.adoc
Signed-off-by: Robby Zhao <robby.zhaox@gmail.com>
2025-02-08 07:35:37 +00:00
BraeschAntoine
171b758934 Update comparison.adoc
Missing the possibility to use image in mulitmodality for Mistral AI

Signed-off-by: BraeschAntoine <vimaire98@gmail.com>
2025-02-07 12:11:39 +00:00
Thilak Kanala
0f3c185911 Update structured-output-converter.adoc
fixed typo

Signed-off-by: Thilak Kanala <51452386+thilak-kanala@users.noreply.github.com>
2025-02-07 10:11:35 +00:00
Ilayaperumal Gopinathan
dc83eb3713 Update MCP dependency management
- Move MCP BOM dependency management configuration into spring-ai parent

Resolves #2180
2025-02-07 09:26:52 +01:00
Soby Chacko
348f3df729 Upgrade notes for vector store delete API breaking change
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-06 20:25:38 -05:00
Ilayaperumal Gopinathan
b46615921d Getting started page cleanup 2025-02-06 11:40:29 +00:00
Xiaojie Wang
325fa97f51 Fix document formatting to correctly display code blocks
Use proper Markdown syntax to wrap code blocks, enabling correct syntax highlighting when rendered.
2025-02-06 11:25:37 +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
Christian Tzolov
f40945bd63 Add Spring AI MCP Integration
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>
2025-02-05 15:54:48 -05:00
Mark Pollack
fc2690cdf8 Add flexible API key management for OpenAI
Introduces a new API key interface that allows users to customize how
API keys are provided and managed in their Spring AI applications. This
change improves security and flexibility by:

- Adding core ApiKey interface and SimpleApiKey implementation
- Adding builder pattern for OpenAiApi creation
- Deprecating public constructors in favor of builder API (since 1.0.0.M6)
- Added docs

The new system enables users to implement their own key management
strategies while maintaining backward compatibility with property-based
configuration.
2025-02-05 14:57:41 -05:00
Konstantin Pavlov
b525309e8c Introduce PII marker for logging sensitive data
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>
2025-02-05 11:09:24 +00:00
Thomas Vitale
2c8579278a Advancing Tool Support - Part 6
* Completed new documentation for Tool Calling
* Added deprecation notes and migration guide to documentation
* Made “call” methods explicit in ToolCallback API
* Consolidated naming: ToolCallExceptionConverter -> ToolExecutionExceptionProcessor
* Consolidated naming: ToolCallResultConvert.apply() -> ToolCallResultConvert.convert()
* Redraw diagrams for consistency

Relates to gh-2049

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-02-05 10:30:30 +01:00
themanojshukla
c92f2d3096 Fix spell error and updated gemma model name
Signed-off-by: themanojshukla <themanojshukla@gmail.com>
2025-02-04 16:15:07 +00:00
Thomas Vitale
560baaae5a Advancing Tool Support - Part 5
* 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>
2025-02-04 12:59:17 +01:00
Ilayaperumal Gopinathan
b86772d44c Add reference doc for Usage changes
- Add documentation for the recent changes on Usage handling
- Add details on how to refer model specific native usage
- Update upgrade notes
2025-02-03 15:05:50 -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
yunjun-lee-kurly
3d3c20d42d Fix typo in deepseek model name in deepseek-chat.adoc
Signed-off-by: yunjun-lee-kurly <yunjun.lee@kurlycorp.com>
2025-02-01 12:38:42 +00:00
Ilayaperumal Gopinathan
ca27895da4 Remove deprecated Amazon Bedrock chat models
- Amzon Bedrock chat models were deprecated to support Amazon Bedrock Converse API for the chat models.
 - This PR removes all the references of the deprecated Amazon Bedrock chat models
   - Remove Amazon Bedrock chat models for anthropic, anthropic3, cohere, jurassic2, titan
      - Remove API, chat options and model
      - Remove tests and doc references
   - Update the doc to reflect the changes
   - Update upgrade notes

Resolves #2124

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-01-31 16:11:52 -05:00
Ilayaperumal Gopinathan
97f7768054 Fix required POM attributes for maven staging deployment 2025-01-29 18:58:38 +00:00
Assassinxc
62ce753b12 Add dimensions option for ZhiPuAi embedding model
- Add dimentions options
 - Add doc for ZhiPuAi embedding dimensions option

Signed-off-by: Assassinxc <330109311@qq.com>
2025-01-29 11:51:30 +00:00
Ilayaperumal Gopinathan
b08b9e8cf4 Support store and metadata OpenAI chat options
- Add store and metadata as OpenAI Chat options
 - Add test
 - Add docs

Resolves #2103
2025-01-28 12:51:34 -05:00
Alexandros Pappas
c33edc7bae Update SpringAI - DeepSeek image (#2135)
Signed-off-by: Alexandros Pappas <alexandros.pappas@yiluhub.com>
2025-01-28 09:18:25 -05:00
Alexandros Pappas
bada403643 Add documentation how to use the OpenAI client to access DeepSeek
Signed-off-by: Alexandros Pappas <alexandros.pappas@yiluhub.com>
2025-01-27 16:45:00 -05:00
Lee Won Jun
8f21c8db2b Update index.adoc 2025-01-27 16:34:53 -05:00
Ilayaperumal Gopinathan
4b64aa0ca6 Refactor Usage handling
- 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
2025-01-27 16:29:07 -05: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