跳到主要内容

DashScope

DashScope阿里云开发的平台, 提供模型可视化、监控和调试接口,尤其适用于生产环境中的 AI/ML 模型。该平台允许用户可视化性能指标、 追踪模型行为,并在部署周期早期发现潜在问题。

通义千问阿里云开发的一系列生成式 AI 模型, 专为文本生成、摘要、问答及各类 NLP 任务而设计。

更多详情请参阅 DashScope 文档。 LangChain4j 通过 DashScope Java SDK 与 DashScope 集成。

Maven 依赖

备注

1.0.0-alpha1 起,langchain4j-dashscope 已迁移到 langchain4j-community 并重命名为 langchain4j-community-dashscope

1.0.0-alpha1 之前:


<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-dashscope</artifactId>
<version>${previous version here}</version>
</dependency>

1.0.0-alpha1 及以上版本:


<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-community-dashscope</artifactId>
<version>${latest version here}</version>
</dependency>

或使用 BOM 统一管理依赖:


<dependencyManagement>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-community-bom</artifactId>
<version>${latest version here}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencyManagement>

可配置参数

QwenEmbeddingModel 初始化时支持以下参数:

属性描述默认值
baseUrl连接的 URL,可使用 HTTP 或 WebSocket 连接 DashScopehttps://dashscope.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding
apiKeyAPI Key
modelName使用的模型text-embedding-v2

示例