赞
踩
最近大模型是相当的火,尤其是在自然语言处理(NLP)、图像识别、语音识别等领域的应用,那对于工程同学来说应该如何接住这波破天的富贵呢?
想啥来啥,前段时间LangChain给我们整了一套钢铁战甲,让我们轻松奴架Javis。
LangChain是一个强大的框架,旨在帮助开发人员使用语言模型构建端到端的应用程序。它提供了一套工具、组件和接口,可简化创建由大型语言模型 (LLM) 和聊天模型提供支持的应用程序的过程。
LangChain 可以轻松管理与语言模型的交互,将多个组件链接在一起,并集成额外的资源。但是LangChain是python开发的,对我等java开发来说不太方便。
哎…,spring最近推出了其AI项目,解了java同学的燃眉之急,来,一起看下spring是如何玩转AI的。
Spring AI是一个用于AI工程的应用程序框架。它的目标是将AI领域的Spring生态系统设计原则(如可移植性和模块化设计)应用到AI领域,并推动使用POJO作为应用程序的构建块。
spring-ai提供了对跨AI提供商的Chat、文本到图像和嵌入式模型的可移植API支持。支持同步和流API选项。还支持降级访问特定于模型的功能。
现在正式版本是0.8.1
Vector Store API 提供了跨不同提供商的可移植性,具有一种新颖的类似 SQL 的元数据过滤 API,保持可移植性。
<dependencies>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-bom</artifactId>
<version>0.8.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
import org.springframework.ai.chat.ChatClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.Map; @RestController public class SimpleAiController { private final ChatClient chatClient; @Autowired public SimpleAiController(ChatClient chatClient) { this.chatClient = chatClient; } @GetMapping("/ai/simple") public Map<String, String> completion(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) { return Map.of("generation", chatClient.call(message)); } }
Very simple
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。