llamaindex
Version:
<p align="center"> <img height="100" width="100" alt="LlamaIndex logo" src="https://ts.llamaindex.ai/square.svg" /> </p> <h1 align="center">LlamaIndex.TS</h1> <h3 align="center"> Data framework for your LLM application. </h3>
24 lines (23 loc) • 691 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "MetadataReplacementPostProcessor", {
enumerable: true,
get: function() {
return MetadataReplacementPostProcessor;
}
});
const _schema = require("@llamaindex/core/schema");
class MetadataReplacementPostProcessor {
targetMetadataKey;
constructor(targetMetadataKey){
this.targetMetadataKey = targetMetadataKey;
}
async postprocessNodes(nodes) {
for (const n of nodes){
n.node.setContent(n.node.metadata[this.targetMetadataKey] ?? n.node.getContent(_schema.MetadataMode.NONE));
}
return nodes;
}
}