Skip to main content
Mastra 1.0 is available 🎉 Read announcement

RAG

The RAG package has renamed chunking parameters and narrowed their types.

Changed
Direct link to Changed

keepSeparator to separatorPosition
Direct link to keepseparator-to-separatorposition

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.

To migrate, replace keepSeparator with separatorPosition using the mapping below:

Old valueNew value
keepSeparator: trueseparatorPosition: 'start'
keepSeparator: 'start'separatorPosition: 'start'
keepSeparator: 'end'separatorPosition: 'end'
keepSeparator: falseRemove the parameter
Parameter omittedNo change needed
  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
});
On this page