Skip to content

Conversation

@scionaltera
Copy link
Contributor

This advisor did not have support for setting the similarity threshold, so it defaulted to returning every document regardless of similarity. In a conversation where the user has changed to a different topic the result was returning a bunch of documents with no relevance to the user's latest input.

I experimented with setting a value greater than 0 and liked the results because it would begin to include results more relevant to the conversation. I thought it would be nice to contribute the change back.

I left the default at 0 so as not to change the earlier behavior.

@scionaltera scionaltera changed the title add vector similarity threshold capability to VectorStoreChatMemoryAd… add similarity threshold capability to VectorStoreChatMemoryAdvisor Jun 5, 2025
Copy link
Contributor

@YunKuiLu YunKuiLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! It would be great if these minor issues could be fixed.

* retrieve
* @return this builder
*/
public Builder defaultSimilarityThreshold(Double defaultSimilarityThreshold) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we don't need to use the Double wrapper class here?


private Integer defaultTopK = DEFAULT_TOP_K;

private Double defaultSimilarityThreshold = DEFAULT_SIMILARITY_THRESHOLD;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.

@scionaltera
Copy link
Contributor Author

LGTM! It would be great if these minor issues could be fixed.

Sure thing. I've been sick the past couple of days but I can get these changes in soon.

YunKuiLu and others added 27 commits September 3, 2025 10:54
Auto-cherry-pick to 1.0.x
Fixes spring-projects#3672

Signed-off-by: NOUNI El bachir <[email protected]>
…l execution is enabled

- For streaming, block tool calling ChatResponse unless internal execution is disabled
- Add streaming validation test and debug logging

Auto-cherry-pick to 1.0.x
Fixes spring-projects#3679

Related to spring-projects#3650

Signed-off-by: Christian Tzolov <[email protected]>
Auto-cherry-pick to 1.0.x

Fixes spring-projects#3656

