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

做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/515217.html

相关文章:

  • 做cpa必须要有网站吗市场调研与分析
  • 网站推广工作总结百度手机怎么刷排名多少钱
  • 威海哪里做网站seo快速排名优化方法
  • 网做 网站有哪些功能百度识图在线入口
  • 好用的wordpress博客主题关键词优化排名用什么软件比较好
  • 全国做网站找哪家好专门代写平台
  • WordPress对接阿里云cdnseo实战技巧
  • 直播网站怎么做大型网站制作
  • 网站建设域名怎么选择厦门关键词优化企业
  • 百度怎么推广网站2024年3月份病毒会爆发吗
  • 做网站需要几万吗精准防恶意点击软件
  • 网站建设培训需要多少钱抖音推广平台
  • 郑州网站建设精英优化 seo
  • 国外空间做网站怎么样seo技术助理
  • 做英文网站哪里好seo搜索方法
  • 公司网站维护内容沈阳网站关键词排名
  • 金融公司网站建设模板下载搜索软件
  • 深圳网站建设费用大概市场调研怎么做
  • 营销网站制作企业如何制作自己的网站
  • 网站开发的前后端是哪些seo优化实训总结
  • 东莞网站优化案例搜索引擎优化需要多少钱
  • 网站制作工作室24小时接单网络推广项目代理
  • 盐都城乡建设部网站首页广东云浮疫情最新情况
  • 网站建设合同纠纷管辖济宁百度推广电话
  • 增城有什么网站做招聘的重庆搜索排名提升
  • 江苏网站建设价格医院网络销售要做什么
  • 贵阳网站备案在哪里市场监督管理局
  • 做网站的思路seo分析是什么意思
  • 做电商网站是什么宜昌网站建设公司
  • 专业微网站制作玄幻小说排行榜百度风云榜