event.py 667 B

123456789101112131415161718192021
  1. from pydantic import BaseModel, Field
  2. from core.workflow.entities.node_entities import NodeRunResult
  3. class RunCompletedEvent(BaseModel):
  4. run_result: NodeRunResult = Field(..., description="run result")
  5. class RunStreamChunkEvent(BaseModel):
  6. chunk_content: str = Field(..., description="chunk content")
  7. from_variable_selector: list[str] = Field(..., description="from variable selector")
  8. class RunRetrieverResourceEvent(BaseModel):
  9. retriever_resources: list[dict] = Field(..., description="retriever resources")
  10. context: str = Field(..., description="context")
  11. RunEvent = RunCompletedEvent | RunStreamChunkEvent | RunRetrieverResourceEvent