Commit Graph

772 Commits

Author SHA1 Message Date
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
Ilayaperumal Gopinathan
b6ce7f3e4a Remove deprecations/cleanup
- Remove deprecated AbstractChatMemoryAdvisor#DEFAULT_CHAT_MEMORY_CONVERSATION_ID
 - Remove deprecated InMemoryChatMemory and replace it with MessageWindowChatMemory
   - Update references

 - Remove deprecated TemplateFormat

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-05-06 11:30:38 +01:00
Thomas Vitale
4fe74d886e Remove deprecations in ChatClient and Advisors
* Update remaining Advisors and related classes to use the new APIs.
* In AbstractChatMemoryAdvisor, the “doNextWithProtectFromBlockingBefore()” protected method has been changed from accepting AdvisedRequest to ChatClientRequest. It’s a breaking change since the alternative was not part of M8.
* MessageAggregator has a new method to aggregate messages from ChatClientRequest. The previous method aggregating messages from AdvisedRequest has been removed. Warning since it wasn’t marked as deprecated in M8.
* In SimpleLoggerAdvisor, the “requestToString” input argument needs to be updated to use ChatClientRequest. It’s a breaking change since the alternative was not part of M8. Same thing about the constructor.
* The “getTemplateRenderer” method has been removed from BaseAdvisorChain. Each Advisor is encouraged to accept a PromptTemplate to achieve self-contained prompt augmentation operations.
* Remove deprecations in ChatClient and Advisors, and update tests accordingly.
* When building a Prompt from the ChatClient input, the SystemMessage passed via systemText() is placed first in the message list. Before, it was put last, resulting in errors with several model providers.

Relates to gh-2655

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-06 09:58:06 +01:00
Christian Tzolov
88490b3dfc Fix broken docs snippet formatting
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-06 10:25:18 +02:00
nlinhvu
39759b02ba Update vertexai-gemini-chat.adoc, VertexAi ChatModels docs and fix typo for spring-ai-vertex-ai-gemini
Signed-off-by: nlinhvu <nlinhvu.dev@gmail.com>
2025-05-06 01:17:32 -04:00
jonghoonpark
9ca3a7d15f Refactor OpenAiImageOptions and enhance test coverage
This commit makes several improvements to the OpenAiImageOptions class:

1. Remove all deprecated methods from OpenAiImageOptions.Builder:
   - Removed withN(), withModel(), withQuality(), withResponseFormat(),
     withWidth(), withHeight(), withStyle(), and withUser() methods
   - These were marked as @Deprecated(forRemoval = true, since = "1.0.0-M8")

2. Align OpenAiImageOptions structure with OpenAiChatOptions:
   - Added fromOptions() static method for creating copies
   - Added copy() instance method
   - Updated Builder class to match pattern in OpenAiChatOptions
   - Changed Builder field from private final to protected
   - Added Builder constructor that takes an existing options object

3. Enhance setSize() method to maintain consistency:
   - Updated setSize() to parse the size string and update width/height properties
   - Added proper error handling for invalid formats
   - Ensures consistent state between size, width, and height properties

4. Comprehensive test coverage improvements:
   - Added tests for builder pattern with all fields
   - Added tests for copy functionality
   - Added tests for all setter methods
   - Added tests for default values
   - Added tests for equals(), hashCode(), and toString() methods
   - Added specific tests for the updated setSize() behavior
   - Fixed test expectations to match actual implementation behavior

These changes improve code consistency, maintainability, and test coverage
while removing deprecated methods that were scheduled for removal.

Signed-off-by: jonghoonpark <dev@jonghoonpark.com>
2025-05-06 01:03:06 -04:00
Jemin Huh
b91777d15d Fix incorrect ChatMemory initialization example in chat-memory.adoc
Signed-off-by: Jemin Huh <hjm1980@gmail.com>
2025-05-06 00:41:48 -04:00
Thomas Vitale
356a68f15e Remove deprecations in JdbcChatMemory
* Remove deprecated APIs for JdbcChatMemory.
* Improve documentation about chat memory vs. chat history.
* Fix mismatch between docs vs code for max messages in MessageWindowChatMemory.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-05-06 00:40:08 -04:00
ykoh42
0569df745e docs: fix azure-openai-chat gradle dependencies
Signed-off-by: ykoh42 <kohyounghwan@gmail.com>
2025-05-05 21:44:49 -04:00
Mark Heckler
3dc86d33ce Added Entra ID identity management for Azure OpenAI, clean autoconfiguration, and updated docs to reflect changes.
Signed-off-by: Mark Heckler <mark.heckler@gmail.com>
2025-05-05 21:03:43 -04:00
Mark Pollack
9e71b163e3 Remove Waston text generation model 2025-05-03 18:36:02 -04:00
Mark Pollack
b275102063 clarify no direct transtive dependnecy on spring boot 2025-05-02 12:39:56 -04:00
Andres da Silva Santos
7bb553ecce Add support for stream usage in Azure OpenAi
This PR introduces support for streamUsage in the AzureOpenAiChatOptions.

   - Set com.azure.ai.openai.models.ChatCompletionStreamOptions#includeUsage via AzureOpenAiChatOptions.

