AS AgentScopeAPI 手册 / API Reference

Builder

public static class Builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:302–723

构建器,用于构建并配置目标实例。位于 io.agentscope.core.rag.integration.ragflow 包。核心成员包括 apiKey、baseUrl、datasetIds、addDatasetId、documentIds、addDocumentId。

A class in io.agentscope.core.rag.integration.ragflow that turns private documents into retrievable knowledge. Declared in io.agentscope.core.rag.integration.ragflow.

方法摘要Method Summary

方法Method说明Description
public Builder apiKey(String apiKey)
设置RAGFlow API 密钥。
Sets the RAGFlow API key.
public Builder baseUrl(String baseUrl)
设置RAGFlow 基类 URL。
Sets the RAGFlow base URL.
public Builder datasetIds(List<String> datasetIds)
设置该配置项。
Sets the dataset IDs (replaces existing list).
public Builder addDatasetId(String datasetId)
添加 `addDatasetId`。
Adds a single dataset ID to the list.
public Builder documentIds(List<String> documentIds)
设置文档 IDs 到过滤检索(可选)。
Sets the document IDs to filter retrieval (optional).
public Builder addDocumentId(String documentId)
添加文档标识。
Adds a single document ID to the filter list.
public Builder topK(Integer topK)
设置该配置项。
Sets the top K value for retrieval.
public Builder similarityThreshold(Double similarityThreshold)
设置该配置项。
Sets the similarity threshold.
public Builder vectorSimilarityWeight(Double vectorSimilarityWeight)
设置该配置项。
Sets the vector similarity weight.
public Builder page(Integer page)
设置页码。
Sets the page number for pagination.
public Builder pageSize(Integer pageSize)
设置页码大小。
Sets the page size for pagination.
public Builder useKg(Boolean useKg)
设置使用 Kg。
Sets whether to use knowledge graph for multi-hop queries.
public Builder tocEnhance(Boolean tocEnhance)
设置该配置项。
Sets whether to use TOC (Table of Contents) enhancement.
public Builder rerankId(String rerankId)
设置重排模型标识。
Sets the rerank model ID.
public Builder rerankId(Integer rerankId)
deprecated
设置重排标识。
Sets the rerank model ID from a numeric value.
public Builder keyword(Boolean keyword)
设置该配置项。
Sets whether to enable keyword-based matching.
public Builder highlight(Boolean highlight)
设置该配置项。
Sets whether to enable highlighting of matched terms in results.
public Builder crossLanguages(List<String> crossLanguages)
设置该配置项。
Sets the languages for cross-language retrieval.
public Builder addCrossLanguage(String language)
添加 `addCrossLanguage`。
Adds a language for cross-language retrieval.
public Builder metadataCondition(Map<String, Object> metadataCondition)
设置该配置项。
Sets the metadata filtering condition.
public Builder timeout(Duration timeout)
设置HTTP 超时。
Sets the HTTP timeout.
public Builder maxRetries(Integer maxRetries)
设置最大重试。
Sets the maximum number of retries for failed requests.
public Builder customHeaders(Map<String, String> customHeaders)
设置自定义 HTTP 请求头。
Sets custom HTTP headers.
public Builder addCustomHeader(String key, String value)
添加自定义请求头。
Adds a custom HTTP header.
public RAGFlowConfig build()
构建RAGFlowConfig 实例。
Builds the RAGFlowConfig instance.

方法详情Method Detail

apiKey

public Builder apiKey(String apiKey)

设置RAGFlow API 密钥。

Sets the RAGFlow API key.

参数Parameters
名称Name类型Type说明Description
apiKeyStringAPI 密钥(必填)。the API key (required)
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:348–351

baseUrl

public Builder baseUrl(String baseUrl)

设置RAGFlow 基类 URL。

Sets the RAGFlow base URL.

参数Parameters
名称Name类型Type说明Description
baseUrlString基类 URL。the base URL
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:361–364

datasetIds

public Builder datasetIds(List<String> datasetIds)

设置该配置项。

Sets the dataset IDs (replaces existing list).

参数Parameters
名称Name类型Type说明Description
datasetIdsList<String>dataset Ids(类型 `List`)。the list of dataset IDs (required, at least one)
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:375–378

addDatasetId

public Builder addDatasetId(String datasetId)

添加 addDatasetId。

Adds a single dataset ID to the list.

参数Parameters
名称Name类型Type说明Description
datasetIdStringdataset 标识(类型 `String`)。the dataset ID to add
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:386–389

documentIds

public Builder documentIds(List<String> documentIds)

设置文档 IDs 到过滤检索(可选)。

Sets the document IDs to filter retrieval (optional).

参数Parameters
名称Name类型Type说明Description
documentIdsList<String>文档 IDs的列出。the list of document IDs
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:399–402

addDocumentId

public Builder addDocumentId(String documentId)

添加文档标识。

Adds a single document ID to the filter list.

参数Parameters
名称Name类型Type说明Description
documentIdString文档标识到添加。the document ID to add
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:410–416

topK

public Builder topK(Integer topK)

设置该配置项。

Sets the top K value for retrieval.

参数Parameters
名称Name类型Type说明Description
topKIntegertop K(类型 `Integer`)。the number of chunks to retrieve (must be > 0)
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:426–432