Signed-off-by: jonghoon park <[email protected]>
Elasticsearch is by far the most widely deployed vector database (https://db-engines.com/en/ranking/vector+dbms) and we were also part of the 1.0 launch.

Signed-off-by: Philipp Krenn <[email protected]>
…jects#3671)

- Move Qdrant vector store test dependency from OpenAI model module
  - Convert existing Qdrant vector store ITs to use OpenAI embedding model for better unification along with other vector stores

Auto-cherry-pick to 1.0.x

Fixes spring-projects#3671

Signed-off-by: Ilayaperumal Gopinathan <[email protected]>
…pring-projects#3687)

- Since the non-text documents aren't supported, we need a validation to throw exception if non text documents are encountered
 - Add tests
    - Add test to QdrantVectorStoreIT with the usecase provided by @devMtn30
    - Add simple vector store test for the validation
Fixes spring-projects#3609

Auto-cherry-pick to 1.0.x 

Signed-off-by: Ilayaperumal Gopinathan <[email protected]>
…lename was lost when requesting the OpenAI `/transcriptions` and `/translations` interfaces.

Auto-cherry-pick to 1.0.x
Fixes spring-projects#3557
Signed-off-by: Sun Yuhan <[email protected]>
- When calling tools while using ChatModel#stream, store the reactive
  context in a thread-local, so it can be used by downstream reactive
  tools.
- In AsyncMcpToolCallback, restore the reactive context so it can be
  accessed by the tool. This will be useful for Spring Security OAuth2
  support in reactive scenarios, because it relies on the context.

Signed-off-by: Daniel Garnier-Moiroux <[email protected]>
* Fix typos

Signed-off-by: Tran Ngoc Nhan <[email protected]>
…entation. (spring-projects#3717)

Auto-cherry-pick to 1.0.x
Fixes spring-projects#3713

Signed-off-by: Sun Yuhan <[email protected]>
Co-authored-by: Sun Yuhan <[email protected]>
…pring-projects#3663)

* Refactor: Add null check, optimize string joining, and add JavaDocs

Auto-cherry-pick to 1.0.x
Fixes spring-projects#3663

Signed-off-by: nirsa <[email protected]>
…lvus vectorstore (spring-projects#3705)

Fixes spring-projects#3705

Auto-cherry-pick to 1.0.x

Signed-off-by: jonghoon park <[email protected]>
Fixes spring-projects#3716

Auto-cherry-pick to 1.0.x

* Correct NonNull annotation package
* Correct Nullable annotation package
* Replace jetbrains NotNull
* Update copyright headers
* Add package-info

Signed-off-by: Tran Ngoc Nhan <[email protected]>
AnthropicChatModel does not provide a constructor with two parameters. 
If there are two parameters, use the Builder to construct an AnthropicChatModel. 
The current document misleads users and needs to be updated.

Fixes spring-projects#2723

Auto-cherry-pick to 1.0.x

Signed-off-by: Lpepsi <[email protected]>
Incorrect usage of ClassUtils.isAssignable.

Incorrectly reversing the parameters causes the method to always return true when an Object is passed.

Fixes: spring-projects#3729

Auto-cherry-pick to 1.0.x

Signed-off-by: TheEterna <[email protected]>
…uilder()` in `SystemPromptTemplate` returned a Builder for `PromptTemplate` instead.

Auto-cherry-pick to 1.0.x
Fixes spring-projects#3526

Signed-off-by: Sun Yuhan <[email protected]>
- When the error event occurs, the ChatCompletionResponseBuilder is empty and hence the contentBlockReference.get() throws NPE.
   - Add null check to unhandled event in addition to the logging the event type
   - Add test to verify the usecase

Fixes spring-projects#3740

Auto-cherry-pick to 1.0.x

Signed-off-by: Ilayaperumal Gopinathan <[email protected]>
Yornii and others added 29 commits September 3, 2025 10:55
Fixes spring-projectsGH-4213 (spring-projects#4213)

* re-enable Groq API tests in OpenAiCompatibleChatModelIT
* update comment to reflect current API status
* confirm API is operational via HTTP 401 response

Signed-off-by: Hyeri1ee <[email protected]>
- add community resource links and supplement contribution guidelines

Signed-off-by: YunKui Lu <[email protected]>
Signed-off-by: Soby Chacko <[email protected]>
Enabling checkstyle by default in the build

Signed-off-by: Soby Chacko <[email protected]>
…ption in getClassOrNull

Fixes spring-projects#4205
Fixes spring-projects#4249

Auto-cherry-pick to 1.0.x

The getClassOrNull method is designed to gracefully handle missing classes
by returning null, but was logging full stack traces for ClassNotFoundException
which could mislead users into thinking there's an actual problem.

Changes:
- Log only the class name when ClassNotFoundException occurs
- Add type safety check for RuntimeException subclasses
- Add separate handling for other exceptions with full stack trace
- Improve log message clarity to reduce user confusion

This maintains the expected behavior while providing cleaner, less alarming
log output for normal class-not-found scenarios.

Signed-off-by: Sun Yuhan <[email protected]>
Reordering may occur due to `Flux::flatMap` not providing ordering guarantees; 
`flatMapSequential` addresses this issue.

Fixes spring-projects#4155
Auto-cherry-pick to 1.0.x

Signed-off-by: robinmayerhofer <[email protected]>
…spring-projects#4104)

- Simplified code by dropping redundant null checks

Signed-off-by: csbiy <[email protected]>
…servers

- Introduce  module for declarative MCP configuration
- Create new mcp-annotations-spring module
- Add annotation scanners to auto-discover MCP annotated beans and methods
- Support MCP annotations: @mcptool, @McpResource, @McpPrompt, @McpComplete for servers
- Support MCP annotations: @McpLogging, @McpSampling, @McpElicitation, @McpProgress for clients
- Implement customizers to automatically register annotated specifications
  - Introduce McpAsyncAnnotationCustomizer and McpSyncAnnotationCustomizer for annotation-driven client configuration
- Add Spring-aware annotation providers for both sync and async MCP operations
- Include comprehensive integration tests for annotation-based MCP configuration
- Update all MCP starter dependencies to include the new annotations module
- Update BOM and parent POM to include mcp-annotations dependency version management
- Include comprehensive integration test StreamableMcpAnnotationsIT demonstrating annotation usage
- Move McpAsyncAnnotationCustomizer and McpSyncAnnotationCustomizer to annotations package
- Add support for tool, resource, and prompt list changed notifications
  - New AsyncToolListChangedSpecification, AsyncResourceListChangedSpecification, AsyncPromptListChangedSpecification
  - New SyncToolListChangedSpecification, SyncResourceListChangedSpecification, SyncPromptListChangedSpecification
  - Wire list changed specifications in MCP client auto-configuration
- Enhance annotation customizers with validation and logging
  - Prevent duplicate elicitation and sampling specs per client with proper error handling
  - Add comprehensive logging for all registered MCP client specifications
  - Track registered specifications per client using ConcurrentHashMap
- Add unit test suite
  - Complete test coverage for McpSyncAnnotationCustomizer
  - Test duplicate validation, case-insensitive matching, and error scenarios
- Update documentation with breaking changes
  - MCP client annotations now require mandatory clientId parameter
  - Update all examples to include clientId in annotation usage
  - Add configuration examples showing clientId mapping to connection names

refactor: support multiple clients in MCP annotations and apply code style improvements

- Change MCP annotation client specification from single clientId to clients array
  - Update @McpLogging, @McpSampling, @McpElicitation, @McpProgress annotations
  - Modify McpAsyncAnnotationCustomizer and McpSyncAnnotationCustomizer to iterate over client arrays
  - Update corresponding test cases to use new clients array format

- Apply consistent code formatting and style improvements
  - Reorganize imports and add missing blank lines between import groups
  - Add 'this.' prefix for field access consistency
  - Move inner classes to bottom of files following Java conventions
  - Update method parameter access patterns

- Clean up documentation
  - Remove redundant @param entries in Javadoc
  - Add missing newlines at end of files

- Update .gitignore to exclude /contributing directory

This change enables MCP annotations to target multiple clients simultaneously
while maintaining backward compatibility through array support.

Signed-off-by: Christian Tzolov <[email protected]>
Signed-off-by: Christian Tzolov <[email protected]>
…tions

Add spring-ai-mcp-annotations as optional dependency to:
- spring-ai-autoconfigure-mcp-client-httpclient
- spring-ai-autoconfigure-mcp-client-webflux
- spring-ai-autoconfigure-mcp-server-webmvc

This enables annotation-based MCP configuration support across these modules.

Signed-off-by: Christian Tzolov <[email protected]>
- Rename ClientAnnotationScannerAutoConfiguration to McpClientAnnotationScannerAutoConfiguration
- Rename ClientAnnotationScannerProperties to McpClientAnnotationScannerProperties
- Rename ClientSpecificationFactoryAutoConfiguration to McpClientSpecificationFactoryAutoConfiguration
- Rename ServerAnnotationScannerAutoConfiguration to McpServerAnnotationScannerAutoConfiguration
- Rename ServerAnnotationScannerProperties to McpServerAnnotationScannerProperties
- Rename ServerSpecificationFactoryAutoConfiguration to McpServerSpecificationFactoryAutoConfiguration
- Update all import statements and configuration references accordingly

This improves naming consistency and clarity across MCP client and server auto-configuration modules.

Signed-off-by: Christian Tzolov <[email protected]>
Signed-off-by: Gareth Evans <[email protected]>

Fix checkstyle

Signed-off-by: Soby Chacko <[email protected]>
correct typo from 'tools' to 'toolNames' in tools.adoc

Fixes: spring-projects#4278
Auto-cherry-pick to 1.0.x

Signed-off-by: Yornii <[email protected]>
…jects#4268)

* test: Enhance test coverage for tool execution components
* style: fix formatting

Signed-off-by: Oleksandr Klymenko <[email protected]>
 - Fix the error response message

Signed-off-by: Ilayaperumal Gopinathan <[email protected]>
  - Fix the test to identify the right usage metadata from the stream content

Signed-off-by: Ilayaperumal Gopinathan <[email protected]>
 - Fix the function toolcallback definition name

Signed-off-by: Ilayaperumal Gopinathan <[email protected]>
* Rewrote the method to use `org.springframework.jdbc.support.JdbcUtils#extractDatabaseMetaData`
  for extracting database metadata from the `dataSource`, and obtain the database vendor name
  from the JDBC driver, improving accuracy and robustness.
* Enhanced exception handling: instead of silently ignoring exceptions, it now explicitly reports
  encountered issues, helping users identify problems and select the appropriate dialect more easily;

Fixes spring-projects#4289

Signed-off-by: Sun Yuhan <[email protected]>
…ts#4288)

The inner method JdbcChatMemoryRepositoryDialect#from already contains
exception handling logic. The outer try-catch block is unnecessary and
can be safely removed to avoid redundant exception handling and improve
code clarity.

Fixes: spring-projects#4288
Auto-cherry-pick to 1.0.x

Signed-off-by: eeaters <[email protected]>
- Add a new autoconfig property spring.ai.retry.on-http-codes that list status codes (scuh as 429)
   for which the retry should be attemptd.
 - Updated the docs.

 Resolves spring-projects#433
@scionaltera scionaltera closed this Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.