Can I trust a model inside a pipeline?
Available — v0.0.1 (experimental)llmstarlark
Let an LLM decide, keep it honest
Feedback is routed to positive, negative or uncertain. “Uncertain” is an output, not a failure — and a rules-based pipe with the same ports can replace the model. The verified run uses a mock provider.
Available in v0.0.1: the files, README and tests are in examples/llm of the openflange-go repository. Commands run from the repository root.
Needs: python3, and Rscript for the statistics node (the rules variant below needs no R).
A pipe is a data-processing step with declared inputs and outputs.
What goes in, what comes out
Input — examples/llm/feedback.ndjson
{"id":1,"text":"Great service, I love the new dashboard!"}
{"id":2,"text":"The delivery was late and the box arrived broken."}
{"id":3,"text":"It arrived on Tuesday."}
{"id":4,"text":"Fast delivery, but the support was terrible."}
{"id":5,"text":"Not good at all, I want a refund."}
{"id":6,"text":"Excellent quality, fast and friendly support. Thank you!"}Command
openflange run ./examples/llm/feedback-routing --grant subprocess --input feedback=examples/llm/feedback.ndjson --output positiveStats=- --output negativeSummary=summary.txt --output review=review.ndjsonOutputs
# positiveStats (stdout)
{"count":2,"mean":0.91,"median":0.91,"sd":0.0848528137423857}
# summary.txt
2 feedback item(s). Most mentioned: arrived (1), box (1), broken (1), delivery (1), good (1). [mock summary - no model was called]
# review.ndjson
{"id":3,"text":"It arrived on Tuesday.","label":"uncertain","confidence":0.9,"reason":"model reply"}
{"id":4,"text":"Fast delivery, but the support was terrible.","label":"uncertain","confidence":0.5,"reason":"model reply"}Files and further commands
examples/llm/feedback-routing/pipeline.yaml
# AI decision routing, built from ordinary pipes:
#
# feedback ─▶ classify ─┬─ positive ──▶ value ─▶ stats (R) ─▶ positiveStats
# ├─ negative ──▶ summarise (LLM) ────▶ negativeSummary (text)
# └─ uncertain ──────────────────────▶ review (for a human)
spec: openflange.org/pipeline/v0.1
nodes:
classify:
pipe: ../classify-feedback-llm # swap for ../classify-feedback-rules: same contract
inputs:
feedback: {from: inputs.feedback}
grants: {subprocess: true}
value:
pipe: std:map
inputs:
in: {from: classify.outputs.positive}
parameters:
expr: '{"value": item["confidence"]}'
stats:
pipe: ../../r-summary
inputs:
records: {from: value.outputs.out}
grants: {subprocess: true}
summarise:
pipe: ../llm-summarise
inputs:
feedback: {from: classify.outputs.negative}
grants: {subprocess: true}
outputs:
positiveStats: {from: stats.outputs.summary}
negativeSummary: {from: summarise.outputs.summary}
review: {from: classify.outputs.uncertain}No R? The same graph with the rules classifier
openflange run ./examples/llm/feedback-routing/pipeline.rules.yaml --grant subprocess --input feedback=examples/llm/feedback.ndjson --output positiveStats=- --output negativeSummary=summary.txt --output review=review.ndjson
# {"count":2,"mean":0.9,"min":0.9,"max":0.9}What to notice
- The verified run is the mock-provider run. The example ships with deterministic mock providers: no network, no API key, no cost. The mocks are not models and say nothing about model quality; the summary line says so itself.
- Real providers are opt-in and not verified. The repository has an Anthropic variant (costs money, sends record text to the provider, needs a secret and explicit grants) that was not run, and an Ollama variant that is untested against a real server.
uncertainis a required output of the classifier: leave it unconnected and the pipeline does not validate. Here it is the pipeline outputreview, bound to a file.- The model and the deterministic rules implement the same contract: one input, three outputs. Swapping one for the other is a one-line change, which is how you test the rest of the pipeline without paying for model calls.
- Tests for a model assert on structure (each record lands on exactly one output and matches a schema), not on exact text.