Migrate to Spring AI 1.0

Proprietary

Migrate applications from Spring AI 0.8 and the 1.0 milestones to Spring AI 1.0. This moves the Spring Boot starters to their spring-ai-starter-model-*, spring-ai-starter-vector-store-* and spring-ai-starter-mcp-* names, replaces spring-ai-core with the modules it was split into, and upgrades Spring AI dependencies to 1.0. In code it renames the 0.8 *Client model types to *Model, the output parsers to structured output converters, moves the types that changed packages, drops the with prefix of builder methods, builds SearchRequests, APIs and advisors through their builders, migrates the FunctionCallback API to the ToolCallback API and the MCP server registrations to specifications, and replaces InMemoryChatMemory. It also renames the observation and chat memory repository configuration properties.

io.moderne.java.spring.ai1.UpgradeSpringAi_1_0
mod run . --recipe=io.moderne.java.spring.ai1.UpgradeSpringAi_1_0

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Replace FunctionCallback.builder() with FunctionToolCallback.builder(..)
  2. Drop the with prefix of Spring AI builder methods
  3. Build Spring AI SearchRequests with SearchRequest.builder()
  4. Create the Spring AI Ollama and OpenAI APIs with their builders
  5. Change method target to static
  6. Change type ChatOptionsBuilder to ChatOptions$Builder
  7. Change type FunctionCallingOptionsBuilder to ToolCallingChatOptions$Builder
  8. Migrate MCP server registrations to specifications
  9. Change method name org.springframework.ai.parser.Parser parse(java.lang.String) to convert
  10. Change method name org.springframework.ai.chat.metadata.Usage getGenerationTokens() to getCompletionTokens
  11. Change method name org.springframework.ai.chat.client.ChatClient$ChatClientRequestSpec functions(java.lang.String...) to toolNames
  12. Change method name org.springframework.ai.chat.client.ChatClient$ChatClientRequestSpec tools(java.lang.String...) to toolNames
  13. Change method name org.springframework.ai.chat.client.ChatClient$ChatClientRequestSpec functions(org.springframework.ai.model.function.FunctionCallback...) to toolCallbacks
  14. Change method name org.springframework.ai.chat.client.ChatClient$ChatClientRequestSpec tools(org.springframework.ai.model.function.FunctionCallback...) to toolCallbacks
  15. Change method name org.springframework.ai.chat.client.ChatClient$ChatClientRequestSpec tools(java.util.List) to toolCallbacks
  16. Change method name org.springframework.ai.chat.client.ChatClient$ChatClientRequestSpec tools(org.springframework.ai.tool.ToolCallbackProvider...) to toolCallbacks
  17. Change method name org.springframework.ai.chat.client.ChatClient$Builder defaultFunctions(java.lang.String...) to defaultToolNames
  18. Change method name org.springframework.ai.chat.client.ChatClient$Builder defaultTools(java.lang.String...) to defaultToolNames
  19. Change method name org.springframework.ai.chat.client.ChatClient$Builder defaultFunctions(org.springframework.ai.model.function.FunctionCallback...) to defaultToolCallbacks
  20. Change method name org.springframework.ai.chat.client.ChatClient$Builder defaultTools(org.springframework.ai.model.function.FunctionCallback...) to defaultToolCallbacks
  21. Change method name org.springframework.ai.chat.client.ChatClient$Builder defaultTools(java.util.List) to defaultToolCallbacks
  22. Change method name org.springframework.ai.chat.client.ChatClient$Builder defaultTools(org.springframework.ai.tool.ToolCallbackProvider...) to defaultToolCallbacks
  23. Change method name org.springframework.ai..* functionCallbacks(..) to toolCallbacks
  24. Change method name org.springframework.ai..* functions(java.util.Set) to toolNames
  25. Change method name org.springframework.ai..* function(java.lang.String) to toolNames
  26. Change method name org.springframework.ai..* getFunctionCallbacks() to getToolCallbacks
  27. Change method name org.springframework.ai..* setFunctionCallbacks(java.util.List) to setToolCallbacks
  28. Change method name org.springframework.ai..* getFunctions() to getToolNames
  29. Change method name org.springframework.ai..* setFunctions(java.util.Set) to setToolNames
  30. Replace constant with another constant
  31. Replace constant with literal value
  32. Replace constant with literal value
  33. Replace constant with another constant
  34. Change type ChatClient to ChatModel
  35. Change type StreamingChatClient to StreamingChatModel
  36. Change type org.springframework.ai.chat.ChatResponse to org.springframework.ai.chat.model.ChatResponse
  37. Change type org.springframework.ai.chat.Generation to org.springframework.ai.chat.model.Generation
  38. Change type org.springframework.ai.chat.messages.Media to org.springframework.ai.content.Media
  39. Change type ModelClient to Model
  40. Change type StreamingModelClient to StreamingModel
  41. Change type EmbeddingClient to EmbeddingModel
  42. Change type AbstractEmbeddingClient to AbstractEmbeddingModel
  43. Change type ImageClient to ImageModel
  44. Change type AzureOpenAiChatClient to AzureOpenAiChatModel
  45. Change type AzureOpenAiEmbeddingClient to AzureOpenAiEmbeddingModel
  46. Change type BedrockCohereEmbeddingClient to BedrockCohereEmbeddingModel
  47. Change type BedrockTitanEmbeddingClient to BedrockTitanEmbeddingModel
  48. Change type HuggingfaceChatClient to HuggingfaceChatModel
  49. Change type MistralAiChatClient to MistralAiChatModel
  50. Change type MistralAiEmbeddingClient to MistralAiEmbeddingModel
  51. Change type OllamaChatClient to OllamaChatModel
  52. Change type OllamaEmbeddingClient to OllamaEmbeddingModel
  53. Change type OpenAiAudioTranscriptionClient to OpenAiAudioTranscriptionModel
  54. Change type OpenAiChatClient to OpenAiChatModel
  55. Change type OpenAiEmbeddingClient to OpenAiEmbeddingModel
  56. Change type OpenAiImageClient to OpenAiImageModel
  57. Change type PostgresMlEmbeddingClient to PostgresMlEmbeddingModel
  58. Change type StabilityAiImageClient to StabilityAiImageModel
  59. Change type TransformersEmbeddingClient to TransformersEmbeddingModel
  60. Change type VertexAiGeminiChatClient to VertexAiGeminiChatModel
  61. Change type org.springframework.ai.openai.audio.transcription.AudioTranscription to org.springframework.ai.audio.transcription.AudioTranscription
  62. Change type org.springframework.ai.openai.audio.transcription.AudioTranscriptionPrompt to org.springframework.ai.audio.transcription.AudioTranscriptionPrompt
  63. Change type org.springframework.ai.openai.audio.transcription.AudioTranscriptionResponse to org.springframework.ai.audio.transcription.AudioTranscriptionResponse
  64. Change type OutputParser to StructuredOutputConverter
  65. Change type BeanOutputParser to BeanOutputConverter
  66. Change type ListOutputParser to ListOutputConverter
  67. Change type MapOutputParser to MapOutputConverter
  68. Change type AbstractConversionServiceOutputParser to AbstractConversionServiceOutputConverter
  69. Change type AbstractMessageConverterOutputParser to AbstractMessageOutputConverter
  70. Change type org.springframework.ai.parser.FormatProvider to org.springframework.ai.converter.FormatProvider
  71. Change type org.springframework.ai.ResourceUtils to org.springframework.ai.util.ResourceUtils
  72. Change type org.springframework.ai.vectorsore.ChromaVectorStore to org.springframework.ai.chroma.vectorstore.ChromaVectorStore
  73. Change type org.springframework.ai.chroma.ChromaApi to org.springframework.ai.chroma.vectorstore.ChromaApi
  74. Change type org.springframework.ai.vectorstore.filter.converter.ChromaFilterExpressionConverter to org.springframework.ai.chroma.vectorstore.ChromaFilterExpressionConverter
  75. Change type org.springframework.ai.vectorstore.MilvusVectorStore to org.springframework.ai.vectorstore.milvus.MilvusVectorStore
  76. Change type org.springframework.ai.vectorstore.filter.converter.MilvusFilterExpressionConverter to org.springframework.ai.vectorstore.milvus.MilvusFilterExpressionConverter
  77. Change type org.springframework.ai.vectorstore.Neo4jVectorStore to org.springframework.ai.vectorstore.neo4j.Neo4jVectorStore
  78. Change type org.springframework.ai.vectorstore.filter.Neo4jVectorFilterExpressionConverter to org.springframework.ai.vectorstore.neo4j.filter.Neo4jVectorFilterExpressionConverter
  79. Change type org.springframework.ai.vectorstore.PgVectorStore to org.springframework.ai.vectorstore.pgvector.PgVectorStore
  80. Change type org.springframework.ai.vectorstore.filter.converter.PgVectorFilterExpressionConverter to org.springframework.ai.vectorstore.pgvector.PgVectorFilterExpressionConverter
  81. Change type org.springframework.ai.vectorstore.PineconeVectorStore to org.springframework.ai.vectorstore.pinecone.PineconeVectorStore
  82. Change type org.springframework.ai.vectorstore.RedisVectorStore to org.springframework.ai.vectorstore.redis.RedisVectorStore
  83. Change type org.springframework.ai.vectorstore.RedisFilterExpressionConverter to org.springframework.ai.vectorstore.redis.RedisFilterExpressionConverter
  84. Change type org.springframework.ai.vectorstore.WeaviateVectorStore to org.springframework.ai.vectorstore.weaviate.WeaviateVectorStore
  85. Change type org.springframework.ai.vectorstore.WeaviateFilterExpressionConverter to org.springframework.ai.vectorstore.weaviate.WeaviateFilterExpressionConverter
  86. Change type org.springframework.ai.chat.client.advisor.QuestionAnswerAdvisor to org.springframework.ai.chat.client.advisor.vectorstore.QuestionAnswerAdvisor
  87. Change type org.springframework.ai.chat.client.advisor.VectorStoreChatMemoryAdvisor to org.springframework.ai.chat.client.advisor.vectorstore.VectorStoreChatMemoryAdvisor
  88. Change type org.springframework.ai.chat.client.advisor.RetrievalAugmentationAdvisor to org.springframework.ai.rag.advisor.RetrievalAugmentationAdvisor
  89. Change type org.springframework.ai.evaluation.FactCheckingEvaluator to org.springframework.ai.chat.evaluation.FactCheckingEvaluator
  90. Change type org.springframework.ai.evaluation.RelevancyEvaluator to org.springframework.ai.chat.evaluation.RelevancyEvaluator
  91. Change type org.springframework.ai.model.Content to org.springframework.ai.content.Content
  92. Change type org.springframework.ai.model.Media to org.springframework.ai.content.Media
  93. Change type org.springframework.ai.model.MediaContent to org.springframework.ai.content.MediaContent
  94. Change type org.springframework.ai.tool.ToolCallbacks to org.springframework.ai.support.ToolCallbacks
  95. Change type org.springframework.ai.tool.util.ToolUtils to org.springframework.ai.tool.support.ToolUtils
  96. Change type org.springframework.ai.transformer.KeywordMetadataEnricher to org.springframework.ai.model.transformer.KeywordMetadataEnricher
  97. Change type org.springframework.ai.transformer.SummaryMetadataEnricher to org.springframework.ai.model.transformer.SummaryMetadataEnricher
  98. Change type org.springframework.ai.util.PromptAssert to org.springframework.ai.rag.util.PromptAssert
  99. Change type FunctionCallingOptions to ToolCallingChatOptions
  100. Change type FunctionCallback to ToolCallback
  101. Rename package name org.springframework.ai.chat.memory.cassandra to org.springframework.ai.chat.memory.repository.cassandra
  102. Rename package name org.springframework.ai.chat.memory.jdbc to org.springframework.ai.chat.memory.repository.jdbc
  103. Rename package name org.springframework.ai.chat.memory.neo4j to org.springframework.ai.chat.memory.repository.neo4j
  104. Create Spring AI advisors with their builders
  105. Add comment to method invocations
  106. Add comment to method invocations
  107. Add comment to method invocations
  108. Add comment to method invocations
  109. Replace InMemoryChatMemory with MessageWindowChatMemory
  110. Migrate Spring AI properties to 1.0
  111. Migrate Spring AI dependencies to 1.0