Add an off-by-default glossary match to `knowledge.search`

オープン
#1,764 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
clickhouse, python

調査の方向性

Start with server/memory/app/search/term_leg.py, server/memory/domain/definitions.py, and server/memory/domain/definition_check.py to understand governed name matching, then inspect the lexical leg in server/knowledge/api/models_knowledge.py. The issue defines five acceptance cases, but leaves a broad design and rollout evidence open. Done means the optional behavior meets those cases, preserves the context budget, and has the paired comparison and latency evidence described.

索引モデルが issue の本文から書いたものです。

説明

enhancement
Company

ClickHouse

Component

Knowledge (documents)

Use case

In #1457 a team asks for the rule for an active account using an internal abbreviation. The authoritative definition uses the full term, and another team uses the same abbreviation for a different metric. That issue specifies the comparison against hybrid document search and its fixture, and leaves the mechanism open.

A comparison needs a defined treatment. memory.search already serves a governed definition when the query names its term or an alias. knowledge.search has no such step, so a query that uses only the abbreviation finds a passage only where the source text happens to contain it.

Describe the solution you'd like

An option on knowledge.search, off by default, as the treatment #1457 measures. This is a proposal; nothing is implemented or measured.

  • Match. The query runs through the exact name matching memory.search has for governed definitions. It adds no model call and no table.
  • Expand. A named definition adds lexical candidates for its other names. Passages that enter only this way take at most a fixed share of top_k and never displace a direct match. The context budget is unchanged.
  • Ambiguity. When more than one scope, within the caller's access and the reply's audience, defines the matched alias differently, the reply returns the alternatives and expands nothing. The request names the scopes compared, because the existing match reads the addressed namespace only.
  • Receipt. The reply carries the definition's key, version and content hash, and marks each passage that entered through an added name.
  • Nothing stored. No retrieval hint is kept, so a demotion, a revoked grant or an erasure needs no cleanup path: each search reads the definitions as they are then. The existing match reads without sequential consistency, so a promotion on another replica a moment earlier can miss one search.
  • The definition is navigation evidence. An answer still needs a current, authorized source passage, as #1457 requires.

What Loom has that this builds on:

  • server/memory/app/search/term_leg.py matches a query against governed names within a work budget.
  • server/memory/domain/definitions.py folds and compares names; server/memory/domain/definition_check.py decides which definitions are governed.
  • The lexical leg of knowledge.search (server/knowledge/api/models_knowledge.py) takes the added candidates.

Acceptance fixture, the four cases #1457 names plus one:

  1. An alias absent from the source text returns the required passage with the option on and not with it off.
  2. An alias two scopes define differently returns both alternatives and expands nothing.
  3. After a definition is promoted again with a changed alias list, a search that reads the new promotion uses the new revision only.
  4. A query with no glossary term returns the baseline's hit list, unchanged.
  5. After a demotion or a revoked grant no passage is marked.

Evidence still needed before rollout:

  • The comparison #1457 specifies, on the same fixture and context budget, as a paired result with an interval. Proposed rule: widen exposure only if the lower bound of the recall gain is above zero and wrong-source matches do not rise.
  • Wrong-source matches from a short alias that is also a common word.
  • p95 latency with the added candidates.
  • Whether memory_shared_definitions_max caps a glossary of the size a team maintains.
Describe alternatives you've considered
  • Put the glossary in the reader's prompt. That spends the context budget on every query and ignores scope.
  • Ask a model which glossary entries the query uses. That adds a model call to each search, and #1457 asks for exact matches.
  • Keep a separate glossary table for documents. That is a second copy of the governed definitions with its own review and erasure path.
Where the need comes from

An AI tool suggested this feature

Additional context

Found by source review; no search was run and no comparison was made.

Related: Proposed as part of #1457. Roadmap: #1232.

主要言語
Python
スター
263
フォーク
47
平均マージ
14時間 21分
マージ済み PR(30日)
873

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ClickHouse/loom のほかの issue

ClickHouse/loom の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。