HayStackClient
public class HayStackClient
源码Source
io/agentscope/core/rag/integration/haystack/HayStackClient.java:54–369Hay Stack 客户端,封装与远端服务的连接和调用。位于 io.agentscope.core.rag.integration.haystack 包。核心成员包括 retrieve、HayStackClient。
Client for interacting with HayStack Knowledge Base API.
This class wraps OkHttp client and provides reactive API methods for knowledge base operations. It handles HTTP request construction, error handling, and response parsing.
Example usage:
`HayStackConfig config = HayStackConfig.builder()
.baseUrl(...)
.topK(...)
.build();
HayStackClient client = new HayStackClient(config);
HayStackResponse response = client.retrieve("query text", 10).block();
`
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public HayStackClient(HayStackConfig config) | 初始化 `HayStackClient` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Mono<HayStackResponse> retrieve(String query, Integer topK, Double scoreThreshold) | 按查询检索相关文档。 Retrieve documents from HayStack knowledge base. |
构造器详情Constructor Detail
HayStackClient
public HayStackClient(HayStackConfig config)
初始化 HayStackClient 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
config | HayStackConfig | 配置对象(类型 `HayStackConfig`)。The config. |
源码Source
io/agentscope/core/rag/integration/haystack/HayStackClient.java:64–67方法详情Method Detail
retrieve
public Mono<HayStackResponse> retrieve(String query, Integer topK, Double scoreThreshold)
按查询检索相关文档。
Retrieve documents from HayStack knowledge base.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
query | String | 查询文本(必填)。the query text (required) |
topK | Integer | top K(类型 `Integer`)。the number of documents to retrieve (optional, defaults to config value) |
scoreThreshold | Double | 分数阈值(类型 `Double`)。The score threshold. |
Mono<HayStackResponse>返回Mono。a Mono emitting the retrieval response
源码Source
io/agentscope/core/rag/integration/haystack/HayStackClient.java:129–257