similarityThreshold

public Builder similarityThreshold(Double similarityThreshold)

设置该配置项。

Sets the similarity threshold.

参数Parameters
名称Name类型Type说明Description
similarityThresholdDoublesimilarity 阈值(类型 `Double`)。the similarity threshold (0.0-1.0)
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:444–452

vectorSimilarityWeight

public Builder vectorSimilarityWeight(Double vectorSimilarityWeight)

设置该配置项。

Sets the vector similarity weight.

参数Parameters
名称Name类型Type说明Description
vectorSimilarityWeightDouble权重(0.0-1.0)。the weight (0.0-1.0)
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:465–473

page

public Builder page(Integer page)

设置页码。

Sets the page number for pagination.

参数Parameters
名称Name类型Type说明Description
pageInteger页码数量(>=1)。the page number (>= 1)
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:483–489

pageSize

public Builder pageSize(Integer pageSize)

设置页码大小。

Sets the page size for pagination.

参数Parameters
名称Name类型Type说明Description
pageSizeInteger页码大小(>=1)。the page size (>= 1)
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:499–505

useKg

public Builder useKg(Boolean useKg)

设置使用 Kg。

Sets whether to use knowledge graph for multi-hop queries.

参数Parameters
名称Name类型Type说明Description
useKgBoolean使用 Kg(类型 `Boolean`)。true to enable knowledge graph
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:518–521

tocEnhance

public Builder tocEnhance(Boolean tocEnhance)

设置该配置项。

Sets whether to use TOC (Table of Contents) enhancement.

参数Parameters
名称Name类型Type说明Description
tocEnhanceBooleantoc Enhance(类型 `Boolean`)。true to enable TOC enhancement
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:534–537

rerankId

public Builder rerankId(String rerankId)

设置重排模型标识。

Sets the rerank model ID.

参数Parameters
名称Name类型Type说明Description
rerankIdString重排模型标识。the rerank model ID
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:549–552

rerankId

public Builder rerankId(Integer rerankId)
deprecated

设置重排标识。

Sets the rerank model ID from a numeric value.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。RAGFlow identifies rerank models by name, not by a numeric id, so no `Integer` maps to a real model and the retrieval request is rejected. Use `#rerankId(String)` instead. This overload only keeps existing call sites compiling and stringifies the value.
参数Parameters
名称Name类型Type说明Description
rerankIdInteger重排模型标识。the rerank model ID
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:564–568

keyword

public Builder keyword(Boolean keyword)

设置该配置项。

Sets whether to enable keyword-based matching.

参数Parameters
名称Name类型Type说明Description
keywordBooleankeyword(类型 `Boolean`)。true to enable keyword matching
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:578–581

highlight

public Builder highlight(Boolean highlight)

设置该配置项。

Sets whether to enable highlighting of matched terms in results.

参数Parameters
名称Name类型Type说明Description
highlightBooleanhighlight(类型 `Boolean`)。true to enable highlighting
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:591–594

crossLanguages

public Builder crossLanguages(List<String> crossLanguages)

设置该配置项。

Sets the languages for cross-language retrieval.

参数Parameters
名称Name类型Type说明Description
crossLanguagesList<String>cross Languages(类型 `List`)。the list of target languages
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:605–608

addCrossLanguage

public Builder addCrossLanguage(String language)

添加 addCrossLanguage。

Adds a language for cross-language retrieval.

参数Parameters
名称Name类型Type说明Description
languageStringlanguage(类型 `String`)。the target language to add
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:616–622

metadataCondition

public Builder metadataCondition(Map<String, Object> metadataCondition)

设置该配置项。

Sets the metadata filtering condition.

参数Parameters
名称Name类型Type说明Description
metadataConditionMap<String, Object>元数据 Condition(类型 `Map`)。the metadata condition map
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:639–643

timeout

public Builder timeout(Duration timeout)

设置HTTP 超时。

Sets the HTTP timeout.

参数Parameters
名称Name类型Type说明Description
timeoutDuration超时时长。the timeout duration
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:653–656

maxRetries

public Builder maxRetries(Integer maxRetries)

设置最大重试。

Sets the maximum number of retries for failed requests.

参数Parameters
名称Name类型Type说明Description
maxRetriesInteger最大重试(>=0)。the max retries (>= 0)
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:666–672

customHeaders

public Builder customHeaders(Map<String, String> customHeaders)

设置自定义 HTTP 请求头。

Sets custom HTTP headers.

参数Parameters
名称Name类型Type说明Description
customHeadersMap<String, String>自定义请求头映射。the custom headers map
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:680–683

addCustomHeader

public Builder addCustomHeader(String key, String value)

添加自定义请求头。

Adds a custom HTTP header.

参数Parameters
名称Name类型Type说明Description
keyString请求头名称。the header name
valueString请求头值。the header value
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:692–695

build

public RAGFlowConfig build()

构建RAGFlowConfig 实例。

Builds the RAGFlowConfig instance.

返回Returns RAGFlowConfig
一种新的RAGFlowConfig 实例。a new RAGFlowConfig instance
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if required parameters are missing
源码Source io/agentscope/core/rag/integration/ragflow/RAGFlowConfig.java:707–722
基于官方固定版本源码静态生成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.