Skip to content

Commit c645c31

Browse files
committed
fix(knowledge): re-translate the minChars help text, name platform-objects in the changeset, exact heading-path wording
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mCvGQKiCEBneFwp1j
1 parent 9aeceaa commit c645c31

7 files changed

Lines changed: 11 additions & 9 deletions

File tree

‎.changeset/38351-markdown-fitting-section.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
'@objectstack/service-knowledge': minor
33
'@objectstack/spec': minor
4+
'@objectstack/platform-objects': minor
45
---
56

67
feat(service-knowledge): under the `markdown` split, a section that fits is one passage
@@ -11,7 +12,7 @@ Skills-docs: follow-up owed — skills/objectstack-ai/SKILL.md
1112

1213
On `split.strategy: 'markdown'`, a section was cut as `recursive` cuts, and its pieces were merged only while the merged piece stayed shorter than `minChars` (default 200). A section that fit `maxChars` but held several paragraphs of 200 characters or more was therefore cut into several passages, so a search hit only part of an article.
1314

14-
Now a section whose text, together with the heading path it is given, fits the effective `maxChars` and the embedder's token budget is one passage, whatever `minChars` is (`minChars: 0` included). Only a section that does not fit is cut as before, with `minChars` merging its short pieces; such a section gives exactly the passages it gave before. The text before the first heading, and a heading's text before its first sub-heading, are sections and follow the same rule. `recursive` and `whole` are unchanged. The `@objectstack/spec` docblocks, the `minChars` description and the knowledge source form's help text now say this; no key, value or default changes.
15+
Now a section whose text, together with the heading path it is given, fits the effective `maxChars` and the embedder's token budget is one passage, whatever `minChars` is (`minChars: 0` included). Only a section that does not fit is cut as before, with `minChars` merging its short pieces; such a section gives exactly the passages it gave before. The text before the first heading, and a heading's text before its first sub-heading, are sections and follow the same rule. `recursive` and `whole` are unchanged. The `@objectstack/spec` docblocks, the `minChars` description and the knowledge source form's help text now say this, and the Setup bundles in `@objectstack/platform-objects` carry the new help text (regenerated for en, re-translated for zh-CN, ja-JP and es-ES); no key, value or default changes.
1516

