Commit Graph

2238 Commits

Author SHA1 Message Date
Christian Tzolov
4bde57790d fix checkstyle
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-16 10:08:23 -04:00
Christian Tzolov
327cf40e97 feat(mcp): Add granular control over MCP server capabilities
- Add capability configuration to enable/disable tools, resources, prompts, and completions individually
- Refactor server configuration to conditionally register capabilities based on configuration
- Add support for server instructions configuration
- Update documentation with new capability options and completion management
- Add tests for new capabilities and configurations

Resolves #3207

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-16 10:08:23 -04:00
Mark Pollack
9392485bd5 Fix VectorStoreChatMemoryAdvisor streaming bug
- Override adviseStream method in VectorStoreChatMemoryAdvisor to properly handle streaming responses
- Add tests to verify the fix works with both normal and problematic streaming scenarios

Fixes #3152

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-16 09:26:27 -04:00
Ilayaperumal Gopinathan
20ccd1f0ac Disable checkstlye check by default
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-16 14:10:59 +01:00
Mark Pollack
2f5d53fde0 Fix VectorStoreChatMemoryAdvisor streaming bug
- Override adviseStream method in VectorStoreChatMemoryAdvisor to properly handle streaming responses
- Add tests to verify the fix works with both normal and problematic streaming scenarios

Fixes #3152

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-16 14:08:20 +01:00
Soby Chacko
fa8f24633b GH-3160: Handle element types correctly in CassandraFilterExpressionConverter.doValue
Fixes: 3160

https://github.com/spring-projects/spring-ai/issues/3160

When using a filter expression with IN operator on a collection field in
CassandraVectorStore.similaritySearch, a ClassCastException was thrown because
the code attempted to format individual collection elements using the collection's
codec instead of the element type's codec.

This fix modifies doValue to detect when we are formatting elements inside a
collection type and use the appropriate element type codec. While Cassandra
does not support using the IN operator directly on collection columns, this fix
ensures we generate syntactically correct CQL rather than throwing a Java
exception.

The change specifically addresses ListType collections by using the element type
codec for individual elements within the list.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-16 13:40:44 +01:00
Ilayaperumal Gopinathan
30add8089a Fix CassandraRichSchemaVectorStoreIT#ensureSchemaNoCreation
- Check index not existing exception

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-16 13:35:57 +01:00
Soby Chacko
9eeee6178c GH-3181: fix: Validate index name exists in CassandraVectorStore
Fixes: #3181

https://github.com/spring-projects/spring-ai/issues/3181

When using CassandraVectorStore with an invalid index name and
initializeSchema=false, the application would throw a generic
NoSuchElementException from Optional.get() with message "No value present"
when trying to access the index metadata.

Changes:
- Added explicit validation of index existence in checkSchemaValid() method
- Improved error handling in getIndexSimilarity() method to provide a clear
  error message when an index doesn't exist
