--- # 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