Commit Graph

1946 Commits

Author SHA1 Message Date
Christian Tzolov
3f7f2f1bff fix(mcp): standardize MCP tool name formatting and improve error handling
- Add prefixedToolName utility method to ensure consistent tool name formatting
- E nforce alphanumeric, underscore, and hyphen characters only in tool names
- Limit tool names to 64 characters maximum
- Use original tool name in actual calls while using formatted names in definitions
- Add error handling for tool call responses in SyncMcpToolCallback
- Update tests to reflect the changes

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-03-11 17:28:47 +01:00
Ilayaperumal Gopinathan
ded9facfe5 Remove deprecations from 1.0.0-M6
- 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>
2025-03-11 10:42:03 -04:00
Ilayaperumal Gopinathan
a1e417f350 Fix McpServerAutoConfigurationIT
- Fix MCP client mock for client info
2025-03-11 14:31:03 +00:00
Christian Tzolov
957150128b feat(mcp): Prefix tool names with client name to avoid naming conflicts
Enhances MCP tool naming by prefixing tool names with their client + transport name
to prevent conflicts when multiple MCP clients expose tools with the same name.

- Modifies client info in McpClientAutoConfiguration to include transport name
- Updates SyncMcpToolCallback and AsyncMcpToolCallback to prefix tool names with client + transport name
- Adds test coverage for tools with identical names but different client info

Resolves #2393

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-03-11 13:14:52 +01:00
Christian Tzolov
58ed5ea59f feat(mcp): handle ToolContext in MCP tool callbacks
- Implement the new ToolCallback.call(String, ToolContext) method in both Sync and Async MCP tool callbacks.
- Since MCP tools don't support tool context, the implementation ignores the context parameter and
  delegates to the existing call(String) method. Added test to verify the behavior.

Resolves #2378

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-03-10 15:04:26 +01:00
Dariusz Jędrzejczyk
28bceb3ac5 Prevent blocking event loop calling tools
When streaming happens on an event loop, due to the fact that currently
tools can only be synchronous and blocking, every tool call needs to be
offloaded to a blocking-safe Scheduler.

Resolves #2341

Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
2025-03-10 14:08:56 +01: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
CChuYong
a6b4555d45 fix typo in spring-ai-mcp-server
Signed-off-by: CChuYong <yeongmin1061@gmail.com>
2025-03-10 12:11:00 +01:00
Christian Tzolov
72bb5ca296 feat(mcp): Update to MCP SDK 0.8.0-SNAPSHOT and fix client initialization
- 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>
2025-03-10 10:46:09 +00:00
magicgone
206b9e220a Add Context Support to Query in RetrievalAugmentationAdvisor
Signed-off-by: magicgone <magic4gone@gmail.com>
2025-03-10 10:40:02 +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
Ahoo Wang
1ca4709e39 fix(mcp-server): improve code quality and readability
- Remove unused imports
- Fix typos in variable names (e.g., toolResgistrations -> toolRegistrations)

Signed-off-by: Ahoo Wang <ahoowang@qq.com>
2025-03-08 18:46:08 +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
jonghoon park
bf0558bb79 fix typo in McpToolUtils.java
Signed-off-by: jonghoon park <dev@jonghoonpark.com>
2025-03-06 16:34:34 +09: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
magicgone
bb7c52cdb1 Add documentFormatter parameter to ContextualQueryAugmenter
This enhancement adds a documentFormatter parameter to ContextualQueryAugmenter,
allowing users to customize how documents are formatted in the context.
If not specified, the original document formatting logic is preserved.

Signed-off-by: magicgone <magic4gone@gmail.com>
2025-03-05 08:57:19 +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
shahbazaamir
2394ac82ad Added test cases to cover usage of ExtractedTextFormatter
Signed-off-by: shahbazaamir <shahbaz07dbit@gmail.com>
2025-03-03 13:30:50 +00:00
pavel
608b29cf93 small code improvements/clean-ups, deleted unused method 'withEmbedding' from SimpleVectorStoreContent class
Signed-off-by: pavel <ppetrashov.dev@gmail.com>
2025-03-03 11:12:14 +00:00
jonghoon park
29fde4f7f1 Make allow negative keep alive value with OllamaEmbeddingModel
Signed-off-by: jonghoon park <dev@jonghoonpark.com>
2025-03-03 10:33:32 +00:00
Alexandros Pappas
092bbae5a1 feat: Add equals, hashCode, deep copy, and tests to AnthropicChatOptions
This commit enhances `AnthropicChatOptions` 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 `AnthropicChatOptionsTests` to verify `copy()`, builders, setters, and default values.

Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-03-02 12:43:09 +01: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
Yufeng
dcdfd7a72a - fix bug @ConditionalOnMissingClass class declaration
- change from "public class WebFluxSseClientTransport" to "WebFluxSseClientTransport"

