Add ai-21-migration module: upgrading Spring AI 2.0.x to 2.1.0, measured. One probe source tree run on 2.0.0, 2.0.2, 2.0.3 and 2.1.0 (Anthropic prompt tokens with caching, auth header, discarded temperature, thinking parts, message mutability, entity() on refusals), three compile breaks, API and configuration diffs from the jars, ChatMemory to session copy, a wrapping ToolCallingManager under tool confirmation, the OpenAI Responses switch, VectorStore.upsert on real pgvector, a grep checklist and an OpenRewrite recipe. Scripted and local fake models; no provider called. Spring Boot 4.2.0, Spring AI 2.1.0, Java 25.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b7N4ZDbUtA3ofqAqRV
This commit is contained in:
Claude
2026-12-03 09:46:46 +05:30
parent 8f69e7bf50
commit c8fa0912f7
71 changed files with 1990 additions and 0 deletions
@@ -0,0 +1,41 @@
package com.ankurm.aimigration;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.model.tool.ToolCallDecisions;
import org.springframework.ai.model.tool.ToolCallingChatOptions;
import org.springframework.ai.model.tool.ToolCallingManager;
import org.springframework.ai.model.tool.ToolExecutionResult;
import org.springframework.ai.tool.definition.ToolDefinition;
/** A wrapping manager as it has to look on 2.1: the third method is a default that throws. */
public class LoggingToolCallingManager implements ToolCallingManager {
private static final Logger log = LoggerFactory.getLogger(LoggingToolCallingManager.class);
private final ToolCallingManager delegate;
public LoggingToolCallingManager(ToolCallingManager delegate) {
this.delegate = delegate;
}
@Override
public List<ToolDefinition> resolveToolDefinitions(ToolCallingChatOptions options) {
return delegate.resolveToolDefinitions(options);
}
@Override
public ToolExecutionResult executeToolCalls(Prompt prompt, ChatResponse response) {
log.info("executing tool calls");
return delegate.executeToolCalls(prompt, response);
}
@Override
public ToolExecutionResult executeToolCalls(Prompt prompt, ChatResponse response, ToolCallDecisions decisions) {
log.info("resuming tool calls with {} decision(s)", decisions.decisions().size());
return delegate.executeToolCalls(prompt, response, decisions);
}
}