EmbedXrpc V5.0.0 已经发布,用于单片机场景的“gRPC”
EmbedXrpc V5.0.0 已经发布,用于单片机场景的“gRPC” 此版本更新内容包括大版本,重大变更: 1.移植Free RTOS的message buffer/queue到WIN32 和裸机 2.重构RunTime配置,减小很多无用内存 详情查看:https://gitee.com/snikeguo/EmbedXrpc/releases/V5.0.0
使用 OpenAi 大语言模型:
public static void main(String[] args) throws InterruptedException { OpenAiConfig config = new OpenAiConfig(); config.setApiKey("sk-rts5NF6n*******"); Llm llm = new OpenAiLlm(config); Prompt prompt = new SimplePrompt("请写一个关于小兔子战胜大灰狼的故事。"); llm.chat(prompt, (llmInstance, message) -> { System.out.println("--->" + message.getContent()); }); Thread.sleep(10000); }
使用 “通义千问” 大语言模型:
public static void main(String[] args) throws InterruptedException { QwenLlmConfig config = new QwenLlmConfig(); config.setApiKey("sk-28a6be3236****"); config.setModel("qwen-turbo"); Llm llm = new QwenLlm(config); Prompt prompt = new SimplePrompt("请写一个关于小兔子战胜大灰狼的故事。"); llm.chat(prompt, (llmInstance, message) -> { System.out.println("--->" + message.getContent()); }); Thread.sleep(10000); }
使用 “讯飞星火” 大语言模型:
public static void main(String[] args) throws InterruptedException { SparkLlmConfig config = new SparkLlmConfig(); config.setAppId("****"); config.setApiKey("****"); config.setApiSecret("****"); Llm llm = new SparkLlm(config); Prompt prompt = new SimplePrompt("请写一个关于小兔子战胜大灰狼的故事。"); llm.chat(prompt, (llmInstance, message) -> { System.out.println("--->" + message.getContent()); }); Thread.sleep(10000); }
public static void main(String[] args) throws InterruptedException { SparkLlmConfig config = new SparkLlmConfig(); config.setAppId("****"); config.setApiKey("****"); config.setApiSecret("****"); // 创建一个大模型 Llm llm = new SparkLlm(config); //创建一个历史对话的 prompt 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.chat(prompt, (instance, message) -> { System.out.println(">>>> " + message.getContent()); }); //继续等待用户从控制台输入内容 userInput = scanner.nextLine(); } }
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 ) { //这里应该是通过接口去调用获得天气信息 return name + "的天气是阴转多云。 "; } }
public static void main(String[] args) throws InterruptedException { OpenAiLlmConfig config = new OpenAiLlmConfig(); config.setApiKey("sk-rts5NF6n*******"); OpenAiLlm llm = new OpenAiLlm(config); Functions<String> functions = Functions.from(WeatherUtil.class, String.class); String result = llm.call(new SimplePrompt("今天的天气如何"), functions); System.out.println(result); // "北京的天气是阴转多云。 "; Thread.sleep(10000); }
注意:当前版本为 v1.0.0-alpha.2 ,还在开发中,请暂时勿使用于正式的商业产品中。
微信关注我们
转载内容版权归作者及来源网站所有!
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。
为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。
Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。
Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。