Class RAGFlowConfig
This class holds the configuration for connecting to RAGFlow service, including authentication, endpoint, and retrieval parameters.
API Reference: This configuration is designed to work with RAGFlow's retrieval API:
POST /api/v1/retrieval
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic RAGFlowConfig.Builderbuilder()Gets the list of languages for cross-language retrieval.Gets the dataset IDs.Gets the document IDs to filter retrieval.Gets whether highlighting of matched terms is enabled.Gets whether keyword-based matching is enabled.Gets the metadata filtering conditions.getPage()Gets the page number for pagination.Gets the page size for pagination.Gets the rerank model ID.Gets the similarity threshold for filtering results.Gets whether to use TOC (Table of Contents) enhancement.getTopK()Gets the top K value for retrieval.getUseKg()Gets whether to use knowledge graph for multi-hop queries.Gets the vector similarity weight.
-
Method Details
-
builder
-
getApiKey
-
getBaseUrl
-
getDatasetIds
Gets the dataset IDs.These IDs are used in the API request body:
"dataset_ids": ["id1", "id2"]- Returns:
- the list of dataset IDs
-
getDocumentIds
Gets the document IDs to filter retrieval.Optional: If specified, only search within these documents.
- Returns:
- the list of document IDs, or null if not set
-
getTopK
Gets the top K value for retrieval.Default value: 5 (as per RAGFlow API documentation)
- Returns:
- the top K value
-
getSimilarityThreshold
Gets the similarity threshold for filtering results.Default value: 0.2 (as per RAGFlow API documentation)
- Returns:
- the similarity threshold (0.0-1.0)
-
getVectorSimilarityWeight
Gets the vector similarity weight.The weight of vector cosine similarity. If x represents the weight, then (1 - x) is the term similarity weight.
Default value: 0.3
- Returns:
- the vector similarity weight (0.0-1.0)
-
getPage
Gets the page number for pagination.Default value: 1
- Returns:
- the page number
-
getPageSize
Gets the page size for pagination.Default value: 30
- Returns:
- the page size
-
getUseKg
Gets whether to use knowledge graph for multi-hop queries.Default value: false
- Returns:
- true if knowledge graph is enabled
-
getTocEnhance
Gets whether to use TOC (Table of Contents) enhancement.Default value: false
- Returns:
- true if TOC enhancement is enabled
-
getRerankId
Gets the rerank model ID.RAGFlow identifies rerank models by name, e.g.
"BAAI/bge-reranker-v2-m3@BAAI"or a hex UUID, so this is aStringrather than a numeric id.- Returns:
- the rerank model ID, or null if not set
-
getKeyword
Gets whether keyword-based matching is enabled.Default value: false
- Returns:
- true if keyword matching is enabled
-
getHighlight
Gets whether highlighting of matched terms is enabled.Default value: false
- Returns:
- true if highlighting is enabled
-
getCrossLanguages
Gets the list of languages for cross-language retrieval.- Returns:
- the list of target languages, or null if not set
-
getMetadataCondition
Gets the metadata filtering conditions.This is used to filter chunks based on their metadata fields. For example:
Map<String, Object> condition = Map.of( "author", "John", "category", "tech" );- Returns:
- the metadata condition map, or null if not set
-
getTimeout
-
getMaxRetries
-
getCustomHeaders
-