SpringAI1.0

介绍

Spring AI 是一个面向人工智能工程的应用框架。解决了 AI 集成的基本挑战:将企业数据和API与AI 模型连接起来。

特性:

提示词工程

可以说是大模型应用中最简单也是最核心的一个技术。他是我们更大模型交互的媒介,提示词给的好大模型才能按你想要的方式响应。

对话拦截advisors

面向切面的思想对对模型对话和响应进行增强。

对话记忆
java 复制代码
@Autowired
ChatMemoryRepository chatMemoryRepository;

通过一个bean组件就可以让大模型拥有对话记忆功能,可谓是做到了开箱即用

tools

让大模型可以跟企业业务API进行互联 ,这一块实现起来也是非常的优雅

java 复制代码
class DateTimeTools {

    @Tool(description = "Get the current date and time in the user's timezone")
    String getCurrentDateTime() {
        return LocalDateTime.now().atZone(LocaleContextHolder.getTimeZone().toZoneId()).toString();
    }

}
RAG技术下的 ETL

让大模型可以跟企业业务数据进行互联(包括读取文件、分隔文件、向量化) 向量数据库支持 目前支持20+种向量数据库的集成

MCP

让tools外部化,形成公共工具让外部开箱即用。 原来MCP协议的JAVA SDK就是spring ai团队提供的 提供了MCP 客户端、服务端、以及MCP认证授权方案 ,还有目前正在孵化的Spring MCP Agent 开源项目:

模型的评估

可以测试大模型的幻觉反应

可观察性

它把AI运行时的大量关键指标暴露出来, 可以提供Spring Boot actuctor进行观测

agent应用

springai 提供了5种agent模式的示例

  1. Evaluator Optimizer -- The model analyzes its own responses and refines them through a structured process of self-evaluation.

  2. Routing -- This pattern enables intelligent routing of inputs to specialized handlers based on classification of the user request and context.

  3. Orchestrator Workers -- This pattern is a flexible approach for handling complex tasks that require dynamic task decomposition and specialized processing

  4. Chaining -- The pattern decomposes complex tasks into a sequence of steps, where each LLM call processes the output of the previous one.

  5. Parallelization -- The pattern is useful for scenarios requiring parallel execution of LLM calls with automated output aggregation.

langchain4j vs springAI

大模型选型

  1. 自研(算法 c++ python 深度学习 机器学习 神经网络 视觉处理 952 211研究生 )AI算法岗位
  2. 云端大模型 占用算力 token计费 功能完善成熟
  3. 开源的大模型(本地部署)Ollama 购买算力
    a. 选型
    b. 自己构建选型-->评估流程
    ⅰ. 业务确定:( 电商、医疗、教育 )
    ⅱ. 样本准备:数据集样本 选择题
    ⅲ. 任务定制:问答 (利用多个大模型)
    ⅳ. 评估: 人工评估
    c. 通用能力毕竟好的
    ⅰ. 2月份 deepseek 6710亿 671b = 算力 显存 H20 96G 140万 ; 比 openai gpt4节省了40/1 成本。
    ⅱ. 3月份 阿里 qwq-32b(不带深度思考) 32b=320亿 媲美deepseek-r1 32G 比deepseek-r1节省20/1
    ⅲ. 4月份 阿里 qwen3 (深度思考) 2350亿=235b 赶超了deepseek-r1 比deepseek-r1节省2-3倍 选择(qwen3-30b)
    ⅳ. 5月 deepseek-r1-0528 6710亿 671b 性能都要要
  4. 对成本有要求: 选择(qwen3-30b)
  5. 不差钱 deepseek-r1-0528 满血版本
相关推荐
小蠢驴打代码1 小时前
记忆库能通过测试,不等于回答值得信:Coding Agent Memory 的两层评估设计
github·ai编程
喂你一颗橘子糖1 小时前
我用 Codex 跑长任务:快照、Loop 和单线写入,解决三个失控问题
ai编程
李剑一2 小时前
瑞幸也AI上了?我用AI命令行帮我点了一杯咖啡,但是我花了不止一杯咖啡钱
aigc·openai·ai编程
leoZ2312 小时前
记忆系统与 Agent 定制完全指南(六):Agent 编排与调度
ai编程
Ai拆代码的曹操2 小时前
opencode CLI 源码拆解:yargs + effectCmd 双层架构如何管理 20+ 子命令
架构·ai编程·opencode·源码拆解
AINative软件工程3 小时前
LLM 应用的熔断降级工程实践:Circuit Breaker 不只是重试的升级版
后端·llm·ai编程
倔强的石头_11 小时前
不想每次都从头解释:我用 Doubao-Seed-Evolving 做了一个「稿件接力站」
ai编程
大模型码小白13 小时前
【Python零基础教程】继承、多态与魔法函数:面向对象编程三大核心特性详解
java·大数据·开发语言·人工智能·python·ai编程
-XWB-14 小时前
【LLM】Agent Planning 完全指南:8 种纯 LLM 范式 + 8 种混合规划模式详解(二)
人工智能·经验分享·aigc·学习方法·ai编程
沉默王二15 小时前
腾讯一面,我霸气反问:“你说你们在做Agent项目,说说 SubAgent、Plan 模式、Skill 调用这些你们都是怎么做的?”面试官一直在擦汗。。
面试·agent·ai编程