接入其他大模型

大模型排行榜

https://superclueai.com

LangChain4j 支持接入的大模型

https://docs.langchain4j.dev/integrations/language-models/

**1.**接入阿里百炼平台

1.1****申请免费体验

https://cn.aliyun.com/

创建系统变量

1.2****添加依赖

参考文档:https://docs.langchain4j.dev/integrations/language-models/dashscope#plain-java

|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| XML <dependencies> *<!--*接入阿里云百炼平台 --> <dependency> <groupId>dev.langchain4j</groupId> <artifactId>langchain4j-community-dashscope-spring-boot-starter</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> *<!--*引入百炼依赖管理清单--> <dependency> <groupId>dev.langchain4j</groupId> <artifactId>langchain4j-community-bom</artifactId> <version>${langchain4j.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> |

1.3****配置模型参数

在properties文件中不需要再配置baseUrl的值,因为在依赖中已经导入

|----------------------------------------------------------------------------------------------------------------------------------------------|
| YAML langchain4j.community.dashscope.chat-model.api-key=${DASH_SCOPE_API_KEY} langchain4j.community.dashscope.chat-model.model-name=qwen-max |

1.4****测试

|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| TypeScript @Autowired private QwenChatModel qwenChatModel; @Test public void testDashScopeQwen() { String answer = qwenChatModel.chat("你是谁?"); System.out .println(answer); } |

遇到的问题:

Cannot resolve method 'chat' in 'QwenChatModel'

解决方案:

将<langchain4j.version>修改为<langchain4j.version>1.1.0-beta7</langchain4j.version>

相关推荐
AOwhisky8 小时前
Redis 学习笔记(第一期):概述、安装配置与核心理论
运维·数据库·redis·笔记·学习·云计算
ytttr8738 小时前
C# 定时数据库备份工具
开发语言·数据库·c#
睡不醒男孩0308238 小时前
自建 Prometheus+Grafana 与 CLUP 深度监控 PG 集群有什么区别?
数据库·oracle
AOwhisky8 小时前
Redis 学习笔记(第四期):高可用与集群(哨兵 + Cluster + 容器化)
linux·运维·数据库·redis·笔记·学习·缓存
猫猫聚会Ing8 小时前
数据库设计 Prompt 提示词 - 构建与迭代
数据库
上海云盾-小余8 小时前
源站隐藏实战:规避裸 IP 被直接攻击的完整方案
数据库·网络协议·tcp/ip
微学AI9 小时前
时序大模型 TimechoAI 赋能工业时序数据底层技术优势与实操
数据库·大模型·时序大模型
北顾笙98010 小时前
MYSQL-day03
数据库·sql·mysql
MXsoft61810 小时前
**混合云统一监控实践:私有云+公有云的一体化运维方案**
运维·网络·数据库
MXsoft61810 小时前
**断网续传与本地缓存:弱网环境下的监控数据保障方案**
运维·缓存·自动化