AS AgentScopeAPI 手册 / API Reference

DifyRAGConfig

public class DifyRAGConfig
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:45–578

Dify RAG 配置,保存相关配置项。位于 io.agentscope.core.rag.integration.dify 包。核心成员包括 getApiKey、getApiBaseUrl、getDatasetId、getRetrievalMode、getTopK、getScoreThreshold。

Configuration for Dify Knowledge Base integration.

This class contains all necessary configuration parameters to connect to and interact with Dify Knowledge Base service, including connection settings, retrieval parameters, and HTTP client settings.

Example usage:

`DifyRAGConfig config = DifyRAGConfig.builder()
.apiKey(System.getenv("DIFY_RAG_API_KEY"))
.datasetId("your-dataset-id") // Configure in code
.apiBaseUrl("https://api.dify.ai/v1") // Optional, for self-hosted
.retrievalMode(RetrievalMode.HYBRID_SEARCH)
.topK(10)
.scoreThreshold(0.5)
.enableRerank(true)
.rerankConfig(RerankConfig.builder()
.topN(5)
.build())
.build();
`

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
DifyRAGConfig的构建器。
Builder for DifyRAGConfig.

方法摘要Method Summary

方法Method说明Description
public String getApiKey()
获取API 键。
Gets the Dify API key.
public String getApiBaseUrl()
获取API 基类 URL。
Gets the Dify API base URL.
public String getDatasetId()
获取 `getDatasetId`。
Gets the dataset (knowledge base) ID.
public RetrievalMode getRetrievalMode()
获取检索模式。
Gets the retrieval mode.
public Integer getTopK()
获取 `getTopK`。
Gets the top K value for retrieval.
public Double getScoreThreshold()
获取分数阈值。
Gets the score threshold for filtering results.
public Boolean getEnableRerank()
获取启用重排。
Checks if reranking is enabled.
public RerankConfig getRerankConfig()
获取重排配置。
Gets the rerank configuration.
public Double getWeights()
获取 `getWeights`。
Gets the hybrid search weights.
public MetadataFilter getMetadataFilter()
获取元数据过滤配置。
Gets the metadata filter configuration.
public Duration getConnectTimeout()
获取HTTP 连接超时。
Gets the HTTP connection timeout.
public Duration getReadTimeout()
获取HTTP 读取超时。
Gets the HTTP read timeout.
public Integer getMaxRetries()
获取最大重试。
Gets the maximum number of retries for failed requests.
public Map<String, String> getCustomHeaders()
获取自定义 HTTP 请求头。
Gets custom HTTP headers.
public static Builder builder()
static
创建新的构建器用于 DifyRAGConfig。
Creates a new builder for DifyRAGConfig.
public String toString()
返回 `toString` 结果。
Returns the to string.

方法详情Method Detail

getApiKey

public String getApiKey()

获取API 键。

Gets the Dify API key.

返回Returns String
API 密钥。the API key
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:135–137

getApiBaseUrl

public String getApiBaseUrl()

获取API 基类 URL。

Gets the Dify API base URL.

返回Returns String
基类 URL。the base URL
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:144–146

getDatasetId

public String getDatasetId()

获取 getDatasetId。

Gets the dataset (knowledge base) ID.

返回Returns String
返回字符串结果。the dataset ID
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:153–155

getRetrievalMode

public RetrievalMode getRetrievalMode()

获取检索模式。

Gets the retrieval mode.

返回Returns RetrievalMode
检索模式。the retrieval mode
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:162–164

getTopK

public Integer getTopK()

获取 getTopK。

Gets the top K value for retrieval.

返回Returns Integer
返回数值结果。the top K value (1-100)
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:171–173

getScoreThreshold

public Double getScoreThreshold()

获取分数阈值。

Gets the score threshold for filtering results.

返回Returns Double
分数阈值(0.0-1.0)。the score threshold (0.0-1.0)
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:180–182

getEnableRerank

public Boolean getEnableRerank()

获取启用重排。

Checks if reranking is enabled.

返回Returns Boolean
返回布尔值,表示判断结果。true if reranking is enabled, null if not configured
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:189–191

getRerankConfig

public RerankConfig getRerankConfig()

获取重排配置。

Gets the rerank configuration.

返回Returns RerankConfig
返回RerankConfig。the rerank config, or null if not set
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:198–200

getWeights

public Double getWeights()

获取 getWeights。

Gets the hybrid search weights.

返回Returns Double
返回数值结果。the weights value (0-1), or null if not set
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:210–212

getMetadataFilter

public MetadataFilter getMetadataFilter()

获取元数据过滤配置。

Gets the metadata filter configuration.

返回Returns MetadataFilter
返回MetadataFilter。the metadata filter, or null if not set
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:219–221

getConnectTimeout

public Duration getConnectTimeout()

获取HTTP 连接超时。

Gets the HTTP connection timeout.

返回Returns Duration
连接超时。the connection timeout
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:228–230

getReadTimeout

public Duration getReadTimeout()

获取HTTP 读取超时。

Gets the HTTP read timeout.

返回Returns Duration
读取超时。the read timeout
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:237–239

getMaxRetries

public Integer getMaxRetries()

获取最大重试。

Gets the maximum number of retries for failed requests.

返回Returns Integer
最大重试。the max retries
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:246–248

getCustomHeaders

public Map<String, String> getCustomHeaders()

获取自定义 HTTP 请求头。

Gets custom HTTP headers.

返回Returns Map<String, String>
返回映射。a copy of custom headers map
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:255–257

builder

public static Builder builder()
static

创建新的构建器用于 DifyRAGConfig。

Creates a new builder for DifyRAGConfig.

返回Returns Builder
一种新的构建器实例。a new Builder instance
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:264–266

toString

public String toString()

返回 toString 结果。

Returns the to string.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:547–577

嵌套类详情Nested Class Detail

Builder

public static class Builder

DifyRAGConfig的构建器。位于 io.agentscope.core.rag.integration.dify 包。核心成员包括 apiKey、apiBaseUrl、datasetId、retrievalMode、topK、scoreThreshold。

Builder for DifyRAGConfig.

基于官方固定版本源码静态生成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.