微网站 pc网站同步辽阳制作网站
2026/1/26 10:36:53 网站建设 项目流程
微网站 pc网站同步,辽阳制作网站,南京的网站建设公司,百度网站做防水补漏使用前介绍 我们以 Alibaba 的百炼平台作为Spring-AI的模型讲解#xff0c;以最新稳定版作为架构。 spring-ai 的最新版本 1.1.2 #xff1b;alibaba-spring-ai 的最新版本 1.1.0.0-RC1。 需要注意一点#xff1a;最新版本的 Spring Boot 4.0.0 不能适配#xff0c;需要…使用前介绍我们以 Alibaba 的百炼平台作为Spring-AI的模型讲解以最新稳定版作为架构。spring-ai 的最新版本 1.1.2 alibaba-spring-ai 的最新版本 1.1.0.0-RC1。需要注意一点最新版本的 Spring Boot 4.0.0 不能适配需要降低版本到 3.5.8。流式输出 使得输出更流程快捷提升用户体验ChatClient 把各个大模型的ChatModel统一接口化使得代码中不需要依赖底层的具体模型注意 1若项目中只有一个模型则Spring-AI 为自动装配上这个模型​ 2若项目中有两个以上模型则要明确指明是装配哪个模型。代码部分项目依赖与配置略上一篇有介绍Java 代码packagecom.yiyi.coding.spring.ai;importcom.alibaba.cloud.ai.dashscope.chat.DashScopeChatModel;importorg.junit.jupiter.api.Test;importorg.springframework.ai.chat.client.ChatClient;importorg.springframework.beans.factory.annotation.Autowired;importorg.springframework.boot.test.context.SpringBootTest;SpringBootTestpublicclassDashScopeTest{TestpublicvoidtestChatModel(AutowiredDashScopeChatModeldashScopeChatModel){System.out.println(dashScopeChatModel.call(你是谁));}/** * 流式打印输出 FluxString */TestpublicvoidtestChatModelStream(AutowiredDashScopeChatModeldashScopeChatModel){dashScopeChatModel.stream(你是谁).toStream().forEach(System.out::println);}TestpublicvoidtestChatClient(AutowiredChatClient.BuilderchatClientBuilder){ChatClientchatClientchatClientBuilder.build();chatClient.prompt(你是谁).stream().content().toStream().forEach(System.out::println);}/** * 装配具体的模型 */TestpublicvoidtestChatClient2(AutowiredDashScopeChatModeldashScopeChatModel){ChatClientchatClientChatClient.builder(dashScopeChatModel).build();chatClient.prompt(你是谁).stream().content().toStream().forEach(System.out::println);}}运行后输出的其中一段内容采用的是流式输出我是 通义千 问 由 阿里云研发的超大规模 语言模型。我可以生成 各种类型的文本如文章 、故事、诗歌、故事 等并能够根据不同的 场景和需求进行变换和 扩展。此外我还能够 回答各种问题提供帮助 和解决方案。我 被设计用来协助 用户撰写故事、诗歌 、公文 提供信息查询 编程等能够 支持多种语言满足 国际化的使用需求。很高兴 为您服务

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询