AS AgentScopeAPI 手册 / API Reference

DifyRAGClient

public class DifyRAGClient
源码Source io/agentscope/core/rag/integration/dify/DifyRAGClient.java:57–461

Dify RAG 客户端,封装与远端服务的连接和调用。位于 io.agentscope.core.rag.integration.dify 包。核心成员包括 retrieve、getConfig、DifyRAGClient。

Client for interacting with Dify Knowledge Base API.

This class wraps OkHttp client and provides reactive API methods for knowledge base operations. It handles HTTP request construction, authentication, error handling, and response parsing.

Example usage:

`DifyRAGConfig config = DifyRAGConfig.builder()
.apiKey(...)
.datasetId(...)
.build();

DifyRAGClient client = new DifyRAGClient(config);
DifyResponse response = client.retrieve("query text", 10).block();
`

构造器摘要Constructor Summary

构造器Constructor说明Description
public DifyRAGClient(DifyRAGConfig config)
创建新的DifyRAGClient 实例。
Creates a new DifyRAGClient instance.

方法摘要Method Summary

方法Method说明Description
public Mono<DifyResponse> retrieve(String query, Integer limit)
按查询检索相关文档。
Retrieves relevant documents from the knowledge base.
public DifyRAGConfig getConfig()
获取配置。
Gets the Dify configuration.

构造器详情Constructor Detail

DifyRAGClient

public DifyRAGClient(DifyRAGConfig config)

创建新的DifyRAGClient 实例。

Creates a new DifyRAGClient instance.

参数Parameters
名称Name类型Type说明Description
configDifyRAGConfig配置对象(类型 `DifyRAGConfig`)。the Dify configuration
源码Source io/agentscope/core/rag/integration/dify/DifyRAGClient.java:71–84

方法详情Method Detail

retrieve

public Mono<DifyResponse> retrieve(String query, Integer limit)

按查询检索相关文档。

Retrieves relevant documents from the knowledge base.

参数Parameters
名称Name类型Type说明Description
queryString搜索查询文本。the search query text
limitInteger数量上限(类型 `Integer`)。the maximum number of documents to retrieve (null for default)
返回Returns Mono<DifyResponse>
返回Mono。a Mono emitting the Dify API response
源码Source io/agentscope/core/rag/integration/dify/DifyRAGClient.java:124–274

getConfig

public DifyRAGConfig getConfig()

获取配置。

Gets the Dify configuration.

返回Returns DifyRAGConfig
配置。the configuration
源码Source io/agentscope/core/rag/integration/dify/DifyRAGClient.java:346–348
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.