feat(llama_index): Instrument Sparse Embedding & Workflow Events#2928
feat(llama_index): Instrument Sparse Embedding & Workflow Events#2928ialisaleh wants to merge 8 commits intoArize-ai:mainfrom
Conversation
| @_Span._process_event.register(WorkflowStepOutputEvent) # type: ignore[attr-defined,misc] | ||
| def _workflow_step_output_event(self: _Span, event: WorkflowStepOutputEvent) -> None: # type: ignore[misc] | ||
| # Pre-summarised step output produced by workflows.runtime | ||
| self[OUTPUT_VALUE] = event.output |
There was a problem hiding this comment.
The new workflow output handlers now populate output.value before process_output() runs, so real Workflow.run() spans regress from structured JSON plus output.mime_type=application/json to the summarize_event(...) string with no MIME type. I reproduced that locally on this branch with a minimal workflow, while the merge base still emits JSON. Since these events are summary payloads, could we avoid writing them into OUTPUT_VALUE and let process_output() serialize the real returned event instead?
|
|
||
| @dispatcher.span # type: ignore[misc,unused-ignore] | ||
| def step_span() -> None: | ||
| dispatcher.event(WorkflowStepOutputEvent(output="StopEvent(result='hello')")) |
There was a problem hiding this comment.
These tests synthesize WorkflowStepOutputEvent and WorkflowRunOutputEvent directly, then assert the summary string, so they lock in the behavioral regression above instead of exercising the real workflow runtime. A minimal Workflow integration test catches the difference immediately and also lets us assert output.mime_type and JSON output with pop-style checks. Could we drive this through Workflow.run() and use handler.cancel_run() for the cancellation case instead of dispatching the events by hand?
Closes #2918