AS AgentScopeAPI 手册 / API Reference

HayStackClient

public class HayStackClient
源码Source io/agentscope/core/rag/integration/haystack/HayStackClient.java:54–369

Hay 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
configHayStackConfig配置对象(类型 `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
queryString查询文本(必填)。the query text (required)
topKIntegertop K(类型 `Integer`)。the number of documents to retrieve (optional, defaults to config value)
scoreThresholdDouble分数阈值(类型 `Double`)。The score threshold.
返回Returns Mono<HayStackResponse>
返回Mono。a Mono emitting the retrieval response
源码Source io/agentscope/core/rag/integration/haystack/HayStackClient.java:129–257
基于官方固定版本源码静态生成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.