聊聊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}

    org.springframework.ai spring-ai-autoconfigure-model-openai org.springframework.ai spring-ai-autoconfigure-model-anthropic org.springframework.ai spring-ai-autoconfigure-model-vertex-ai
  • Vector Store autoconfiguration: spring-ai-autoconfigure-vector-store-{store}

    org.springframework.ai spring-ai-autoconfigure-vector-store-redis org.springframework.ai spring-ai-autoconfigure-vector-store-pgvector org.springframework.ai spring-ai-autoconfigure-vector-store-chroma
  • MCP autoconfiguration: spring-ai-autoconfigure-mcp-{type}

    org.springframework.ai spring-ai-autoconfigure-mcp-client org.springframework.ai spring-ai-autoconfigure-mcp-server

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比如Document、TextSplitter
  • spring-ai-model包含了AI能力的相关抽象,比如ChatModel、EmbeddingModel、ImageModel、ToolDefinition、ToolCallback
  • spring-ai-vector-store统一了向量数据库的抽象VectorStore,提供了SimpleVectorStore便于内存使用
  • spring-ai-client-chat提供了high-level的AI会话API,比如ChatClient、ChatMemory、OutputConverter
  • spring-ai-advisors-vector-store为RAG衔接了chat和向量数据库,比如QuestionAnswerAdvisor、VectorStoreChatMemoryAdvisor
  • 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

相关推荐
lgcgkCQ2 分钟前
【AI 转型实战 1】SpringAI 入门:搭建基础大模型对话能力
java·ai·agent·rag·spring ai·mcp·langchain4j
vilya2 分钟前
Agent 语音引擎换心记:从「够用」到「稳且好」
人工智能·agent
王中阳Go2 分钟前
5.27 分钟干完后端和全部测试:一场三小时笔试的五个失分点,四个不在代码上
大数据·数据库·人工智能·后端·大语言模型
70后写java的老码农4 分钟前
Ollama 大模型私有化部署与彻底卸载指南(Windows/Linux)
人工智能
Wang's Blog6 分钟前
Java 项目实战:交友项目 - 用户体系集成总结
java·开发语言·交友
清如许.7 分钟前
如何评估 AI 智能体(AI Agent)?指标、方法与最佳实践
人工智能
猪八宅百炼成仙8 分钟前
让 AI 帮你清理电脑而不翻车:一个 Windows 体检调优 Skill 的工程化设计
人工智能·windows
宋艳_AI应用开发9 分钟前
五个阶段跑完,它交了一份日期错两年的投资报告——深思熟虑的Agent最危险的地方,是想得太像
人工智能
用户13571539981914 分钟前
凌晨三点,第 4 个反编译窗口
人工智能
学到老活到老14 分钟前
第 24 集:配置文件写了 80,Spring Boot 为什么读到 90?
java·后端·spring