mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-03 22:30:31 +08:00
Align Go knowledge compiler RAPTOR with Python and drop guardrails (#17573)
Port RAPTOR knowledge compilation to match Python: remove Go-only capacity guardrails, fix prompts, add token truncation, response post-processing, retries, replace AHC with watershed.
This commit is contained in:
@@ -141,30 +141,16 @@ func Run(ctx context.Context, deps common.Deps, param common.Param, inputs commo
|
||||
return common.Outputs{}, err
|
||||
}
|
||||
|
||||
// Stream the merged products (plus the graph) through a ProductSink so the
|
||||
// flush policy caps peak memory instead of holding the full result set.
|
||||
sink := common.NewProductSink(ctx, param.Guardrails, inputs.Sink)
|
||||
for _, p := range prods {
|
||||
if err := sink.Add(p); err != nil {
|
||||
return common.Outputs{}, err
|
||||
}
|
||||
}
|
||||
if err := sink.Add(graphProduct); err != nil {
|
||||
return common.Outputs{}, err
|
||||
}
|
||||
// Buffer every product (plus the graph) in one slice; the component merges
|
||||
// them into the upstream chunk stream (matching Python, which appends
|
||||
// compiled units onto the chunk list).
|
||||
products := append([]common.Product{}, prods...)
|
||||
products = append(products, graphProduct)
|
||||
|
||||
out := common.Outputs{
|
||||
Products: sink.Products(),
|
||||
VectorBytes: sink.Bytes(),
|
||||
Items: sink.TotalItems(),
|
||||
Flushed: sink.Flushed(),
|
||||
Products: products,
|
||||
DuplicatesDropped: stats.DuplicatesDropped,
|
||||
}
|
||||
// Capacity guardrails (centralised in common.EnforceGuardrails so every
|
||||
// variant honours the same policy — error/flush/none — without drift).
|
||||
if err := out.EnforceGuardrails(param.Guardrails, inputs.Sink, ctx); err != nil {
|
||||
return common.Outputs{}, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user