Whatever message this page gives is out now! Go check it out!
split(). Use to post-process chunks after splitting, for example, to add metadata or normalise content before embedding.docService.transformSegments(segments, transformer)Parameter | Type | Required | Description |
|---|---|---|---|
segments | Array | Required | Array of text segment Structs as returned by split(). |
transformer | UDF / Closure | Required | Function with signature function(required Struct segment) that returns a modified segment Struct. |
enriched = docService.transformSegments(segments, function(required segment) {
segment.metadata.processedAt = now();
segment.metadata.wordCount = listLen(segment.text, " ");
return segment;
});