841 Commits

Author SHA1 Message Date
Ilayaperumal Gopinathan
fcd2803f36 Release version 1.0.0 2025-05-19 10:40:35 +01:00
Mark Pollack
a5fdfdbfe9 add effective agents section (#3247) 2025-05-19 10:24:49 +01:00
shusheng007
f5243b8fe2 Update openai-embeddings.adoc
change incorrect configuration: `spring.ai.openai.chat.embeddings-path` to the correct: `spring.ai.openai.embedding.embeddings-path`

Signed-off-by: shusheng007 <wangben850113@163.com>
2025-05-19 05:20:12 -04:00
Thomas Vitale
144ae1ec92 Support custom template in RelevancyEvaluator
The RelevancyEvaluator is key for validating RAG flows. This pull request improves it by making the PromptTemplate configurable, improving the format of the default one, introducing a Builder, and extending the documentation with more details on how to use it.

I added some unit tests. The RelevancyEvaluator is used in lots of integration tests in the project to test the QuestionAnswerAdvisor and RetrievalAugmentationAdvisor, that also help assessing the evaluator itself.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-18 18:20:24 -04:00
Mark Pollack
d436ee85c4 docs: Improve ChatClient implementation notes
* Add context about reactive/imperative applications
* Fix typos and improve formatting
* Highlight Spring Boot 3.4 bug as IMPORTANT note
* Clarify tool calling impact on Micrometer observations
2025-05-18 18:16:26 -04:00
Christian Tzolov
14972f981f docs: minor adivsor docs update
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-18 19:10:32 +02:00
Christian Tzolov
36c597798d docs: reorganize tool calling documentation and add observability details
- Update Observability section with details about tool calling observability support
- Move "Migrating to ToolCallback API" guide from Tool Calling section to Upgrade Notes
- Update Observability section with details about tool calling observability support

Related to #3230

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-18 08:37:57 -04:00
Soby Chacko
b2d5ff0693 GH-3187: Replace Spring environment variables with custom alternatives
Fixes: #3187

This commit addresses the issue with Spring environment variables that directly
mirror Spring AI application properties, which can confuse users into thinking
they should always set environment variables that match Spring property names.

Instead, we've replaced all instances of SPRING_* prefixed environment variables
in the documentation with custom-named alternatives that are referenced using
Spring Expression Language (SpEL) or retrieved programmatically.

Each documentation section now shows multiple configuration approaches:

- Direct property setting in application.properties/yml
- Using custom environment variables with SpEL
- Accessing environment variables programmatically

This gives users more flexibility while making it clear that using SPRING_*
prefixed environment variables is not required or recommended.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-17 12:56:02 +01:00
Christian Tzolov
c2a694900c docs: Document the MCP ToolContext support
Resolves #3209

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-17 13:53:24 +02:00
Christian Tzolov
9ed7535ba0 feat(mcp): Add request timeout configuration for MCP server
Add support for configuring request timeout in MCP server with a default of 20 seconds.
This timeout applies to all requests made through the client, including tool calls,
resource access, and prompt operations.

- Add requestTimeout property to McpServerProperties with default of 20s
- Configure server builder with the timeout value
- Add tests for default and custom timeout configurations
- Update documentation with the new property

Resolves #3205

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-17 12:41:48 +02:00
Soby Chacko
8b8fb4f02d GH-886: feat(opensearch): Add path prefix configuration support
Fixes: #886

Add ability to configure path prefix for OpenSearch API endpoints via properties.
This allows connecting to OpenSearch instances running behind a reverse proxy
with a non-root path, similar to Spring Elasticsearch's path-prefix property.

- Add pathPrefix property to OpenSearchVectorStoreProperties
- Apply pathPrefix to OpenSearchClient when configured
- Add documentation and unit tests

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-17 09:59:49 +01: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
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
Jast
add7ca8489 fix doc (#3171)
Signed-off-by: Jast <745925668@qq.com>
2025-05-15 13:37:10 +01:00
Ricken BAZOLO
1beff75453 add mistral ai moderation doc (#3161) 2025-05-14 16:50:34 +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
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
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
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
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
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
Tran Ngoc Nhan
7aa440e6bc Fix typos
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-05-12 13:31:40 +01:00
Yanming Zhou
2201622581 Fix wrong artifactId in DeepSeek document (#3105)
Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-05-12 10:51:27 +01:00
Thomas Vitale
30eb3ce3f2 Micrometer instrumentation for tool calling
Introduce instrumentation for tool calling using the Micrometer Observation API.

By default, metadata about tool calling are exported as metrics and traces.
Optionally, the actual tool call input and result can be exported as well by enabling the dedicated feature flag.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-11 07:26:44 +02:00
Soby Chacko
8f879aae03 GH-1831: Add auto-truncation support strategies when batching documents
Fixes: #1831

- Document auto-truncation configuration with high token limits
- Add integration tests for auto-truncation behavior
- Include Spring Boot and manual configuration examples
- Test large documents and batching scenarios

Enables proper use of embedding model auto-truncation while avoiding batching strategy exceptions.

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-10 17:57:49 -04:00
Mark Pollack
11e3c8f9a6 refactor(cassandra): Remove CassandraChatMemory implementation
- Removed the CassandraChatMemory class and its usages, now using CassandraChatMemoryRepository.
- Updated configuration, repository, and test classes to rely on CassandraChatMemoryRepository.
- Cleaned up related configuration and integration tests.
- Minor doc update to reflect the removal.

Fixes #3090

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-10 17:34:13 -04:00
Ilayaperumal Gopinathan
f6dba1bf08 Refactor chat memory repository autoconfigurations and Spring Boot starters for clarity
- Rename chat memory repository autoconfiguration modules to include the "repository" suffix:
    - spring-ai-autoconfigure-model-chat-memory-cassandra -> spring-ai-autoconfigure-model-chat-memory-repository-cassandra
    - spring-ai-autoconfigure-model-chat-memory-jdbc -> spring-ai-autoconfigure-model-chat-memory-repository-jdbc
    - spring-ai-autoconfigure-model-chat-memory-neo4j -> spring-ai-autoconfigure-model-chat-memory-repository-neo4j
- Update Spring Boot starter modules to match the new naming convention.
- Rename packages to include `.repository.` for improved clarity and consistency.
- Rename configuration and related classes to use the `ChatMemoryRepository` suffix.
- Update Spring AI BOM and parent POM files to reference the new artifact names.
- Update all imports, references, and configuration to use the new package and class names.

BREAKING CHANGE:
These changes require users to update their dependencies, imports, and configuration to use the new artifact, package, and class names. See the upgrade notes for migration instructions.

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-10 14:56:08 -04:00
Jonatan Ivanov
ca843e8588 feat(observability): refactor content observation to use logging instead of tracing
This removes the possible large amount of data that was attached
to spans and it logs the data out. This change also removes the direct
dependency on the OTel SDK. approach for content in Spring AI.

Refactors the observability approach for content in Spring AI:

- Replace content observation filters with logging handlers
- Rename configuration properties to better reflect their purpose:
  - `include-prompt` → `log-prompt`
  - `include-completion` → `log-completion`
  - `include-query-response` → `log-query-response`
- Add TracingAwareLoggingObservationHandler for trace-aware logging
- Replace micrometer-tracing-bridge-otel with micrometer-tracing
- Remove event-based tracing in favor of direct logging
- Update documentation to reflect these changes (add breaking-changes section)
- Rename includePrompt to logPrompt in observation properties. Updated in ChatClientBuilderProperties, ChatObservationProperties, and ImageObservationProperties.

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-10 19:36:11 +02:00
YunKui Lu
fa5fb53d4c docs: Fix some document's anchor
Signed-off-by: YunKui Lu <luyunkui95@gmail.com>
2025-05-10 09:20:40 -04:00
Christian Tzolov
c0062dd3b5 Enable MCP tool callback by default
- Change the default value of `toolcallback.enabled` property to `true` in both configuration and documentation.
- Update `McpClientCommonProperties.Toolcallback` to default `enabled` to `true` and refactor from record to class.
- Adjust `@ConditionalOnProperty` in `McpToolCallbackAutoConfiguration` to `matchIfMissing = true` for tool callback.
- Update tests to reflect new default behavior: tool callback is now enabled by default when the property is missing.
- Update documentation to indicate the new default value for `toolcallback.enabled` is `true`.

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-10 01:15:37 -04:00
mck
2450ae592e Implement CassandraChatMemoryRepository
ref: https://github.com/spring-projects/spring-ai/issues/2998
Signed-off-by: mck <mck@apache.org>
2025-05-09 16:44:29 -04:00
Mark Pollack
08958af670 Add flexible support for multiple database variations in JdbcChatMemory
Add SQL Server dialect support with new SqlServerChatMemoryDialect class

Create schema-sqlserver.sql script for SQL Server table creation

Refactor database schema initialization with new JdbcChatMemorySchemaInitializer

Standardize table names across databases to SPRING_AI_CHAT_MEMORY

Implement ChatMemoryDialect abstraction for database-specific operations

Add dialect implementations for PostgreSQL, MySQL/MariaDB, HSQLDB

Update configuration properties with more flexible schema initialization options

Enhance documentation with detailed information about dialect support and configuration

Add integration tests for HSQLDB and SQL Server

Signed-off-by: Mark Pollack <247466+markpollack@users.noreply.github.com>
2025-05-09 20:30:53 +01:00
Vinay Balamuru
499e8baae5 Update neo4j.adoc (#3056)
Update the documentation of spring property from `spring.ai.vectorstore.neo4j.dimensions` to `spring.ai.vectorstore.neo4j.embedding-dimension`  to reflect what the code reads. 
Without this change, changes to the property `dimensions` are not propagated to runtime code, resulting in discrepancies if an embedding model that has  a different number of dimensions is used

Signed-off-by: Vinay Balamuru <balamuru@gmail.com>
2025-05-09 10:10:41 +01:00
Soby Chacko
f3b4624494 GH-3029: Remove HanaDB vector store autoconfiguration
Fixes: #3029

- Remove HanaDB vector store autoconfiguration
- Remove the corresponding starter
- Update docs
- Update maven configuration
- Remove autoconfiguration and starter entries from Spring AI BOM

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
2025-05-08 16:55:48 +01:00
Ilayaperumal Gopinathan
548abed3c1 Update Chroma doc to use 1.0.0 version
Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-08 10:36:37 +01:00
Jakub
b5c3216b76 Update mcp-server-boot-starter-docs.adoc
Signed-off-by: Jakub <jakub@jpomykala.com>
2025-05-07 23:43:15 -04:00
GR
c54dfd35d5 feat: add deepseek starter and docs - fix pom module ordering
- Add remaining deepseek modules
- Fix build order to put autoconfig modules after model modules to fix javadoc build

Signed-off-by: GR <gr@fastball.dev>
2025-05-07 23:38:07 -04:00
Thomas Vitale
d619e25cb5 Self-contained prompt templates in advisors
The built-in advisors that perform prompt augmentation have been updated to use self-contained templates. The goal is for each advisor to be able to perform templating operations without affecting nor being affected by templating and prompt decisions in other advisors.

* QuestionAnswerAdvisor
* PromptChatMemoryAdvisor
* VectorStoreChatMemoryAdvisor

Documentation and upgrade notes have been updated accordingly

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-07 22:55:15 -04:00
Thomas Vitale
2ea518686f Support DocumentPostProcessors in RAG Advisor
The DocumentPostProcessor is one of the modular RAG components introduce in M8. You can now use this API from within the RetrievalAugmentationAdvisor to post-process the retrieved documents before passing them to the model. For example, you can use such an interface to perform re-ranking of the retrieved documents based on their relevance to the query, remove irrelevant or redundant documents, or compress the content of each document to reduce noise and redundancy.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-07 21:34:37 -04:00
Mark Pollack
f329d71b7b Improve OpenSearch AWS/non-AWS auto-configuration and document fallback logic
- Add OpenSearchNonAwsCondition to robustly activate non-AWS OpenSearch auto-configuration if either:
    - AWS SDK classes are missing, OR
    - spring.ai.vectorstore.opensearch.aws.enabled=false
- Update OpenSearchVectorStoreAutoConfiguration to use the new condition for non-AWS configuration.
- Ensure AWS-specific auto-configuration is only active when AWS SDKs are present and the property is true (default).
- Add Javadoc to OpenSearchNonAwsCondition and clarify Javadoc on AWS config.
- Update integration test (OpenSearchVectorStoreNonAwsFallbackIT) to verify fallback logic works with AWS SDKs present.
- Add and refine documentation in opensearch.adoc:
    - Explain the purpose and usage of the spring.ai.vectorstore.opensearch.aws.enabled property.
    - Document the fallback logic and how to explicitly select AWS or non-AWS OpenSearch support.

Fixes #1901

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-06 18:18:47 -04:00
enricorampazzo
43aa8939d2 Enhance Neo4jChatMemoryRepository, expand integration tests, improve configuration, and update documentation
- Enhanced Neo4jChatMemoryRepository to correctly restore custom metadata for SystemMessage using SystemMessage.Builder.
- Refactored and clarified Neo4jChatMemoryRepository implementation code.
- Added comprehensive integration tests for Neo4jChatMemoryConfig and Neo4jChatMemoryRepository, including:
-- Index creation verification
-- Custom label support
-- Getter validation for all configuration properties
-- Tests for saving and retrieving SystemMessage metadata
-- Tests ensuring saveAll(conversationId, Collections.emptyList()) clears all messages and removes the conversation node
-- Tests for handling of messages with empty content and empty metadata
-- Improved overall test coverage for Neo4j persistence and configuration edge cases
- Fixed resource management bugs in test classes (ensured proper driver/session closure).
- Improved index creation logic in Neo4jChatMemoryConfig for reliability and logging.
- Updated documentation to include Neo4jChatMemoryRepository usage and configuration

Signed-off-by: enricorampazzo <enrico.rampazzo@live.com>
Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-05-06 15:31:11 -04:00