From 6e35498f7b279fc58c628d44af8d357286e1ecb2 Mon Sep 17 00:00:00 2001 From: Marcus Schiesser Date: Wed, 9 Apr 2025 15:44:05 +0200 Subject: [PATCH] chore: use own DeepResearchEvent --- .../typescript/deep_research/workflow.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/templates/components/workflows/typescript/deep_research/workflow.ts b/templates/components/workflows/typescript/deep_research/workflow.ts index b387a5f12..007144775 100644 --- a/templates/components/workflows/typescript/deep_research/workflow.ts +++ b/templates/components/workflows/typescript/deep_research/workflow.ts @@ -1,8 +1,4 @@ -import { - DeepResearchEvent, - toSourceEvent, - toStreamGenerator, -} from "@llamaindex/server"; +import { toSourceEvent, toStreamGenerator } from "@llamaindex/server"; import { AgentInputData, AgentWorkflowContext, @@ -123,6 +119,19 @@ class ResearchEvent extends WorkflowEvent {} class ReportEvent extends WorkflowEvent<{}> {} class StopEvent extends StopEventBase> {} +type DeepResearchEventData = { + event: "retrieve" | "analyze" | "answer"; + state: "pending" | "inprogress" | "done" | "error"; + id?: string; + question?: string; + answer?: string; +}; + +class DeepResearchEvent extends WorkflowEvent<{ + type: "deep_research_event"; + data: DeepResearchEventData; +}> {} + // workflow definition class DeepResearchWorkflow extends Workflow< AgentWorkflowContext,