Adapter: record CHAP human-decision events from LlamaIndex Workflows human-in-the-loop#6
Adapter: record CHAP human-decision events from LlamaIndex Workflows human-in-the-loop#6BrightbeamBogdanCastraveti wants to merge 2 commits into
Conversation
…dex Workflows human-in-the-loop Adapter mirroring chap-langgraph: when a Workflow step pauses on an InputRequiredEvent, record the human's HumanResponseEvent as a CHAP envelope. approve -> decide.approve override -> decide.override (RFC 6902 diff of proposed vs returned) reject -> decide.reject - llama-index-workflows is an optional dependency; events are read structurally via event.get(...), so the bridge and tests run without it. - decision is explicit and authoritative: Workflows events carry no approve/edit/reject signal, so the adapter never infers intent. - recorded from the driver using the two-step InputRequiredEvent -> HumanResponseEvent loop, so step replay never double-records. - 0.2.6-correct by construction: approver joined, review.request addressed to that approver, so from is a member and in the to set. Closes #1.
|
Self-review caught one edge case worth flagging: in Fix is a one-line guard — raise instead of diffing against if diff is None:
if returned is None:
raise ValueError("an override needs `returned` content (or a `diff`)")
diff = _diff(proposed, returned, "")Ready locally; I'll push it once the branch-update ruleset is scoped (same blocker as #5). |
Guard record_decision so decision=override without returned content (or a diff) raises instead of recording a whole-artefact replace with null.
|
you should be able to update Bogdan, please let me know how it goes. |
|
Pushed |
Closes #1.
Adapter mirroring
chap-langgraph/chap-pydantic-ai: when a LlamaIndex Workflow step pauses on anInputRequiredEvent, the human'sHumanResponseEventis recorded as a CHAP decision.Design (per the plan on #1):
decisionis explicit and authoritative — Workflows events are schemaless and carry no approve/edit/reject signal, so the adapter never infers intent.proposed/returned/rationale/tags/intent_preserved/approverdefault toevent.get(...)with per-call overrides; arg names match the sibling bridges.InputRequiredEvent→HumanResponseEventloop — so step replay never double-records.llama-index-workflowsis optional; the bridge reads events structurally, so it and its tests run without it.review.requestaddressed to that approver, sofromis always a member and in thetoset.Verified against
main(0.2.6): adapterpytest12 passed; example runs on realllama-index-workflows2.22 through approve / refining edit / substituting edit / reject; conformance harness 23/23.