当前位置: 首页 > wzjs >正文

做SEO公司多给网站淘宝关键词查询工具

做SEO公司多给网站,淘宝关键词查询工具,中山seo代理商,建设部网站事故快报文章目录 1.准备工作2.引入maven依赖3.application.yml4.调用4.1.非流式调用4.2.流式调用 阿里云百炼推出的智能体应用、工作流应用和智能体编排应用,有效解决了大模型在处理私有领域问题、获取最新信息、遵循固定流程以及自动规划复杂项目等方面的局限,…

文章目录

    • 1.准备工作
    • 2.引入maven依赖
    • 3.application.yml
    • 4.调用
      • 4.1.非流式调用
      • 4.2.流式调用

阿里云百炼推出的智能体应用工作流应用智能体编排应用,有效解决了大模型在处理私有领域问题、获取最新信息、遵循固定流程以及自动规划复杂项目等方面的局限,显著拓展了其应用范围。

Spring AI Alibaba框架

1.准备工作

  1. 登录阿里百炼平台,新建一个appkey,然后创建一个智能体应用,获取一个appId
  2. 开发环境:JDK17+、SpringBoot3.x+

2.引入maven依赖

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.2.8</version></parent><groupId>com.linging</groupId><artifactId>spring-ai-alibaba</artifactId><version>1.0-SNAPSHOT</version><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>com.alibaba.cloud.ai</groupId><artifactId>spring-ai-alibaba-starter</artifactId><version>1.0.0-M5.1</version></dependency></dependencies></project>

3.application.yml

spring:ai:dashscope:agent:app-id: xxxx # 大模型应用ID,需要在平台发布(创建时会指定使用的模型)api-key: xxxx # 百炼API Keyworkspace-id: xxxx # 业务空间ID,可选,未配置时使用主账号空间

4.调用

4.1.非流式调用

/*** 非流式调用*/
@RestController
@RequestMapping("/ai")
public class BailianAgentRagController {private static final Logger logger = LoggerFactory.getLogger(BailianAgentRagController.class);private DashScopeAgent agent;@Value("${spring.ai.dashscope.agent.app-id:xxx}")private String appId;public BailianAgentRagController(DashScopeAgentApi dashscopeAgentApi) {this.agent = new DashScopeAgent(dashscopeAgentApi);}@GetMapping("/bailian/agent/call")public String call(@RequestParam(value = "message",defaultValue = "如何使用SDK快速调用阿里云百炼的应用?") String message) {ChatResponse response = agent.call(new Prompt(message, DashScopeAgentOptions.builder().withAppId(appId).build()));if (response == null || response.getResult() == null) {logger.error("chat response is null");return "chat response is null";}AssistantMessage app_output = response.getResult().getOutput();return app_output.getContent();}
}

4.2.流式调用

/*** 流式调用*/
@RestController
@RequestMapping("/ai")
public class BailianAgentRagStreamController {private static final Logger logger = LoggerFactory.getLogger(BailianAgentRagStreamController.class);private DashScopeAgent agent;@Value("${spring.ai.dashscope.agent.app-id:xxx}")private String appId;public BailianAgentRagStreamController(DashScopeAgentApi dashscopeAgentApi) {this.agent = new DashScopeAgent(dashscopeAgentApi,DashScopeAgentOptions.builder().withSessionId("current_session_id").withIncrementalOutput(true).withHasThoughts(true).build());}@GetMapping(value="/bailian/agent/stream", produces="text/event-stream;charset=utf-8")public Flux<String> stream(@RequestParam(value = "message",defaultValue = "你好,请问你的知识库文档主要是关于什么内容的?") String message, HttpServletResponse re) {re.setContentType("text/event-stream;charset=utf-8");return agent.stream(new Prompt(message, DashScopeAgentOptions.builder().withAppId(appId).build())).map(response -> {if (response == null || response.getResult() == null) {logger.error("chat response is null");return "chat response is null";}AssistantMessage app_output = response.getResult().getOutput();String content = app_output.getContent();return content;});}@GetMapping(value="/bailian/agent/stream/html", produces="text/html;charset=utf-8")public Flux<String> streamHtml(@RequestParam(value = "message",defaultValue = "你好,请问你的知识库文档主要是关于什么内容的?") String message) {return agent.stream(new Prompt(message, DashScopeAgentOptions.builder().withAppId(appId).build())).map(response -> {if (response == null || response.getResult() == null) {logger.error("chat response is null");return "chat response is null";}AssistantMessage app_output = response.getResult().getOutput();String content = app_output.getContent();return content;});}
}
http://www.dtcms.com/wzjs/388742.html

相关文章:

  • 环保类网站建设网站域名ip查询
  • 建筑行业综合查询平台中山网站seo优化
  • java开发门户网站新媒体运营哪个培训机构好
  • 婚嫁网站设计最新新闻热点话题
  • WordPress短码生成器宁波企业seo推广
  • 网站网页设计怎么收费互动营销的概念
  • 网站开发合同书网络营销师有前途吗
  • 信息咨询公司网站源码怎么做市场营销和推广
  • 郑州设计网站公司营销公司排行
  • 哪个建设网站公司好搜盘 资源网
  • 企业网站搭建的优点百度网盘服务电话6988
  • 荣成做网站的公司站内推广的方法
  • 深圳网站模板百度云盘登录入口
  • 现在网站开发用什么seo综合查询站长工具关键词
  • ssh鲜花礼品网站建设挖掘关键词的工具
  • 宣传做传单的网站郑州seo顾问阿亮
  • 小学的门户网站建设网络推广员上班靠谱吗
  • 可以找题目做的网站百度统计收费吗
  • 杭州做服装电商拿货的网站各种手艺培训班
  • 网站系统管理功能沈阳今天刚刚发生的新闻
  • 广东两学一做考试网站济南网站建设哪家便宜
  • 东北网站建设公司上海十大营销策划公司
  • 网站开发流程宜春免费seo关键词优化方案
  • 建设银行网站查询密码设置武汉网站建设公司
  • 可做影视网站的服务器熊猫关键词工具
  • 广东网站建设费用推广平台排行榜app
  • 绵阳做网站的有哪些西安高端网站建设
  • 什么项目必须走辽宁建设工程信息网东莞seo外包公司哪家好
  • 成都网站建设熊掌号如何引流被动加好友微信
  • 怎么样建立网站方案国际重大新闻