首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >SpringAI-RC1正式发布:移除千帆大模型!

SpringAI-RC1正式发布:移除千帆大模型!

作者头像
磊哥
发布2025-05-17 09:46:20
发布2025-05-17 09:46:20
36200
代码可运行
举报
文章被收录于专栏:王磊的博客王磊的博客
运行总次数:0
代码可运行

续 Spring AI M8 版本之后(5.1 发布),前几日 Spring AI 悄悄的发布了最新版 Spring AI 1.0.0 RC1(5.13 发布),此版本也将是 GA(Generally Available,正式版)发布前的最后一个版本,正式版计划在 5.20 日发布

这个版本的改动相比于上一个版本 M8 来说,改动不算很大,但也有一些让我们意想不到的版本更新,接下来一起来看。

移除千帆大模型 SDK

和国内开发者关系比较大的一个更新就是 Spring AI RC1 移除了百度的千帆大模型,给出的原因是中国境外无法访问,所以被移除了,官方文档中千帆的对接文档也被删除了,变成这个样子了:

这样一来,Spring AI 直接对接国内的大模型就剩下 DeepSeek 和智普 AI 这两家公司了

国内的阿里的百炼平台也没有直接提供 SDK 对接,算是比较遗憾的,因为国内使用通义大模型的公司是非常多的,并且百炼平台内置了 200+ 家大模型,对接百炼相当于对接了 200+ 大模型。当然我们可以使用 OpenAI 协议接入它,但这就意味着,我们在这个项目中不能同时在接入 OpenAI 大模型了,希望后期官方能提供百炼平台的 SDK 对接方式。

其他重要更新

VectorStoreChatMemoryAdvisor 更新:

  • 常量 CHAT_MEMORY_RETRIEVE_SIZE_KEY 被重命名为 TOP_K。
  • 常量 DEFAULT_CHAT_MEMORY_RESPONSE_SIZE 被重命名为 DEFAULT_TOP_K,并且其默认值从 100 调成为 20。

常量 CHAT_MEMORY_CONVERSATION_ID_KEY 被重命名为 CONVERSATION_ID,并从 AbstractChatMemoryAdvisor 移动到 ChatMemory。请更新您的导入以使用 org.springframework.ai.chat.memory.ChatMemory.CONVERSATION_ID。

问答中增加了自包含模版,例如:

QuestionAnswerAdvisor 具有以下占位符:

  • query 用于接收用户问题的占位符。
  • 用于接收检索到的上下文的占位符 question_answer_context。 使用示例如下:
代码语言:javascript
代码运行次数:0
运行
复制
PromptTemplate customPromptTemplate = PromptTemplate.builder()
    .renderer(StTemplateRenderer.builder().startDelimiterToken('<').endDelimiterToken('>').build())
    .template("""
            <query>

            Context information is below.

            ---------------------
            <question_answer_context>
            ---------------------

            Given the context information and no prior knowledge, answer the query.

            Follow these rules:

            1. If the answer is not in the context, just say that you don't know.
            2. Avoid statements like "Based on the context..." or "The provided information...".
            """)
    .build();

    String question = "Where does the adventure of Anacletus and Birba take place?";

    QuestionAnswerAdvisor qaAdvisor = QuestionAnswerAdvisor.builder(vectorStore)
        .promptTemplate(customPromptTemplate)
        .build();

    String response = ChatClient.builder(chatModel).build()
        .prompt(question)
        .advisors(qaAdvisor)
        .call()
        .content();

PromptChatMemoryAdvisor 具有以下占位符:

  • instructions 接收原始系统消息的占位符。
  • memory用于接收检索到的对话记忆的占位符。

VectorStoreChatMemoryAdvisor 具有以下占位符:

  • instructions 接收原始系统消息的占位符。
  • long_term_memory 用于接收检索到的对话记忆的占位符。

组件重命名:

  • spring-ai-model-chat-memory- → spring-ai-model-chat-memory-repository-
  • spring-ai-autoconfigure-model-chat-memory- → spring-ai-autoconfigure-model-chat-memory-repository-
  • spring-ai-starter-model-chat-memory- → spring-ai-starter-model-chat-memory-repository-
  • org.springframework.ai.chat.memory.jdbc → org.springframework.ai.chat.memory.repository.jdbc
  • JdbcChatMemoryAutoConfiguration → JdbcChatMemoryRepositoryAutoConfiguration
  • spring.ai.chat.memory.… → spring.ai.chat.memory.repository.…

其他升级请查看官方更新日志:https://docs.spring.io/spring-ai/reference/upgrade-notes.html#upgrading-to-1-0-0-RC1

小结

AI 发展速度很快,对各行各业的影响也很大。充分了解和掌握 AI 知识,对日常工作提效或以后跳槽都有很大的帮助,让我们一起行动起来,拥抱这场 AI 盛宴吧。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2025-05-16,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 移除千帆大模型 SDK
  • 其他重要更新
  • 小结
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档