1617
Which passages change: on `markdown` sources only, the passages of sections that fit but were cut. Each such section becomes one passage, so a table and its note inside a fitting section are always one passage.
1718

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ source: {
255255
```
256256

257257
- `recursive` (the default) cuts at blank lines, then line breaks, then sentence ends, then semicolons, then characters. It reads Chinese and English sentence ends — 「3.2 条」 and 「400.50 元」 stay whole — and never cuts inside a Markdown table or list item that fits.
258-
- `markdown` cuts one section per heading; each passage begins with its heading path, which is embedded with it. A section that fits in one passage (its text with its heading path, within the length below) is one passage; only a section that does not fit is cut as `recursive` cuts, and `minChars` (default 200) merges the short pieces of that cut.
258+
- `markdown` cuts one section per heading; each passage begins with its heading path, which is embedded with it. A section that fits in one passage (its text together with the heading path it is given, within the length below) is one passage; only a section that does not fit is cut as `recursive` cuts, and `minChars` (default 200) merges the short pieces of that cut.
259259
- `whole` keeps each document as one passage.
260260

261261
A passage is at most `split.maxChars` characters — else the **Knowledge → Target chunk size** setting, else 800 — and, when the adapter reports its embedder's input limit, within 80% of that limit by the shared token estimate below. A `whole` document over that budget is **removed from the index and reported** (`failed` and `failures` on the reindex result, an `error` log on the event sync), never truncated; because the estimate runs high, a `whole` document can use about 60% of the model's limit. The full rules are in [the protocol's split section](/docs/protocol/knowledge#35-the-split).

‎content/docs/protocol/knowledge.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ split: {
573573
|----------|-------------|
574574
| `whole` | One passage per document. |
575575
| `recursive` (the default) | At blank lines, then line breaks, then sentence ends, then semicolons, then characters — each next level only for a piece still too long. A Markdown table or list item is one unit while it fits; a table that does not fit is cut between rows, each piece repeating the header row. Adjacent pieces are merged while the merged piece is shorter than `minChars`; a short title block leads the text after it. |
576-
| `markdown` | One section per heading (a `#` inside a code fence is no heading); the text before the first heading, and a heading's text before its first sub-heading, are sections too. Every passage begins with its heading path (`Policy > Transport > Air`), which counts toward its length and is embedded with it, and carries it as `headingPath`. A section that fits — its text with its heading path, within the effective `maxChars` and the token budget — is **one passage, whatever `minChars` is**; only a section that does not fit is cut as `recursive` cuts, its pieces merged up to `minChars`. A heading with no text of its own is named by the path of the section after it when it is that section's ancestor, and is a passage of its own otherwise. |
576+
| `markdown` | One section per heading (a `#` inside a code fence is no heading); the text before the first heading, and a heading's text before its first sub-heading, are sections too. Every passage begins with its heading path (`Policy > Transport > Air`), which counts toward its length and is embedded with it, and carries it as `headingPath`. A section that fits — its text together with the heading path it is given (the whole path, or the innermost heading when the whole path is too long), within the effective `maxChars` and the token budget — is **one passage, whatever `minChars` is**; only a section that does not fit is cut as `recursive` cuts, its pieces merged up to `minChars`. A heading with no text of its own is named by the path of the section after it when it is that section's ancestor, and is a passage of its own otherwise. |
577577

578578
**Sentence ends, for Chinese and English text.** `。?!` end a sentence
579579
wherever they stand. `. ? !` end one only before whitespace or the end of the

‎packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3576,7 +3576,7 @@ export const esESMetadataForms: NonNullable<TranslationData['metadataForms']> =
35763576
},
35773577
"source.split.minChars": {
35783578
label: "Pasaje más corto",
3579-
helpText: "En caracteres. Requiere una estrategia. Las piezas adyacentes más cortas que esto se fusionan, hasta esta longitud (200 de forma predeterminada). Solo Recursiva y Markdown."
3579+
helpText: "En caracteres. Requiere una estrategia. Las piezas adyacentes más cortas que esto se fusionan, hasta esta longitud (200 de forma predeterminada). Solo Recursiva y Markdown; en Markdown una sección que cabe es un solo pasaje, así que solo se fusionan las piezas de una sección que no cabe."
35803580
},
35813581
refresh: {
35823582
label: "Actualización",

‎packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3576,7 +3576,7 @@ export const jaJPMetadataForms: NonNullable<TranslationData['metadataForms']> =
35763576
},
35773577
"source.split.minChars": {
35783578
label: "最短パッセージ",
3579-
helpText: "文字数。戦略が必要です。この長さより短い隣接する断片は、この長さまで結合されます(既定 200)。再帰と Markdown のみ。"
3579+
helpText: "文字数。戦略が必要です。この長さより短い隣接する断片は、この長さまで結合されます(既定 200)。再帰と Markdown のみ。Markdown では収まるセクションは 1 パッセージになるため、結合されるのは収まらないセクションの断片だけです。"
35803580
},
35813581
refresh: {
35823582
label: "更新",

‎packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3576,7 +3576,7 @@ export const zhCNMetadataForms: NonNullable<TranslationData['metadataForms']> =
35763576
},
35773577
"source.split.minChars": {
35783578
label: "最短段落",
3579-
helpText: "以字符计。需要选择策略。短于此长度的相邻片段会被合并,直至达到此长度(默认 200)。仅适用于递归和 Markdown。"
3579+
helpText: "以字符计。需要选择策略。短于此长度的相邻片段会被合并,直至达到此长度(默认 200)。仅适用于递归和 Markdown;在 Markdown 下,放得下的小节整节为一个段落,因此只合并放不下的小节切出的片段。"
35803580
},
35813581
refresh: {
35823582
label: "刷新",

‎packages/spec/src/ai/knowledge-source.zod.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ export const KnowledgeSplitStrategySchema = lazySchema(() => z.enum(['whole', 'r
9595
* while it fits; adjacent short pieces are merged up to `minChars`.
9696
* - `markdown` — one section per heading; each passage carries its heading
9797
* path, which counts toward its length and is embedded with it. A section
98-
* that fits — its text with its heading path, within the effective
99-
* `maxChars` — is one passage, whatever `minChars` is; a section that does
100-
* not fit is cut as `recursive` cuts. The text before the first heading,
98+
* that fits — its text together with the heading path it is given (the
99+
* whole path, or the innermost heading when the whole path is too long),
100+
* within the effective `maxChars` — is one passage, whatever `minChars` is;
101+
* a section that does not fit is cut as `recursive` cuts. The text before the first heading,
101102
* and a heading's text before its first sub-heading, are sections too.
102103
*
103104
* The effective `maxChars` is the smaller of this value (or the settings

0 commit comments

Comments
 (0)