Additionally:

 - Updates the unit test AzureOpenAiChatOptionsTests to reflect the changes.
 - Updates the documentation in azure-openai-chat.adoc.

Signed-off-by: Andres da Silva Santos <40636137+andresssantos@users.noreply.github.com>
2025-05-02 10:32:15 +01:00
Mark Pollack
5b7849de08 Add breaking changes to 1.0 M8 upgrade notes regarding chatclient tool calling 2025-05-01 16:49:57 -04:00
Christian Tzolov
3ceeb27101 feat(docs): add SSE endpoint configuration property to MCP client docs
- Add new connections.[name].sse-endpoint property with default value /sse
- Update table format to include default values column
- Clarify that connections.[name].url is a base URL endpoint

Related to #2724

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
2025-05-01 14:19:20 +03:00
Mark Pollack
b39805af30 clean up upgrade-notes.adoc 2025-04-30 12:09:15 -04:00
Mark Pollack
c347c6feaf Refactor: Move evaluation, converter, transformer, and util classes
- Move evaluation core classes (Request, Response, Evaluator) to spring-ai-commons.
- Move chat-specific evaluators (FactChecking, Relevancy) to spring-ai-client-chat#evaluation package.
- Move OutputConverter implementations and related classes to spring-ai-model#converter package.
- Move MetadataEnricher transformer classes to spring-ai-model#transformer package.
- Move PromptAssert utility to spring-ai-rag#util package.
- Update relevant pom.xml files and adjust imports in affected classes.
- Document class movements in upgrade-notes.adoc for M8 release.

This refactoring improves module organization and separation of concerns.

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-04-30 11:45:06 -04:00
Mark Pollack
091fca2d16 refactor(client): rename overloaded tools methods in prompt builder
Renames the ambiguous overloaded `tools` methods in `ChatClient.PromptRequestSpec`
to `toolNames` and `toolCallbacks` respectively. This improves clarity
and prevents potential issues with method dispatching based on argument types.

Updates relevant code examples and adds documentation to upgrade notes.

Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
2025-04-30 10:42:46 -04:00
Mark Pollack
435cf13647 Update docs to mention NoOpTemplateRenderer 2025-04-29 16:35:09 -04:00
Thomas Vitale
5527d037f2 Configure TemplateRenderer in ChatClient
- Extend the ChatClient with a new templateRenderer() method to pass a custom TemplateRenderer object used to render user and system templates.
- Evolve the QuestionAnswerAdvisor to accept a PromptTemplate for customising the RAG prompt and templating logic while maintaining backward compatibility.
- Introduce integration tests for the QuestionAnswerAdvisor.
- Document the TemplateRenderer API and how to use it to build PromptTemplate with custom templating logic.
- Document how to customise the templating logic used internally by the ChatClient via the TemplateRendererAPI.

Add validation tests and improve PromptTemplate resource handling

Enhance robustness and reliability of the PromptTemplate class with better
resource handling and comprehensive input validation:

- Add dedicated validation tests for builder methods with null/invalid inputs
- Improve renderResource method to gracefully handle edge cases:
  - Null resources return empty string
  - ByteArrayResource handling with proper charset (UTF-8)
  - Empty resources check with proper existence test
  - Better error handling with logging instead of exception propagation
- Add input validation assertions to all Builder methods
- Fix typo in deprecated annotation comment ("fahvor" → "favor")

Update documentation to clarify template rendering in different contexts:
- Add clear notes about TemplateRenderer usage in ChatClient vs Advisors
- Document how advisor template customization differs from ChatClient template rendering
- Add comprehensive API upgrade notes for template-related deprecations
- Include detailed migration examples for PromptTemplate and QuestionAnswerAdvisor

