聊聊Spring AI 1.0.0-SNAPSHOT的变更

本文主要研究一下Spring AI 1.0.0-SNAPSHOT的变更

Artifact ID变更

  • Model starters: spring-ai-{model}-spring-boot-starter → spring-ai-starter-model-{model}
  • Vector Store starters: spring-ai-{store}-store-spring-boot-starter → spring-ai-starter-vector-store-{store}
  • MCP starters: spring-ai-mcp-{type}-spring-boot-starter → spring-ai-starter-mcp-{type}

示例

复制代码
<!-- BEFORE -->
<dependency>
    <groupId>org.springframework.ai</groupId>
    <artifactId>spring-ai-openai-spring-boot-starter</artifactId>
</dependency>

<!-- AFTER -->
<dependency>
    <groupId>org.springframework.ai</groupId>
    <artifactId>spring-ai-starter-model-openai</artifactId>
</dependency>

Spring AI Autoconfiguration从单体模块变更为每个model、vector-store等独立的autoconfiguration,拆开的目的就是避免引入没必要的依赖,减少冲突风险:

复制代码
<!-- NO LONGER AVAILABLE -->
<dependency>
    <groupId>org.springframework.ai</groupId>
    <artifactId>spring-ai-spring-boot-autoconfigure</artifactId>
    <version>${project.version}</version>
</dependency>

取而代之的是:

  • Model autoconfiguration: spring-ai-autoconfigure-model-{model}

    <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-autoconfigure-model-openai</artifactId> </dependency> <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-autoconfigure-model-anthropic</artifactId> </dependency> <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-autoconfigure-model-vertex-ai</artifactId> </dependency>
  • Vector Store autoconfiguration: spring-ai-autoconfigure-vector-store-{store}

    <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-autoconfigure-vector-store-redis</artifactId> </dependency> <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-autoconfigure-vector-store-pgvector</artifactId> </dependency> <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-autoconfigure-vector-store-chroma</artifactId> </dependency>
  • MCP autoconfiguration: spring-ai-autoconfigure-mcp-{type}

    <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-autoconfigure-mcp-client</artifactId> </dependency> <dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-autoconfigure-mcp-server</artifactId> </dependency>

Package Name变更

  • KeywordMetadataEnricher以及SummaryMetadataEnricher从org.springframework.ai.transformer变更到org.springframework.ai.chat.transformer
  • Content, MediaContent以及Media从org.springframework.ai.model变更到org.springframework.ai.content

Module变更

之前是所有的都在spring-ai-core,现在拆分到具体的领域模块来减少不必要的依赖,如下:

  • spring-ai-commons包含了核心的model比如DocumentTextSplitter
  • spring-ai-model包含了AI能力的相关抽象,比如ChatModelEmbeddingModelImageModelToolDefinitionToolCallback
  • spring-ai-vector-store统一了向量数据库的抽象VectorStore,提供了SimpleVectorStore便于内存使用
  • spring-ai-client-chat提供了high-level的AI会话API,比如ChatClientChatMemoryOutputConverter
  • spring-ai-advisors-vector-store为RAG衔接了chat和向量数据库,比如QuestionAnswerAdvisorVectorStoreChatMemoryAdvisor
  • spring-ai-model-chat-memory-cassandra提供了CassandraChatMemory
  • spring-ai-rag提供了RAG的pipelines,比如RetrievalAugmentationAdvisor

Dependency Structure变更如下:

  • spring-ai-commons (foundation)
  • spring-ai-model (depends on commons)
  • spring-ai-vector-store and spring-ai-client-chat (both depend on model)
  • spring-ai-advisors-vector-store and spring-ai-rag (depend on both client-chat and vector-store)
  • spring-ai-model-chat-memory-* modules (depend on client-chat)

小结

Spring AI 1.0.0-SNAPSHOT主要是涉及了Artifact ID, Package, Module的变更;Spring AI Autoconfiguration从单体模块变更为每个model、vector-store等独立的autoconfiguration,拆开的目的就是避免引入没必要的依赖,减少冲突风险;KeywordMetadataEnricher、SummaryMetadataEnricher、Content、MediaContent以及Media涉及了包名的变更;模块的变更将spring-ai-core拆分到具体的领域模块来减少不必要的依赖。

doc

相关推荐
董厂长30 分钟前
langchain :记忆组件混淆概念澄清 & 创建Conversational ReAct后显示指定 记忆组件
人工智能·深度学习·langchain·llm
kangkang-2 小时前
PC端基于SpringBoot架构控制无人机(三):系统架构设计
java·架构·无人机
界面开发小八哥3 小时前
「Java EE开发指南」如何用MyEclipse创建一个WEB项目?(三)
java·ide·java-ee·myeclipse
idolyXyz4 小时前
[java: Cleaner]-一文述之
java
G皮T4 小时前
【人工智能】ChatGPT、DeepSeek-R1、DeepSeek-V3 辨析
人工智能·chatgpt·llm·大语言模型·deepseek·deepseek-v3·deepseek-r1
一碗谦谦粉4 小时前
Maven 依赖调解的两大原则
java·maven
九年义务漏网鲨鱼4 小时前
【大模型学习 | MINIGPT-4原理】
人工智能·深度学习·学习·语言模型·多模态
元宇宙时间4 小时前
Playfun即将开启大型Web3线上活动,打造沉浸式GameFi体验生态
人工智能·去中心化·区块链
开发者工具分享4 小时前
文本音频违规识别工具排行榜(12选)
人工智能·音视频
netyeaxi4 小时前
Java:使用spring-boot + mybatis如何打印SQL日志?
java·spring·mybatis