Signed-off-by: Yufeng <jiangyufeng.0918@gmail.com>
2025-03-01 03:23:15 +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
蕭洛
6be3d0a809 Add new Ollama models: LLAMA3_2_3B
Signed-off-by: 蕭洛 <799332391@qq.com>
2025-02-27 11:16:07 +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
82d98b6b48 fix: reverse ToolContext validation logic in MethodToolCallback
Changes the validation logic in MethodToolCallback to check if a ToolContext is required by the method but not provided,
rather than checking if a ToolContext is provided but not supported by the method.
This ensures methods that expect a ToolContext parameter receive one.

Updates tests cases to reflect the new validation logic

Resolves #2337

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-02-27 11:07:54 +01: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
Ilayaperumal Gopinathan
96c8157cbe Fix BaseVectorStoreTests
- Fix assertion of value which is in Double in some of the vector stores (Milvus, Pinecone for now)

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-02-26 22:27:52 +00:00
Ilayaperumal Gopinathan
0065949d5f Upgrade Milvus java sdk to 2.5.4
- 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>
2025-02-26 14:39:26 -05:00
Soby Chacko
70fe412ee8 Update qdrant version to 1.13.0
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-25 15:02:08 -05:00
Soby Chacko
7e3e8ec6cb Upgrade weaviate client to 5.0.1
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-24 15:25:56 -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
waileong
0822c91ad7 Added configuration options for database, collection names, embedding dimensions, index and metric types, and field names in the MilvusVectorStoreAutoConfiguration.
- Configuration options like `databaseName`, `collectionName`, `embeddingDimension`, `indexType`, and `metricType` were added.
- Additional parameters including `indexParameters`, `iDFieldName`, `contentFieldName`, `metadataFieldName`, and `embeddingFieldName` were incorporated into the builder method.

Signed-off-by: waileong <wai_leong1015@hotmail.com>

Apply spring-javaformat

Signed-off-by: waileong <wai_leong1015@hotmail.com>
2025-02-24 14:03:14 +00:00
Beksultan
07c2b9df1b Update FunctionCallback.java
Update parameter name tooContext to toolContext in method FunctionCallback.call() 😅

Signed-off-by: bmamatkadyr <beksultancs@gmail.com>
2025-02-24 10:39:18 +00:00
Soby Chacko
ce8e8b9d7c Remove WeaviateVectorStoreAutoConfiguration from AutoConfiguration.imports
- Since we are moving auto-configuration to individual modules, remove this unncessary entry

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-20 21:18:14 -05:00
Soby Chacko
413ab9692d Migrate weaviate store auto-config to its own module
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>

Fixing typo, adding new autoconfig module to starter module

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-20 15:37:41 +00: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
Soby Chacko
8e23422dc0 Vector store classes checkstyle fix
Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-02-18 19:40:22 -05:00
Ilayaperumal Gopinathan
83dcf385dd Add boot configuration processor to MCP Autoconfiguration POMs (#2274)
- Adding Spring Boot configuration processor for the tools autocompletion support

Resolves #2273

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-02-18 13:17:58 -05:00
Jonas Muribø
fcc56f4abf Fix issue with CosmosDBVectorStore.Builder where the different Assert.hasText(..., "... must not be empty") evaluates the current value (null) rather than the argument passes to each builder function. Fix issue where partitionKeyPath is required, yet is never configured via CosmosDBVectorStoreAutoConfiguration
Signed-off-by: Jonas Muribø <jmurib@gmail.com>
2025-02-17 17:31:49 +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
Alexandros Pappas
c623264666 refactor: replace wildcard imports with explicit class imports
Signed-off-by: Alexandros Pappas <apappascs@gmail.com>
2025-02-14 14:12:43 +00:00