You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can automate the upgrade process to 1.0.0-SNAPSHOT using the Claude Code CLI tool with a provided prompt. The prompt will guide the AI to perform the following tasks:
31
+
You can automate the upgrade process to 1.0.0-M8 using an OpenRewrite recipe.
32
+
This recipe helps apply many of the necessary code changes for this version.
33
+
Find the recipe and usage instructions at https://github.com/arconia-io/arconia-migrations/blob/main/docs/spring-ai.md[Arconia Spring AI Migrations].
32
34
33
-
1. Update the Spring AI BOM version to 1.0.0-SNAPSHOT
34
-
2. Ensure all required repositories exist in your build configuration
35
-
3. Update Spring AI artifact IDs according to the new naming patterns
35
+
=== Breaking Changes
36
+
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.
36
37
37
-
To use this automation:
38
+
==== Example
38
39
39
-
1. Download the https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview[Claude Code CLI tool]
40
-
2. Copy the prompt from the https://github.com/spring-projects/spring-ai/blob/main/src/prompts/update-to-snapshot.txt[update-to-snapshot.txt] file
41
-
3. Paste the prompt into the Claude Code CLI
42
-
4. The AI will analyze your project and make the necessary changes
40
+
Here's an example of code that worked in M7 but no longer functions as expected in M8:
43
41
44
-
This approach can save time and reduce the chance of errors when upgrading multiple projects or complex codebases.
42
+
[source,java]
43
+
----
44
+
// Old code in M7 - no longer works correctly in M8
45
+
chatClient.prompt("What day is tomorrow?")
46
+
.tools(toolCallback)
47
+
.call()
48
+
.content();
49
+
----
50
+
51
+
==== How to Adapt Your Code
52
+
53
+
To fix this issue when upgrading to M8, you need to update your code to use the new `toolCallbacks()` method:
54
+
55
+
[source,java]
56
+
----
57
+
// Updated code for M8
58
+
chatClient.prompt("What day is tomorrow?")
59
+
.toolCallbacks(toolCallback)
60
+
.call()
61
+
.content();
62
+
----
63
+
64
+
==== Why This Change Was Made
65
+
66
+
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.
67
+
68
+
==== Method Mapping from M7 to M8
69
+
70
+
Here's how the old methods map to their new counterparts:
- Use only for objects with methods annotated with `@Tool`
86
+
87
+
==== Improved Error Handling
88
+
89
+
In the https://github.com/spring-projects/spring-ai/pull/2964[this PR now merged (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.
90
+
91
+
==== Migration Summary
92
+
93
+
If you're upgrading from M7 to M8:
94
+
95
+
1. Replace all calls to `.tools(toolCallback)` with `.toolCallbacks(toolCallback)`
96
+
2. Replace all calls to `.tools(toolCallbackProvider)` with `.toolCallbacks(toolCallbackProvider)`
97
+
3. Replace all calls to `.tools("toolName")` with `.toolNames("toolName")`
98
+
99
+
These changes will ensure your tool calling functionality continues to work correctly after upgrading to Spring AI 1.0 M8.
45
100
46
-
[[upgrading-to-1-0-0-m8]]
47
-
== Upgrading to 1.0.0-M8
48
101
49
-
You can automate the upgrade process to 1.0.0-M8 using an OpenRewrite recipe.
50
-
This recipe helps apply many of the necessary code changes for this version.
51
-
Find the recipe and usage instructions at https://github.com/arconia-io/arconia-migrations/blob/main/docs/spring-ai.md[Arconia Spring AI Migrations].
0 commit comments