Skip to content

Commit 1c8472c

Browse files
committed
docs(service-knowledge): changeset and knowledge-rag hit shape for the declared metadata values
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
1 parent c6cdc71 commit 1c8472c

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/service-knowledge': patch
3+
---
4+
5+
feat(service-knowledge): a `search_knowledge` hit carries the values of its source's `metadataFields`
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: none
9+
10+
Each `search_knowledge` hit of an indexed record gains `metadata`: the values, keyed by field name, of the fields its knowledge source lists in `metadataFields` now, read from the metadata the index already stores with the passage. A hit of a clause therefore names its policy (or status, or owning unit) directly, and the model no longer needs a `query_records` round on the clause ids to find the parent record.
11+
12+
- Only fields the source lists now are answered: a key the index still stores for a field the source no longer lists is not.
13+
- A listed field whose stored value is absent or `null` is left out; a hit with no such value carries no `metadata` member. A file or web source's hit carries none.
14+
- No new argument and no live record read. Source admission (ADR-0161 K8, `admitSourceFields`) already requires every listed `metadataFields` member to be queryable by the caller before the source is searched, so no value the caller could not query is served.
15+
- `groupValue` under `groupBy` is unchanged. The tool's description now tells the model that a hit carries these values.

‎content/docs/ai/knowledge-rag.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ An AI client searches through one tool, `search_knowledge`, defined once by the
206206
| `groupBy` | One hit per value of a field the source lists in `metadataFields`, such as `policy`: "which policies", not "which clauses". Implies `"record"`; refused with `"chunk"`. A source of indexed records that does not list the field answers nothing for that call; a file or web source still answers, one hit per document, with no `groupValue`. |
207207
| `scope` | Only inside these records: a list of `{ object, ids }`, as `KnowledgeSearchOptions.scope` reads it above. At most 10 entries of at most 500 ids. |
208208

209-
Each hit carries `sourceId`, `documentId`, `title`, `snippet`, `score`, and for an indexed record `record: { object, id }`, which the record tools read. It also carries `headingPath`, the headings its passage sits under, where the document has headings, and under `groupBy` the group's value as `groupValue`: the value as the index stores it (a string, a number, or a list for a multi-value lookup), absent on a hit of a file or web source. The answer also lists the searchable `sources`, and in `refused` any source that could not be searched.
209+
Each hit carries `sourceId`, `documentId`, `title`, `snippet`, `score`, and for an indexed record `record: { object, id }`, which the record tools read. It also carries `headingPath`, the headings its passage sits under, where the document has headings, and under `groupBy` the group's value as `groupValue`: the value as the index stores it (a string, a number, or a list for a multi-value lookup), absent on a hit of a file or web source. A hit of an indexed record carries `metadata` too: the values of the fields its source lists in `metadataFields` now, by field name, as the index stores them (a stored field the source no longer lists, and a null value, are left out), so a clause's hit names its policy without a record read. Source admission has already required the caller to be able to query every one of those fields before the source is searched. The answer also lists the searchable `sources`, and in `refused` any source that could not be searched.
210210

211211
The tool is stricter than the service in a few places, so that a mistake is reported instead of being answered as "nothing matched":
212212

0 commit comments

Comments
 (0)