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:
@@ -0,0 +1,45 @@
|
||||
---
|
||||
# Run this first: it moves the build and the configuration. Run it while the project still resolves 2.0.
|
||||
type: specs.openrewrite.org/v1beta/recipe
|
||||
name: com.ankurm.SpringAi20To21Build
|
||||
displayName: Spring AI 2.0 to 2.1, build and properties
|
||||
description: Version bumps, the Redis chat memory rename and the Anthropic sampling properties.
|
||||
recipeList:
|
||||
- org.openrewrite.maven.UpgradeParentVersion:
|
||||
groupId: org.springframework.boot
|
||||
artifactId: spring-boot-starter-parent
|
||||
newVersion: 4.2.0
|
||||
- org.openrewrite.maven.ChangePropertyValue:
|
||||
key: spring-ai.version
|
||||
newValue: 2.1.0
|
||||
- org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId:
|
||||
oldGroupId: org.springframework.ai
|
||||
oldArtifactId: spring-ai-autoconfigure-model-chat-memory-redis
|
||||
newArtifactId: spring-ai-autoconfigure-model-chat-memory-repository-redis
|
||||
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
|
||||
oldPropertyKey: spring.ai.chat.memory.redis
|
||||
newPropertyKey: spring.ai.chat.memory.repository.redis
|
||||
- org.openrewrite.java.spring.DeleteSpringProperty:
|
||||
propertyKey: spring.ai.anthropic.chat.temperature
|
||||
- org.openrewrite.java.spring.DeleteSpringProperty:
|
||||
propertyKey: spring.ai.anthropic.chat.top-p
|
||||
- org.openrewrite.java.spring.DeleteSpringProperty:
|
||||
propertyKey: spring.ai.anthropic.chat.top-k
|
||||
---
|
||||
# Run this second, in a new Maven invocation, so that types resolve against the 2.1.0 jars.
|
||||
type: specs.openrewrite.org/v1beta/recipe
|
||||
name: com.ankurm.SpringAi20To21Code
|
||||
displayName: Spring AI 2.0 to 2.1, the safe code edits
|
||||
description: >
|
||||
Removes Anthropic sampling calls and moves the conversation-id constant. It does not move
|
||||
ChatMemory code to sessions: that needs a person.
|
||||
recipeList:
|
||||
- org.openrewrite.java.RemoveMethodInvocations:
|
||||
methodPattern: org.springframework.ai.anthropic.AnthropicChatOptions$AbstractBuilder temperature(..)
|
||||
- org.openrewrite.java.RemoveMethodInvocations:
|
||||
methodPattern: org.springframework.ai.anthropic.AnthropicChatOptions$AbstractBuilder topP(..)
|
||||
- org.openrewrite.java.RemoveMethodInvocations:
|
||||
methodPattern: org.springframework.ai.anthropic.AnthropicChatOptions$AbstractBuilder topK(..)
|
||||
- org.openrewrite.java.ReplaceConstantWithAnotherConstant:
|
||||
existingFullyQualifiedConstantName: org.springframework.ai.chat.memory.ChatMemory.CONVERSATION_ID
|
||||
fullyQualifiedConstantName: org.springframework.ai.chat.client.advisor.api.MemoryAdvisor.CONVERSATION_ID
|
||||
Reference in New Issue
Block a user