Builder
public static class Builder
io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:271–545DifyRAGConfig的构建器。位于 io.agentscope.core.rag.integration.dify 包。核心成员包括 apiKey、apiBaseUrl、datasetId、retrievalMode、topK、scoreThreshold。
Builder for DifyRAGConfig.
方法摘要Method Summary
方法详情Method Detail
apiKey
public Builder apiKey(String apiKey)
设置API 键。
Sets the Dify API key.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
apiKey | String | API 键(类型 `String`)。the API key (format: dataset-xxxxxxxxxxxxxxxx) |
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:310–313apiBaseUrl
public Builder apiBaseUrl(String apiBaseUrl)
设置API 基类 URL。
Sets the Dify API base URL.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
apiBaseUrl | String | API 基类 URL(类型 `String`)。the API base URL (must include /v1 suffix) |
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:326–329datasetId
public Builder datasetId(String datasetId)
设置该配置项。
Sets the dataset (knowledge base) ID.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
datasetId | String | dataset 标识(类型 `String`)。the dataset ID |
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:340–343retrievalMode
public Builder retrievalMode(RetrievalMode retrievalMode)
设置检索模式。
Sets the retrieval mode.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
retrievalMode | RetrievalMode | 检索模式。the retrieval mode |
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:361–364topK
public Builder topK(Integer topK)
设置该配置项。
Sets the top K value for retrieval.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
topK | Integer | top K(类型 `Integer`)。the top K value |
BuilderIllegalArgumentException可能抛出 `IllegalArgumentException`。if topK is not in valid range
io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:376–382scoreThreshold
public Builder scoreThreshold(Double scoreThreshold)
设置分数阈值。
Sets the score threshold for filtering results.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
scoreThreshold | Double | 分数阈值。the score threshold |
BuilderIllegalArgumentException可能抛出 `IllegalArgumentException`。if scoreThreshold is not in valid range
io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:394–400enableRerank
public Builder enableRerank(Boolean enableRerank)
启用重排。
Sets whether to enable reranking.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
enableRerank | Boolean | 启用重排(类型 `Boolean`)。true to enable reranking |
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:413–416rerankConfig
public Builder rerankConfig(RerankConfig rerankConfig)
设置重排配置。
Sets the rerank configuration.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
rerankConfig | RerankConfig | 重排配置。the rerank configuration |
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:426–429weights
public Builder weights(Double weights)
设置该配置项。
Sets the hybrid search weights.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
weights | Double | weights(类型 `Double`)。the weights value |
BuilderIllegalArgumentException可能抛出 `IllegalArgumentException`。if weights is not in valid range
io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:444–450metadataFilter
public Builder metadataFilter(MetadataFilter metadataFilter)
设置元数据过滤配置。
Sets the metadata filter configuration.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
metadataFilter | MetadataFilter | 元数据过滤配置。the metadata filter configuration |
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:460–463connectTimeout
public Builder connectTimeout(Duration connectTimeout)
设置HTTP 连接超时。
Sets the HTTP connection timeout.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
connectTimeout | Duration | 连接超时。the connection timeout |
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:473–476readTimeout
public Builder readTimeout(Duration readTimeout)
设置HTTP 读取超时。
Sets the HTTP read timeout.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
readTimeout | Duration | 读取超时。the read timeout |
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:486–489maxRetries
public Builder maxRetries(Integer maxRetries)
设置最大重试。
Sets the maximum number of retries for failed requests.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
maxRetries | Integer | 最大重试(0=无重试)。the max retries (0 = no retry) |
BuilderIllegalArgumentException可能抛出 `IllegalArgumentException`。if maxRetries is negative
io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:500–506customHeaders
public Builder customHeaders(Map<String, String> customHeaders)
设置自定义请求头。
Sets custom HTTP headers to include in all requests.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
customHeaders | Map<String, String> | 请求头名称到值的映射。map of header name to value |
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:516–519addCustomHeader
public Builder addCustomHeader(String name, String value)
添加自定义请求头。
Adds a single custom HTTP header.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 请求头名称。the header name |
value | String | 请求头值。the header value |
Builderio/agentscope/core/rag/integration/dify/DifyRAGConfig.java:528–534build
public DifyRAGConfig build()
构建新的DifyRAGConfig 实例。
Builds a new DifyRAGConfig instance.
DifyRAGConfigIllegalArgumentException可能抛出 `IllegalArgumentException`。if required parameters are missing or invalid
io/agentscope/core/rag/integration/dify/DifyRAGConfig.java:542–544