Builder
public static class Builder
io/agentscope/core/rag/integration/haystack/HayStackConfig.java:179–459构建器,用于构建并配置目标实例。位于 io.agentscope.core.rag.integration.haystack 包。核心成员包括 baseUrl、successCode、topK、scaleScore、returnEmbedding、scoreThreshold。
A class in io.agentscope.core.rag.integration.haystack that turns private documents into retrievable knowledge. Declared in io.agentscope.core.rag.integration.haystack.
方法摘要Method Summary
方法详情Method Detail
baseUrl
public Builder baseUrl(String baseUrl)
设置HayStack 基类 URL。
Sets the HayStack base URL.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
baseUrl | String | 基类 URL。the base URL |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:223–226successCode
public Builder successCode(Integer successCode)
设置该配置项。
Sets the HayStack API success code.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
successCode | Integer | 成功 Code(类型 `Integer`)。the success code |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:235–238topK
public Builder topK(Integer topK)
设置该配置项。
The maximum number of documents to return.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
topK | Integer | top K(类型 `Integer`)。the number of chunks to retrieve (must be > 0) |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:247–253scaleScore
public Builder scaleScore(Boolean scaleScore)
设置该配置项。
Whether to scale the scores of the retrieved documents or not - When true, scales the score of retrieved documents to a range of 0 to 1, where 1 means extremely relevant.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
scaleScore | Boolean | scale 分数(类型 `Boolean`)。whether to scale scores |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:264–267returnEmbedding
public Builder returnEmbedding(Boolean returnEmbedding)
设置该配置项。
Whether to return the embedding of the retrieved Documents.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
returnEmbedding | Boolean | return 向量化(类型 `Boolean`)。whether to return embedding |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:275–278scoreThreshold
public Builder scoreThreshold(Double scoreThreshold)
设置分数阈值。
A minimal score threshold for the result.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
scoreThreshold | Double | 分数阈值。the score threshold |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:288–291groupBy
public Builder groupBy(String groupBy)
设置组通过。
Payload field to group by, must be a string or number field.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
groupBy | String | 组通过(类型 `String`)。group name |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:300–303groupSize
public Builder groupSize(Integer groupSize)
设置组大小。
Maximum amount of points to return per group.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
groupSize | Integer | 组大小(类型 `Integer`)。group size |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:313–316queryEmbedding
public Builder queryEmbedding(List<Float> queryEmbedding)
设置查询向量化。
Use vector retrieval from the vector store.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
queryEmbedding | List<Float> | 查询向量化(类型 `List`)。queryEmbedding |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:325–328querySparseEmbedding
public Builder querySparseEmbedding(SparseEmbedding querySparseEmbedding)
设置该配置项。
Sparse Embedding of the query.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
querySparseEmbedding | SparseEmbedding | 查询 Sparse 向量化(类型 `SparseEmbedding`)。SparseEmbedding |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:336–339documents
public Builder documents(List<HayStackDocument> documents)
设置文档。
Performs the documents operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
documents | List<HayStackDocument> | 文档列表(类型 `List`)。The documents. |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:341–344retrievedDocuments
public Builder retrievedDocuments(List<HayStackDocument> retrievedDocuments)
设置该配置项。
The documents must include metadata indicating their origin and position: - source_id is used to group sentence chunks belonging to the same original document.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
retrievedDocuments | List<HayStackDocument> | 文档。the documents |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:354–357windowSize
public Builder windowSize(Integer windowSize)
设置该配置项。
The number of adjacent documents to include on each side of the retrieved document can be configured using the window_size parameter.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
windowSize | Integer | window 大小(类型 `Integer`)。the window size |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:365–368filters
public Builder filters(Map<String, Object> filters)
设置该配置项。
A dictionary with filters to narrow down the retriever's search space in the document store.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
filters | Map<String, Object> | filters(类型 `Map`)。the filters |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:376–379filterPolicy
public Builder filterPolicy(FilterPolicy filterPolicy)
设置过滤策略。
Policy to determine how filters are applied in retrievers interacting with document stores.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
filterPolicy | FilterPolicy | 过滤策略(类型 `FilterPolicy`)。FilterPolicy.REPLACE or FilterPolicy.MERGE |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:387–390timeout
public Builder timeout(Duration timeout)
设置HTTP 超时。
Sets the HTTP timeout.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
timeout | Duration | 超时时长。the timeout duration |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:400–403maxRetries
public Builder maxRetries(Integer maxRetries)
设置最大重试。
Sets the maximum number of retries for failed requests.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
maxRetries | Integer | 最大重试(>=0)。the max retries (>= 0) |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:413–419customHeaders
public Builder customHeaders(Map<String, String> customHeaders)
设置自定义 HTTP 请求头。
Sets custom HTTP headers.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
customHeaders | Map<String, String> | 自定义请求头映射。the custom headers map |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:427–430addCustomHeader
public Builder addCustomHeader(String key, String value)
添加自定义请求头。
Adds a custom HTTP header.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 请求头名称。the header name |
value | String | 请求头值。the header value |
Builderio/agentscope/core/rag/integration/haystack/HayStackConfig.java:439–442build
public HayStackConfig build()
构建HayStackConfig 实例。
Builds the HayStackConfig instance.
HayStackConfigIllegalArgumentException可能抛出 `IllegalArgumentException`。if the required `baseUrl` parameter is missing or blank
io/agentscope/core/rag/integration/haystack/HayStackConfig.java:452–458