DifyRAGConfig
public class DifyRAGConfig
io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:45–578Dify 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.
Stringio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:135–137getApiBaseUrl
public String getApiBaseUrl()
获取API 基类 URL。
Gets the Dify API base URL.
Stringio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:144–146getDatasetId
public String getDatasetId()
获取 getDatasetId。
Gets the dataset (knowledge base) ID.
Stringio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:153–155getRetrievalMode
public RetrievalMode getRetrievalMode()
获取检索模式。
Gets the retrieval mode.
RetrievalModeio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:162–164getTopK
public Integer getTopK()
获取 getTopK。
Gets the top K value for retrieval.
Integerio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:171–173getScoreThreshold
public Double getScoreThreshold()
获取分数阈值。
Gets the score threshold for filtering results.
Doubleio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:180–182getEnableRerank
public Boolean getEnableRerank()
获取启用重排。
Checks if reranking is enabled.
Booleanio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:189–191getRerankConfig
public RerankConfig getRerankConfig()
获取重排配置。
Gets the rerank configuration.
RerankConfigio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:198–200getWeights
public Double getWeights()
获取 getWeights。
Gets the hybrid search weights.
Doubleio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:210–212getMetadataFilter
public MetadataFilter getMetadataFilter()
获取元数据过滤配置。
Gets the metadata filter configuration.
MetadataFilterio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:219–221getConnectTimeout
public Duration getConnectTimeout()
获取HTTP 连接超时。
Gets the HTTP connection timeout.
Durationio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:228–230getReadTimeout
public Duration getReadTimeout()
获取HTTP 读取超时。
Gets the HTTP read timeout.
Durationio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:237–239getMaxRetries
public Integer getMaxRetries()
获取最大重试。
Gets the maximum number of retries for failed requests.
Integerio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:246–248getCustomHeaders
public Map<String, String> getCustomHeaders()
获取自定义 HTTP 请求头。
Gets custom HTTP headers.
Map<String, String>io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:255–257builder
public static Builder builder()
创建新的构建器用于 DifyRAGConfig。
Creates a new builder for DifyRAGConfig.
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:264–266toString
public String toString()
返回 toString 结果。
Returns the to string.
Stringio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:547–577嵌套类详情Nested Class Detail
Builder
public static class BuilderDifyRAGConfig的构建器。位于 io.agentscope.core.rag.integration.dify 包。核心成员包括 apiKey、apiBaseUrl、datasetId、retrievalMode、topK、scoreThreshold。
Builder for DifyRAGConfig.