Commit Graph

772 Commits

Author SHA1 Message Date
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
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
Thomas Vitale
5a4e9f5108 Request-time filter expressions for RAG
When using the RetrievalAugmentationAdvisor with the VectorStoreDocumentRetriever, it’s now possible to provide a filter expression at request-time as an advisor context variable with key VectorStoreDocumentRetriever.FILTER_EXPRESSION.

Fixes gh-1776

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-03-10 11:45:17 +00:00
Alexandros Pappas
82b46d2182 feat: add JSoup HTML document reader
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>
2025-03-10 11:34:25 +00:00
Alexandros Pappas
6512ec4257 Fix property name in Redis documentation
Fixes #2414

resolves: https://github.com/spring-projects/spring-ai/issues/2414

Current implementation of RedisProperties: https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/redis/RedisProperties.java#L49

Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-03-10 07:53:26 +00:00
hungrytech
bed1db352a fix vertordbs opensearch.adoc
Signed-off-by: hungrytech <xorals9448@gmail.com>
2025-03-08 18:52:54 +00:00
jonghoon park
2903b2019d fix typo in rag doc
Signed-off-by: jonghoon park <dev@jonghoonpark.com>
2025-03-07 12:34:53 +00:00
Christian Tzolov
87f45d0dac Improve referenced doc navigation
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-03-07 10:28:50 +01: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
jonghoonpark
747524b815 update anthropic model version in example code
Signed-off-by: jonghoonpark <dev@jonghoonpark.com>
2025-03-05 08:53:19 +00:00
Christian Tzolov
53bb6a5b00 feat(mcp): add support for custom MIME types in tool responses
Add capability to specify MIME types for MCP tool responses, with special handling for image content.

This enhancement allows tools to return different content types, particularly images, by:
- Adding a new toolResponseMimeType map property to configure response MIME types per tool
- Extending tool registration methods to accept and use MIME type information
- Adding special handling for image content in tool responses
- Updating documentation with the new configuration options

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-03-01 19:55:26 +01:00
Christian Tzolov
041d94f0c9 feat(anthropic): add support for custom HTTP headers in Anthropic API requests (#2343)
Add the ability to specify custom HTTP headers for Anthropic API requests through AnthropicChatOptions.
This allows users to override or add headers for authentication, tracking, or other API-specific requirements.

- Add httpHeaders field to AnthropicChatOptions with appropriate getters/setters
- Implement header merging between default and runtime options
- Update AnthropicApi to accept additional HTTP headers in API calls
- Add integration test demonstrating API key override via custom headers
- Update documentation with the new configuration property

Resolves #2335

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-28 09:57:10 -05:00
Jaeyeon Kim
6cb15e4727 Update azure-openai-chat.adoc
Signed-off-by: jaeyeonling <jaeyeonling@gmail.com>
2025-02-27 11:30:02 +00:00
birariro
1599c2e500 Modify the sample code
- Modify how OpenAiChatOption is used
- Modify how OllamaOptions is used

Signed-off-by: birariro <vps32@naver.com>
2025-02-27 11:02:05 +00:00
xuweidong
2c7283483e correct wrong property name
Signed-off-by: xuweidong <xuweidong253@gmail.com>
2025-02-27 10:57:22 +00:00
Christian Tzolov
3dfea48249 feat(anthropic): update to Claude 3.7 Sonnet and refactor API
- Add support for Claude 3.7 Sonnet model and make it the default
- Rename function-related APIs to tool-related APIs for consistency:
- Change functionCallbacks to toolCallbacks
- Change function to toolNames
- Replace FunctionCallingOptions with ToolCallingChatOptions
- Refactor AnthropicChatModel instantiation to use builder pattern
- Update tests to use latest model versions instead of dated versions

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-26 22:36:52 -05: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
Christian Tzolov
b29076f9a4 docs: Improve MCP overview with Spring Boot integration details
Reorganize MCP documentation to better explain Spring AI's integration with the MCP Java SDK.
 Add references to client and server boot starters and clarify the distinction between core
 SDK architecture and Spring Boot integration.

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-24 18:48:15 +01:00
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