Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreAfter reviewing our API design and deprecations post M7, we determined that several significant changes would become breaking changes in an RC1 release. Therefore, we've introduced this additional milestone to provide developers with a transitional release where deprecated APIs coexist alongside their replacements, enabling a smoother upgrade experience before RC1.
Here are the key changes in this release.
When upgrading from Spring AI 1.0 M7 to 1.0 M8, users who previously registered tool callbacks are encountering breaking changes that cause tool calling functionality to silently fail. This is specifically impacting code that used the deprecated tools()
method.
Here's an example of code that worked in M7 but no longer functions as expected in M8:
// Old code in M7 - no longer works correctly in M8
chatClient.prompt("What day is tomorrow?")
.tools(toolCallback)
.call()
.content();
To fix this issue when upgrading to M8, you need to update your code to use the new toolCallbacks()
method:
// Updated code for M8
chatClient.prompt("What day is tomorrow?")
.toolCallbacks(toolCallback)
.call()
.content();
The Spring AI team renamed the overloaded tools()
methods to improve clarity and prevent ambiguity in method dispatching. The previous API design led to confusion when the Java compiler needed to select between multiple overloaded methods based on parameter types.
Here's how the old methods map to their new counterparts:
tools(String... toolNames)
→ toolNames(String... toolNames)
@Bean
with @Description
)tools(ToolCallback... toolCallbacks)
→ toolCallbacks(ToolCallback... toolCallbacks)
tools(List<ToolCallback> toolCallbacks)
→ toolCallbacks(List<ToolCallback> toolCallbacks)
tools(ToolCallbackProvider... toolCallbackProviders)
→ toolCallbacks(ToolCallbackProvider... toolCallbackProviders)
ToolCallbackProvider
interfacetools(Object... toolObjects)
remains unchanged
@Tool
In the latest PR (spring-projects/spring-ai#2964), the tools(Object... toolObjects)
method will now throw an exception when no @Tool
methods are found on the provided objects, rather than silently failing. This helps developers identify migration issues immediately.
If you're upgrading from M7 to M8:
.tools(toolCallback)
with .toolCallbacks(toolCallback)
.tools(toolCallbackProvider)
with .toolCallbacks(toolCallbackProvider)
.tools("toolName")
with .toolNames("toolName")
These changes will ensure your tool calling functionality continues to work correctly after upgrading to Spring AI 1.0 M8.
ChatMemory
API for more flexible conversation history managementChatMemoryRepository
interface allows different storage strategiesMessageWindowChatMemory
for maintaining a window of messagesInMemoryChatMemoryRepository
(default)JdbcChatMemoryRepository
for relational databasesStTemplateRenderer
with support for built-in functions and custom validation options. See how to use it here.NoOpTemplateRenderer
for cases where templating is not neededThe important deprecations to take note of are:
ChatClient
has been updated to ensure user and system prompts are always rendered before advisor execution. This change replaces the AdvisedRequest
and AdvisedResponse
APIs with ChatClientRequest
and ChatClientResponse
.Prompt Templating and Advisors:
TemplateRenderer
interface.QuestionAnswerAdvisor Deprecations:
userTextAdvise
string.spring.ai.chat.memory.jdbc.initialize-schema
property is deprecated in favor of spring.ai.chat.memory.repository.jdbc.initialize-schema
.DocumentPostProcessor
API replaces deprecated APIs like DocumentCompressor
, DocumentRanker
, and DocumentSelector
.Chat Memory Deprecations:
@Deprecated List<Message> get(String conversationId, int lastN);
is deprecated in ChatMemory
.There were other refactoring, bug fixing, documentation enhancements across the board by a wide range of contributors. If we haven't gotten to your PR yet, we will, please be patient. Thanks to