Document-level metadata generation #16779
Replies: 1 comment
|
@pramudyalyza From what I can tell, there isn't currently a built-in "run once per document" metadata extraction stage in the ingestion pipeline. The behavior you're seeing is consistent with how RAGFlow's ingestion pipeline is designed today. Here's why:
So the log message:
is expected for the current Auto Metadata implementation as well. The documentation describes automatic metadata generation during parsing, but I couldn't find anything indicating that it performs a single LLM call per document instead of operating during chunk processing. :contentReference[oaicite:1]{index=1} If your metadata is truly document-levelFields like:
are generally properties of the entire document, not individual chunks. I think your expectation makes sense because inconsistent chunk-level values can reduce the usefulness of metadata filtering. Current optionsFrom what I could find, your options today are roughly:
It may be a feature gapPersonally, I think a dedicated Document Transformer stage would be valuable: That would allow document-level metadata to be generated once and propagated to every chunk during indexing. I couldn't find documentation or an existing feature that implements this workflow today, so this may simply be a current limitation rather than an incorrect pipeline configuration. One question that would help narrow down the best approach:
The recommended solution may differ depending on that use case. If this solves your problem, feel free to mark it as the accepted answer so others can find it easily. |
Uh oh!
There was an error while loading. Please reload this page.
Hi, i need some advice on how to generate metadata correctly in RAGFlow. My goal is to create metadata such as
business_function,country, andproductonce per file/documentHowever, I'm not sure how to do this properly. In the built-in pipeline, metadata seems to be generated for every chunk. I can see this from the log:
This is not ideal for my use case, because metadata such as
business_functionandcountryshould describe the whole document, not only one chunk. For example, one chunk may mention “Backend”, another chunk may mention “Frontend”, and another chunk may not mention any country, so the metadata can become inconsistentI also tried using a custom ingestion pipeline. In the custom pipeline, I can choose the Transformer input from outputs such as:
Using
TokenChunker/chunksalso makes the Transformer run per chunk, so that still does not solve the problem. Then i tried using the Parser output directly. For a.docfile, the Parser output isjson, but the JSON itself contains many parsed blocks:Because of this, when i use
Parser/jsonas the Metadata Transformer input, the Transformer still runs many times instead of once per document.So my question is: what is the recommended way to generate metadata once for one file/document in RAGFlow? Is this currently possible in either the built-in pipeline or custom ingestion pipeline? If yes, what is the correct setup?
All reactions