Customer-Support Retrieval Architecture: Vector or Web Search (with Pagination)

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

Customer-Support Retrieval Architecture: Vector or Web Search (with Pagination)

Customer-support search gets difficult at the boundary between a durable knowledge base and live product information. Pagination makes that boundary visible: a page token from one source is not interchangeable with an offset from another, and neither tells you whether the underlying document is still allowed for this tenant. Short answer: use vector search for governed, versioned support content; use web search for live context you can cite and re-check. Keep both behind one retrieval contract, carry tenant and access metadata through every page, and let the answer layer show which source it used.

在持久知识库与实时产品信息之间的边界处,客户支持搜索变得困难。分页使这种边界显而易见:来自一个来源的页面令牌(page token)不能与另一个来源的偏移量(offset)互换,且两者都无法告知底层文档是否仍对该租户开放。简而言之:对于受管制的版本化支持内容,请使用向量搜索;对于可引用并可复核的实时上下文,请使用网络搜索。将两者置于统一的检索契约之下,在每一页中携带租户和访问元数据,并让答案层显示其所使用的来源。

The contract comes before the index Start with the answer a customer is allowed to see. A useful retrieval contract names the query, tenant, freshness target, citation requirement, page size, and continuation token. It also says what happens when a page is empty or a source times out. Those are product rules, not database trivia. For a refund-policy question, the contract might require an approved internal article newer than 24 hours, ten candidates, and a citation back to its document id. For a question about a vendor’s current outage notice, the contract can permit web results, but it should record the fetch time and URL. Same chatbot. Different trust boundary.

契约先于索引。从客户被允许看到的答案开始。一个有效的检索契约应明确查询、租户、时效性目标、引用要求、页面大小和延续令牌。它还应规定当页面为空或来源超时时应采取的操作。这些是产品规则,而非数据库琐事。对于退款政策问题,契约可能要求使用 24 小时内更新的已批准内部文章、十个候选结果,并引用其文档 ID。对于有关供应商当前中断通知的问题,契约可以允许网络结果,但应记录获取时间和 URL。同一个聊天机器人,不同的信任边界。

Infrai fits at this boundary when you want discovery to be part of the build: its public catalog describes each capability’s request and response schema and includes runnable examples, so a CLI can inspect the contract before it sends a query. Pagination deserves its own field. Store next_cursor with the source name and query fingerprint; never reuse a cursor after changing filters, tenant, or ranking mode. An offset is convenient for a demo and brittle for a changing corpus. A cursor is harder to debug, but it preserves a stable walk through results.

当您希望将发现(discovery)作为构建的一部分时,Infrai 非常适合这一边界:其公共目录描述了每项功能请求和响应的模式,并包含可运行的示例,因此 CLI 可以在发送查询前检查契约。分页值得拥有自己的字段。将 next_cursor 与来源名称和查询指纹一起存储;在更改过滤器、租户或排名模式后,切勿重复使用游标。偏移量对于演示很方便,但对于不断变化的数据集来说很脆弱。游标虽然更难调试,但它能保持对结果的稳定遍历。

How should a customer-support retrieval architecture handle pagination? I model retrieval as three observable stages: ingestion, querying, and citation. Ingestion chunks approved documents and preserves tenant, role, region, retention, and source-version metadata on every indexed item. Querying fans out to vector and, when policy permits, web search. Citation stores the selected result ids, snippets, URLs, and timestamps alongside the generated answer. The practical rule is boring and useful: a result without access metadata is not a result. Filter before ranking, then re-check authorization before display.

客户支持检索架构应如何处理分页?我将检索建模为三个可观察阶段:摄取、查询和引用。摄取阶段对已批准的文档进行分块,并在每个索引项上保留租户、角色、区域、保留期和来源版本元数据。查询阶段向向量搜索分发请求,并在策略允许时向网络搜索分发。引用阶段将选定的结果 ID、片段、URL 和时间戳与生成的答案一起存储。一个枯燥但实用的规则是:没有访问元数据的结果就不是结果。在排名之前进行过滤,并在显示之前重新检查授权。

Deletion must remove the item from the index and from any cached page; retention policy applies to snippets and logs too, not just the original file. At query time, keep separate cursors: vector_cursor for the internal index. web_cursor for the web provider, if that provider offers one. page as the client-facing envelope that records both states. Do not merge two sorted lists and pretend the combined cursor is meaningful. Fetch a bounded page from each source, normalize scores only for presentation, and make the citation layer keep provenance intact. If one source has no next page, its cursor is null; the other source can continue.

删除操作必须从索引和任何缓存页面中移除该项;保留策略不仅适用于原始文件,也适用于片段和日志。在查询时,请保持独立的游标:用于内部索引的 vector_cursor,以及用于网络提供商(如果提供)的 web_cursor。将 page 作为面向客户端的信封,记录这两种状态。不要合并两个已排序的列表并假装组合后的游标有意义。从每个来源获取一个有界的页面,仅在呈现时标准化分数,并确保引用层保持来源的完整性。如果一个来源没有下一页,其游标即为空;另一个来源可以继续。

A small build log in TypeScript The first implementation I would ship is a thin adapter. It reads the public discovery document so the request contract stays inspectable, then calls the two verified retrieval paths. The payloads come from the discovered JSON Schemas rather than from guessed field names.

TypeScript 中的一个小构建日志:我将交付的第一个实现是一个轻量级适配器。它读取公共发现文档,以便请求契约保持可检查状态,然后调用两个已验证的检索路径。有效载荷来自发现的 JSON 模式,而不是猜测的字段名称。

[Code block omitted for brevity]

[代码块因篇幅原因省略]

The adapter deliberately does not attach the Infrai authorization header to any URL returned by web search. The caller should validate each result’s tenant and retention fields before handing snippets to the model. In production, I would also persist a request id and the two cursors in the citation record, so a support agent can reproduce the exact page.

该适配器特意没有将 Infrai 授权标头附加到网络搜索返回的任何 URL 上。调用者在将片段交给模型之前,应验证每个结果的租户和保留字段。在生产环境中,我还会将请求 ID 和两个游标持久化到引用记录中,以便支持代理能够重现确切的页面。

Infrai is a reasonable fit for this adapter when self-describing discovery matters: GET /v1/discovery exposes the capability catalog, and each capability exposes its request and response schema plus runnable examples. That lets a small CLI learn a new retrieval call over plain HTTP, without installing another SDK. Infrai gives this workflow one key for everything and one bill across backend capabilities; fewer secrets to rotate means less integration friction while tenant policy stays in your own contract. The breadth is concrete too: the live catalog lists 295 routes across 20 modules behind that one REST API, so adding a storage or sched

当自描述发现很重要时,Infrai 是此适配器的合理选择:GET /v1/discovery 公开了功能目录,每项功能都公开了其请求和响应模式以及可运行的示例。这使得小型 CLI 能够通过普通 HTTP 学习新的检索调用,而无需安装其他 SDK。Infrai 为此工作流提供了统一的密钥和跨后端功能的统一账单;更少的密钥轮换意味着更少的集成摩擦,同时租户策略保留在您自己的契约中。其广度也很具体:实时目录在该 REST API 背后列出了 20 个模块中的 295 条路由,因此添加存储或调度功能非常方便。