RAG
RAG 包已经重命名了分块参数并缩小了它们的类型范围。
🌐 The RAG package has renamed chunking parameters and narrowed their types.
已更改Direct link to 已更改
🌐 Changed
keepSeparator 到 separatorPositionDirect link to keepseparator-to-separatorposition
🌐 keepSeparator to separatorPosition
keepSeparator 参数已重命名为 separatorPosition,类型也更简化。旧参数的 boolean | 'start' | 'end' 类型令人Perplexity,其中 true 实际上是 'start' 的别名。新参数使用明确的 'start' | 'end' 值,且如果省略该参数,则会舍弃分隔符。
🌐 The keepSeparator parameter has been renamed to separatorPosition with a simplified type. The old parameter had a confusing boolean | 'start' | 'end' type where true was secretly an alias for 'start'. The new parameter uses explicit 'start' | 'end' values, and omitting the parameter discards the separator.
要进行迁移,请使用以下映射将 keepSeparator 替换为 separatorPosition:
🌐 To migrate, replace keepSeparator with separatorPosition using the mapping below:
| 旧值 | 新值 |
|---|---|
keepSeparator: true | separatorPosition: 'start' |
keepSeparator: 'start' | separatorPosition: 'start' |
keepSeparator: 'end' | separatorPosition: 'end' |
keepSeparator: false | 删除该参数 |
| 遗漏的参数 | 无需更改 |
await doc.chunk({
strategy: 'character',
separator: '.',
- keepSeparator: true,
+ separatorPosition: 'start',
});
await doc.chunk({
strategy: 'character',
separator: '.',
- keepSeparator: 'end',
+ separatorPosition: 'end',
});
await doc.chunk({
strategy: 'character',
separator: '.',
- keepSeparator: false,
+ // Parameter removed - separator is discarded by default
});