Collapses a list of documents into a single document.
This function takes a list of documents and a function to combine the content of these documents.
It combines the content of the documents using the provided function and merges the metadata of all documents.
If a metadata key is present in multiple documents, the values are concatenated with a comma separator.
Parameters
docs: Document[]
The list of documents to be collapsed.
combineDocumentFunc: ((docs) => Promise<string>)
A function that combines the content of a list of documents into a single string. This function should return a promise that resolves to the combined string.
Collapses a list of documents into a single document.
This function takes a list of documents and a function to combine the content of these documents. It combines the content of the documents using the provided function and merges the metadata of all documents. If a metadata key is present in multiple documents, the values are concatenated with a comma separator.