メインコンテンツへ移動

RAG

RAG パッケージでは、チャンク分割パラメーターの名前が変更され、型が限定されました。

変更
変更への直接リンク

keepSeparator から separatorPosition
keepseparator-to-separatorpositionへの直接リンク

keepSeparator パラメーターは separatorPosition に改名され、型も簡素化されました。以前のパラメーターは boolean | 'start' | 'end' という分かりにくい型で、true が暗黙的に 'start' のエイリアスでした。新しいパラメーターは明示的な 'start' | 'end' 値を使用し、パラメーターを省略すると区切り文字を破棄します。

移行するには、以下の対応に従って keepSeparatorseparatorPosition に置き換えます。

以前の値新しい値
keepSeparator: trueseparatorPosition: '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
});