- Added integration test to verify proper error handling with invalid index names

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-16 12:45:30 +01:00
Yanming Zhou
eba7bde870 Polish dependencies (#3198)
Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-05-16 12:23:26 +01:00
Mark Pollack
c0b9240c8d Fix VectorStoreDocumentRetriever to handle Filter.Expression objects directly
- Updated computeRequestFilterExpression to check if the context value is already
  a Filter.Expression object before attempting to parse it as a string
- Added docs for FILTER_EXPRESSION key that it accepts both String and Filter.Expression
- Added test

Fixes #3179
2025-05-16 11:34:47 +01:00
Soby Chacko
368be3a04f Fixing miscellaneous checkstyle errors
Enabling checkstyle by default in the project build

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-16 11:08:33 +01:00
Ilayaperumal Gopinathan
31feb4319b Remove duplicate dependency from spring-ai-model-chat-memory-repository-jdbc POM
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-16 11:00:09 +01:00
Christian Tzolov
b219c21723 docs: reorganize documentation structure
- Restructure navigation with clearer hierarchy using "Reference" and "Guides" sections
- Remove deprecated model-specific function calling documentation
- Update all model references to point to centralized Tool Calling documentation
- Rename "Docker Compose" to "Development-time Services" for clarity
- Move "Testing" under Reference section
- Add link to "Awesome Spring AI" community resources

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-15 18:06:37 -04:00
Jonatan Ivanov
6df84845a2 Do not trigger GHA workflows on forks
GHA workflows are automatically executed on forks where they fail.
This change prevents this (only for those workflows that are
automatically triggered, e.g.: on push or schedule).
2025-05-15 17:45:59 -04:00
Mark Pollack
008a760fa7 Add dataSource() method to JdbcChatMemoryRepository.Builder and improve dialect detection
- Added a dataSource(DataSource) method to the builder
- Now, if no dialect is specified, the implementation will attempt to detect it from the effective DataSource (either set directly or obtained from the JdbcTemplate).
- Updated builder logic to default to the DataSource from the JdbcTemplate if dataSource() is not called, ensuring dialect detection works out-of-the-box.
- The builder now prefers a directly provided DataSource, but remains backwards compatible with JdbcTemplate-based configuration.
- Added tests

Fixes #3148

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-15 16:44:56 -04:00
Sun Yuhan
31da8f3dbb fix: Fixed the incorrect SQL in getSelectMessagesSql of MysqlChatMemoryRepositoryDialect
- Added tests

Signed-off-by: Sun Yuhan <1085481446@qq.com>
2025-05-15 16:14:53 -04:00
Sun Yuhan
0e1bb52ab7 fix: Added transaction support for saveAll in JdbcChatMemoryRepository
- Add optional PlatformTransactionManager
- Add tests

Signed-off-by: Sun Yuhan <1085481446@qq.com>
2025-05-15 14:23:00 -04:00
Ilayaperumal Gopinathan
1a395e6847 Add Chat memory (in-memory chat memory repository) starter (#3185)
- Add Spring Boot starter for Chat memory with in-memory chat memory repository

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-15 11:27:31 -04:00
Ilayaperumal Gopinathan
48fb663c31 Fix qdrant vector store value factory (#3173)
- Fix the QdrantValueFactory to handle "java.util.List" type
 - Update the integration test to use List type values

Resolves #3164

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-15 11:26:23 -04:00
Jast
add7ca8489 fix doc (#3171)
Signed-off-by: Jast <745925668@qq.com>
2025-05-15 13:37:10 +01:00
Jonatan Ivanov
3fb66928f5 Add missing observability tests
Some tests were missing from gh-3003, this change adds them

See gh-3003
2025-05-15 10:09:31 +02:00
Yanming Zhou
0bcb2e138b Fix outdated configuration key include-completion and include-query-response
Fixes GH-3151

Follow-up of commit ca843e85887aa1da6300c77550c379c103500897,`includeCompletion` is renamed to `logCompletion`.

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-05-15 09:30:45 +02:00
ChoHadam
d5d907b266 Fix: Initialize TokenTextSplitter Builder fields with default values
Signed-off-by: ChoHadam <hadamcho97@gmail.com>
2025-05-14 17:38:16 +01:00
Jhzlo
e14e788a47 fix: add @JsonProperty for response_format
Ensures the response_format field is correctly serialized for Stability AI API.

Signed-off-by: Jhzlo <kjh0010703@naver.com>
2025-05-14 12:31:23 -04:00
Ricken BAZOLO
1beff75453 add mistral ai moderation doc (#3161) 2025-05-14 16:50:34 +01:00
LingXiao Qi
55ac78046d fix: OpenAiApi comment (#3165)
Signed-off-by: lingxiao <lotus0721@outlook.com>
2025-05-14 14:21:16 +01:00
Ricken BAZOLO
4d79ff5c56 openai-moderation.doc fix typo (#3162)
Signed-off-by: Ricken Bazolo <ricken.bazolo@gmail.com>
2025-05-14 14:17:05 +01:00
Mark Pollack
1ede66492f update upgrade-notes (#3142) 2025-05-13 19:32:50 +01:00
Ilayaperumal Gopinathan
f2940cffce Next development version 2025-05-13 19:06:16 +01:00
Ilayaperumal Gopinathan
30a9638de8 Release version 1.0.0-RC1 2025-05-13 19:05:52 +01:00
Linar Abzaltdinov
77be609c4a updated docs for new OpenSearch vector-store properties (#3140)
Signed-off-by: Linar Abzaltdinov <abzaltdinov@gmail.com>
2025-05-13 17:37:53 +01:00
Mark Pollack
cfeba7cf5d update upgrade-notes.adoc 2025-05-13 12:13:21 -04:00
Thomas Vitale
9ff6d3b364 Update memory docs and ensure consistent naming
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-13 11:33:44 -04:00
Mark Pollack
f5f02129b5 Fix MessageChatMemoryAdvisor in streaming case.
- The fix overrides the adviseStream method to use ChatClientMessageAggregator to properly aggregate streaming chunks before storing them in memory, similar to how PromptChatMemoryAdvisor handles streaming responses
- Added test

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-13 11:31:34 -04:00
Claudio Silva Junior
348adee17f added custom path in doc (#3123)
* added custom path in doc

Signed-off-by: “claudio-code” <suporte2424@outlook.com>

* added custom path in doc

Signed-off-by: “claudio-code” <suporte2424@outlook.com>

---------

Signed-off-by: “claudio-code” <suporte2424@outlook.com>
2025-05-13 14:56:54 +01:00
Thomas Vitale
8939148fbc Fixes for memory advisors after recent refactoring
* The defaultConversationId was configurable, but not used. It’s now being used correctly when a custom defaultConversationId is defined.
* The memory advisors were missing the required configuration of a Schedule due to a default value missing. Now as default Scheduler is used, automatically protecting from blocking. It can be customised via “scheduler()”, replacing the old “protectFromBlocking()” method.
* The new defaultTopK options in VectorStoreChatMemoryAdvisor were documented, but not implemented. That is fixed now.
* The memory advisors were not null-safe. Now they are.
* Improved tests to check the null-safe behaviour.
* Updated the documentation accordingly.

Fixes gh-3133

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-13 09:53:24 -04:00
Soby Chacko
f346092648 HttpHost regression issues in OpenSearchVectorStoreAutoConfiguration
Changes introduced for https://github.com/spring-projects/spring-ai/issues/2954
introduced a regression in the way OpenSearch works with test containers.

Restore the retrieval of HttpHost from OpenSearchConnectionDetails insted of getting
them directly from properties.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-13 09:45:27 -04:00
Christian Tzolov
54e5c07428 refactor: Move MessageAggregator to spring-ai-model module
Improve separation of concerns by keeping model-related functionality in the model module
while maintaining client-specific functionality in the client module.

- Move MessageAggregator class from spring-ai-client-chat to spring-ai-model module
- Create new ChatClientMessageAggregator in spring-ai-client-chat module to handle client-specific aggregation
- Extract client-specific aggregation logic from MessageAggregator to ChatClientMessageAggregator
- Update references in advisor classes to use the new ChatClientMessageAggregator

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-13 11:31:08 +01:00
Mark Pollack
a03e7cba2f This commit enhances the documentation for working with multiple chat models in Spring AI by:
- Add introduction explaining common scenarios where multiple chat models are useful.
- Restructuring the content into clear subsections:
   - Multiple ChatClients with a Single Model Type
   - ChatClients for Different Model Types
   - Multiple OpenAI-Compatible API Endpoints

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-13 12:31:03 +02:00
mck
87b680af7c Optimise CassandraChatMemoryRepository for MessageWindowChatMemory usage pattern
Time-series each chat window in Cassandra, keeping past (and deleted) windows still in the db.
Add ability to store different MessageTypes.

Signed-off-by: mck <mck@apache.org>
2025-05-13 10:13:44 +01:00
Ilayaperumal Gopinathan
c646dfe9a8 Fix BedrockTitanEmbeddingModelIT
- Create ObservationRegistry bean for the tests

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-13 07:33:59 +01:00
Mark Pollack
59b36d14da Remove deepseek options form openaiapi
- These options are exclusive to deepseek and can be added to the deepseek model
2025-05-12 23:22:12 -04:00
Soby Chacko
868e288e01 GH-1949: Align CassandraVectorStore API naming with other vector stores
Fixes: #1949

- Rename 'disallowSchemaChanges(boolean)' to 'initializeSchema(boolean)' for consistency
  with other vector store implementations
- Maintain semantic meaning by inverting the default value (from disallowSchemaChanges=false
  to initializeSchema=true) in the CassandraVectorStore implementation
- Keep default behavior in auto-configuration consistent with other vector stores
- Remove unused 'returnEmbeddings' functionality and related code
- Update test cases to use the new initialization parameter
- Ref docs and javadocs updates

This change improves API consistency across Spring AI vector stores while
preserving the same behavior in the Cassandra implementation.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-12 22:54:05 -04:00
Mark Pollack
848a3fd31f refactor: Simplify chat memory advisor hierarchy and remove deprecated API
- Remove deprecated ChatMemory.get(String conversationId, int lastN) method

- Replace AbstractChatMemoryAdvisor with BaseChatMemoryAdvisor interface in api package
- Make constructors private in all memory advisor implementations to enforce builder usage
- Rename CHAT_MEMORY_CONVERSATION_ID_KEY to CONVERSATION_ID and move to ChatMemory interface
- In VectorStoreChatMemoryAdvisor:
  - Rename DEFAULT_CHAT_MEMORY_RESPONSE_SIZE (100) to DEFAULT_TOP_K (20)
  - Rename builder method chatMemoryRetrieveSize() to topK()
  - Remove systemTextAdvise() builder method
- In PromptChatMemoryAdvisor:
  - Remove systemTextAdvise() builder method
  - Fix bug where only the last user message was stored from prompts with multiple messages
- Enhance logging in memory advisors to aid in debugging
- Add comprehensive tests for all advisor implementations:
  - Unit tests for builder behavior
  - Integration tests for the various chat memory advisors

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-12 19:41:18 -04:00
jonghoonpark
7b15e1828c Add EnabledIfEnvironmentVariable annotation to MariaDBStoreCustomNamesIT (#3119)
Signed-off-by: jonghoon park <dev@jonghoonpark.com>
2025-05-12 19:25:55 -04:00
jonghoon park
0c95cc396f GH-3118: Fix NPE in OpenAIChatModel compatible streaming api with vertex ai gemini
Fixes: #3118

Signed-off-by: jonghoon park <dev@jonghoonpark.com>
2025-05-12 19:20:09 -04:00
Ilayaperumal Gopinathan
2d517eec5c Refactor chat memory repository artifacts for clarity
- Rename the artifact ID of the chat memory repository artifacts:

    - `spring-ai-model-chat-memory-jdbc` -> `spring-ai-model-chat-memory-repository-jdbc`
    - `spring-ai-model-chat-memory-cassandra` -> `spring-ai-model-chat-memory-repository-cassandra`
    - `spring-ai-model-chat-memory-neo4j` -> `spring-ai-model-chat-memory-repository-neo4j`

 - Rename the package names to include "repository". Example: org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepository
    - This package renaming also requires to change the default schema location for the jdbc repository to include "repository"
      - Update the docs

 - Update the artifact IDs in the parent POM, BOM, autoconfiguration and starters
 - Update upgrade notes and docs to describe the changes

Fix JdbcChatMemoryRepositoryPostgresqlIT
 - Make sure to set the dialect via datasource

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-12 13:02:26 -04:00
Yanming Zhou
e10fbde7a1 Align JdbcChatMemoryRepositoryProperties with other modules in Spring Boot
Such as `BatchProperties.Jdbc`, `IntegrationProperties.Jdbc`, `JdbcSessionProperties` and `QuartzProperties.Jdbc`

1. Reuse Spring Boot's `DatabaseInitializationMode`
2. Allow to customize platform
3. add `OnJdbcChatMemoryRepositoryDatasourceInitializationCondition` for `JdbcChatMemoryRepositorySchemaInitializer`

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-05-12 16:18:11 +01:00
Christian Tzolov
a6bb325b62 Update MCP to 0.10.0
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-12 15:54:51 +02:00
Thomas Vitale
79ec2ea088 Update docs about MCP tools enabled by default
Fixes gh-3086

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-12 09:17:38 -04:00