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:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# Search a project for code and configuration that needs a decision on the way to Spring AI 2.1.
|
||||
# usage: scripts/grep-checklist.sh <project-dir>
|
||||
dir=${1:?project directory}
|
||||
cd "$dir" || exit 2
|
||||
|
||||
check() { # title, extended regex, file globs...
|
||||
local title=$1 regex=$2; shift 2
|
||||
local includes=(); for g in "$@"; do includes+=("--include=$g"); done
|
||||
local hits; hits=$(grep -rnE "${includes[@]}" --exclude-dir=target --exclude-dir=build -e "$regex" . | sed 's#^\./##' | sort)
|
||||
if [ -n "$hits" ]; then echo; echo "[ ] $title"; echo "$hits" | sed 's/^ */ /'; fi
|
||||
}
|
||||
|
||||
code=('*.java' '*.kt')
|
||||
conf=('*.properties' '*.yml' '*.yaml')
|
||||
build=('pom.xml' '*.gradle' '*.kts' '*.toml')
|
||||
|
||||
echo "# Spring AI 2.1 upgrade checklist: $(basename "$PWD")"
|
||||
check "ChatMemory API: deprecated, removed in 3.0.0 (move to sessions)" \
|
||||
'MessageChatMemoryAdvisor|MessageWindowChatMemory|ChatMemoryRepository|ChatMemory\b' "${code[@]}"
|
||||
check "Chat memory modules and properties" 'chat-memory-repository|chat-memory-redis' "${build[@]}"
|
||||
check "Chat memory properties (JDBC ones have spring.ai.session replacements)" 'spring\.ai\.chat\.memory' "${conf[@]}"
|
||||
check "Anthropic sampling options: discarded with a WARN on 2.1.0" '\.(temperature|topP|topK)\(' "${code[@]}"
|
||||
check "Anthropic sampling properties" 'spring\.ai\.anthropic\.chat\.(options\.)?(temperature|top-p|top-k)' "${conf[@]}"
|
||||
check "Token arithmetic on cache counters: prompt tokens include them since 2.0.3" 'getCache(Read|Write)InputTokens' "${code[@]}"
|
||||
check "x-api-key handling: Anthropic keys now travel as Authorization: Bearer" '[Xx]-[Aa][Pp][Ii]-[Kk]ey' "${code[@]}" "${conf[@]}" '*.conf'
|
||||
check "Reasoning read from metadata or extra generations" '"(isThought|thinking|signature|reasoningContent|thinking_content)"|THOUGHT_METADATA_KEY|THINKING_[A-Z_]*METADATA|getReasoningContent|DeepSeekAssistantMessage' "${code[@]}"
|
||||
check "Mutating message lists (now unmodifiable)" 'get(Media|ToolCalls)\(\)\.(add|addAll|remove|removeIf|clear)\(' "${code[@]}"
|
||||
check "Custom ToolCallingManager: delegate the ToolCallDecisions overload" 'implements +ToolCallingManager|: *ToolCallingManager' "${code[@]}"
|
||||
check "Bedrock requestParameters widened to Map<String, Object>" 'requestParameters' "${code[@]}"
|
||||
check "entity() with filtered or guarded replies: exception types changed" 'SafeGuardAdvisor' "${code[@]}"
|
||||
check "pgvector 'distance' metadata key" 'getMetadata\(\)\.get\("distance"\)|DocumentMetadata\.DISTANCE' "${code[@]}"
|
||||
check "MCP server customizers: deprecated in 2.1.0" 'Mcp(Async|Sync|StatelessAsync|StatelessSync)ServerCustomizer' "${code[@]}"
|
||||
check "TikaDocumentReader: 10,000,000 character limit since 2.0.3" 'new TikaDocumentReader' "${code[@]}"
|
||||
check "SemanticCacheAdvisor: a scope resolver is mandatory since 2.0.2" 'SemanticCacheAdvisor' "${code[@]}"
|
||||
check "Tool resolution fallback: off by default since 2.0.1" 'ToolCallbackResolver' "${code[@]}"
|
||||
check "Spring AI and Spring Boot versions" 'spring-ai(\.version|-bom)|spring-boot-starter-parent' "${build[@]}"
|
||||
echo
|
||||
echo "A hit is a place to read, not proof of a problem. No hit is not proof of safety."
|
||||
Reference in New Issue
Block a user