Fixes gh-355, gh-1687, gh-2448, gh-1849, gh-1428

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-04-29 16:21:10 -04:00
YunKui Lu
4a620815d3 GH-2743: Correct erroneous content in documents (#2744)
Fixes GH-2743 (https://github.com/spring-projects/spring-ai/issues/2743)

Revised the following files to ensure accuracy:
- `openai-chat.adoc`
- `openai-embeddings.adoc`
- `usage-handling.adoc`

Fixes #2743

Signed-off-by: YunKui Lu <luyunkui95@gmail.com>
2025-04-29 12:19:56 +01:00
jonghoon park
d48f4f63db apply builder pattern to OllamaApi
Signed-off-by: jonghoon park <dev@jonghoonpark.com>
2025-04-29 11:16:52 +01:00
Changho Kim
2e0017db49 fix: Typo at the codebase
fix: correct name typo from 'AsynClients' to 'AsyncClients'

fix: correct name typo from 'Autoconfiguration' to 'AutoConfiguration', 'optoins' to 'options'

fix: correct name typo from 'Differnt' to 'Different'

fix: correct name typo from 'Compatability' to 'Compatibility'

fix: correct name typo from 'Evalutaor' to 'Evaluator'

fix: correct name typo from 'Empyt' to 'Empty'

fix: correct name typo from 'Chroma Vecor Store' to 'Chroma Vector Store'

fix: correct name typo from 'Specificaiton' to 'Specification'

fix: correct name typo from 'applicaiton' to 'application'

fix: correct name typo from 'apropriate' to 'appropriate'

fix: correct name typo from 'asigned' to 'assigned'

fix: correct name typo from 'capabilitity' to 'capability'

fix: correct name typo from 'configuraiton' to 'configuration'

fix: correct name typo from 'conntection' to 'connection'

fix: correct name typo from 'curent' to 'current'

fix: correct name typo from 'customised' to 'customized'

Signed-off-by: Changho Kim <dukso4885@gmail.com>
2025-04-29 10:13:21 +01:00
shishuiwuhen2009
f759883c6c Update getting-started.adoc
docs: add Maven mirror config note for Spring AI snapshots

Add documentation about Maven mirror configuration when using Spring AI
snapshots, including examples of correct mirrorOf settings to allow
access to Spring repositories.

Signed-off-by: shishuiwuhen2009 <90782280+shishuiwuhen2009@users.noreply.github.com>
2025-04-29 09:48:51 +01:00
Thomas Vitale
1e1ad41815 Introduce DocumentPostProcessor API for Modular RAG
The DocumentPostProcessor API has been introduced to implement post-retrieval components in a Modular RAG architecture, superseding the DocumentCompressor, DocumentRanker, DocumentSelector APIs that are now deprecated.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-04-28 17:59:58 -04:00
Thomas Vitale
5397108b5a Support URI in Media
Introduce defining Media objects from a URI, deprecating the previous URL support.

Fixes gh-1147

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-04-28 17:54:30 -04:00
Thomas Vitale
688eab19f9 Add missing metadata for spring.ai.model.* properties
* The new spring.ai.model.* properties introduced in M7 were missing Spring Boot configuration metadata.

* Furthermore, the breaking change was not documented as the previous properties have been completely removed. Documentation has been added in the upgrade notes for this change.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-04-28 17:49:31 -04:00
Thomas Vitale
faa8778b6a Make ChatClient and Advisor APIs more robust - Part 2
* ChatClient observations now include the full prompt content instead of just the userText and systemText. Furthermore, they include consistent telemetry for the tools passed via the ChatClient and a first-class conversation ID when using memory advisors. Incomplete or unsafe attributes have been deprecated.
* Adopted the new robust Advisor APIs for BaseAdvisor and RetrievalAugmentationAdvisor.
* Improved the prompt augmentation facilities in ChatClientRequest and Prompt for performance and immutability.
* Fixed integration test racing condition.
* Updated the documentation for ChatClient and Observability accordingly.
* Documented changes in upgrade notes.
* Introduced `prompt.augmentUserMessage(String text)` to directly replace the user message content.
* Added `prompt.augmentUserMessage(Function<UserMessage, UserMessage> augmenter)` for more granular updates using the `userMessage.mutate()` pattern, allowing modification of text, media, and metadata.

Relates to gh-2655

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-04-28 17:35:55 -04:00
jito
3b752bbb54 Update deprecated Media constructor usage in documentation example (#2762)
Signed-off-by: jitokim <pigberger70@gmail.com>
2025-04-28 18:57:16 +01:00
Shawn Yu
8f5dbc8963 fix typo(Egineering->Engineering) (#2797)
Signed-off-by: Shawn Yu <syyu2015@gmail.com>
2025-04-28 18:55:04 +01:00
jito
37351fbba4 Rename ToolRegistration to ToolSpecification (#2859)
Signed-off-by: jitokim <pigberger70@gmail.com>
2025-04-28 18:41:28 +01:00
jito
98ed0fbfd5 Remove broken example applications from list (#2689)
Signed-off-by: jitokim <pigberger70@gmail.com>
2025-04-28 18:36:47 +01:00
努力的小雨
967c1d6761 feat (#2749) 2025-04-28 18:34:08 +01:00
吴伟杰
51046c78dd Fix typo in retrieval-augmented-generation.adoc (#2652)
reulsts -> results

Signed-off-by: 吴伟杰 <wuweijie@apache.org>
2025-04-28 18:31:43 +01:00
Ilayaperumal Gopinathan
f0702c343b Remove deprecated FunctionCallback references
- Remove the deprecated FunctionCallback related classes, references
 - Replace them with the corresponding ToolCallback usage

Signed-off-by: Ilayaperumal Gopinathan <ilayaperumal.gopinathan@broadcom.com>
2025-04-28 12:19:52 -04:00
Jackie Gleason
e5faad5ea4 Docs don't show these as bullets because they are in a note block. Looking at the other code it should be like this. (#1810) 2025-04-28 17:00:55 +01:00
qwp_p
9489ace425 Update mongodb.adoc (#2809)
The vector-index-name in the MongoDB configuration options should be wrong, but it's okay when I'm trying index-name (no warning)

Signed-off-by: qwp_p <70431503+RobinElysia@users.noreply.github.com>
2025-04-28 12:37:26 +01:00
shishuiwuhen2009
ffd8f1fa6f Update getting-started.adoc (#2880)
Add documentation about Maven mirror configuration when using Spring AI
snapshots, including examples of correct mirrorOf settings to allow
access to Spring repositories.

Signed-off-by: shishuiwuhen2009 <90782280+shishuiwuhen2009@users.noreply.github.com>
2025-04-28 11:07:44 +01:00
David Frizelle
c95d5c05ba Bump org.apache.tika to 3.1.0 (#2900)
Signed-off-by: David Frizelle <david.frizelle@gmail.com>
2025-04-28 11:00:29 +01:00
Thomas Vitale
0024e4dd49 Chat Memory Enhancements
* ChatMemory will become a generic interface to implement different memory management strategies. It’s been moved from the “”spring-ai-client-chat” package to “spring-ai-model” package while retaining the same package, so it’s transparent to users.
* A MessageWindowChatMemory has been introduced to provide support for a chat memory that keeps at most N messages in the memory.
* A ChatMemoryRepository interface has been introduced to support different storage strategies for the chat memory. It’s meant to be used as part of a ChatMemory implementation. This is different than before, where the storage-specific implementation was directly tied to the ChatMemory. This design is familiar to Spring users since it’s used already in the ecosystem. The goal was to use a programming model similar to Spring Session and Spring Data.
* The JdbcChatMemory has been supersed by JdbcChatMemoryRepository.
* A ChatMemory bean is auto-configured for you whenever using one of the Spring AI Model starters. By default, it uses the MessageWindowChatMemory implementation and stores the conversation history in memory. If a different repository is already configured (e.g., Cassandra, JDBC, or Neo4j), Spring AI will use that instead.
* First-class documentation has been introduced to describe the ChatMemory API and related features.
* All the changes introduced in this PR are backward-compatible.

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-04-25 15:53:20 -04:00
Mark Pollack
98052624b1 Remove Qianfan and Moonshot model modules
Drop support for the Qianfan and Moonshot models by removing their modules from the build.

These integrations are now maintained in the community repositories:
https://github.com/spring-ai-community/qianfan
https://github.com/spring-ai-community/moonshot
2025-04-25 14:02:23 -04:00
Mark Pollack
ff52859b2d migrate remaining moonshot modules to community repo 2025-04-25 13:05:11 -04:00
Thomas Vitale
2bc29dab32 Introduce TemplateRenderer for prompt templating
- Introduce new TemplateRenderer API providing the logic for rendering an input template.
- Update the PromptTemplate API to accept a TemplateRenderer object at construction time.
- Move ST logic to StTemplateRenderer implementation, used by default in PromptTemplate. Additionally, make start and end delimiter character configurable.

Relates to gh-2655

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
2025-04-24 17:17:40 -04:00