首页 文章 精选 留言 我的

精选列表

搜索[es 2],共10000篇文章
优秀的个人博客,低调大师

基于 Java 的 LLM 应用开发框架,Agents-Flex beta.2 发布

Agents-Flex: 一个基于 Java 的 LLM(大语言模型)应用开发框架。 基本能力 LLM 的访问能力 Prompt、Prompt Template 定义加载的能力 Function Calling 定义、调用和执行等能力 记忆的能力(Memory) Embedding Vector Store 文档处理 加载器(Loader) Http FileSystem 分割器(Splitter) 解析器(Parser) PoiParser PdfBoxParser Agent LLM Agent IOAgent Chain 执行链 SequentialChain 顺序执行链 ParallelChain 并发(并行)执行链 LoopChain 循环执行连 ChainNode AgentNode Agent 执行节点 EndNode 终点节点 RouterNode 路由节点 GroovyRouterNode Groovy 规则路由 QLExpressRouterNode QLExpress 规则路由 LLMRouterNode LLM路由(由 AI 自行判断路由规则) 简单对话 使用 OpenAi 大语言模型: @Test public void testChat() { OpenAiLlmConfig config = new OpenAiLlmConfig(); config.setApiKey("sk-rts5NF6n*******"); Llm llm = new OpenAiLlm(config); String response = llm.chat("请问你叫什么名字"); System.out.println(response); } 使用 “通义千问” 大语言模型: @Test public void testChat() { QwenLlmConfig config = new QwenLlmConfig(); config.setApiKey("sk-28a6be3236****"); config.setModel("qwen-turbo"); Llm llm = new QwenLlm(config); String response = llm.chat("请问你叫什么名字"); System.out.println(response); } 使用 “讯飞星火” 大语言模型: @Test public void testChat() { SparkLlmConfig config = new SparkLlmConfig(); config.setAppId("****"); config.setApiKey("****"); config.setApiSecret("****"); Llm llm = new SparkLlm(config); String response = llm.chat("请问你叫什么名字"); System.out.println(response); } 历史对话示例 public static void main(String[] args) { SparkLlmConfig config = new SparkLlmConfig(); config.setAppId("****"); config.setApiKey("****"); config.setApiSecret("****"); Llm llm = new SparkLlm(config); HistoriesPrompt prompt = new HistoriesPrompt(); System.out.println("您想问什么?"); Scanner scanner = new Scanner(System.in); String userInput = scanner.nextLine(); while (userInput != null) { prompt.addMessage(new HumanMessage(userInput)); llm.chatStream(prompt, (context, response) -> { System.out.println(">>>> " + response.getMessage().getContent()); }); userInput = scanner.nextLine(); } } Function Calling 第一步: 通过注解定义本地方法 public class WeatherUtil { @FunctionDef(name = "get_the_weather_info", description = "get the weather info") public static String getWeatherInfo( @FunctionParam(name = "city", description = "the city name") String name ) { //在这里,我们应该通过第三方接口调用 api 信息 return name + "的天气是阴转多云。 "; } } 第二步: 通过 Prompt、Functions 传入给大模型,然后得到结果 public static void main(String[] args) { OpenAiLlmConfig config = new OpenAiLlmConfig(); config.setApiKey("sk-rts5NF6n*******"); OpenAiLlm llm = new OpenAiLlm(config); FunctionPrompt prompt = new FunctionPrompt("今天北京的天气怎么样", WeatherUtil.class); FunctionResultResponse response = llm.chat(prompt); Object result = response.invoke(); System.out.println(result); //"北京的天气是阴转多云。 " } 模块构成 开源地址​: Gitee:https://gitee.com/agents-flex/agents-flex Github:https://github.com/agents-flex/agents-flex 官方网站:https://agentsflex.com

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

用户登录
用户注册
修改密码
忘记密码