01. StreamEvent type theorem

StreamEvent type theorem

Default event table

Event type

Event name

Input data

Output/chunk data

Chat Model

on_chat_model_start

{"messages": [[SystemMessage, HumanMessage]]}

-

Chat Model

on_chat_model_stream

-

AIMessageChunk (content="hello")

Chat Model

on_chat_model_end

{"messages": [[SystemMessage, HumanMessage]]}

AIMessageChunk (content="hello world")

LLM

on_llm_start

{'input':'hello'}

-

LLM

on_llm_stream

-

'Hello'

LLM

on_llm_end

-

'Hello human!'

Chain

on_chain_start

-

-

Chain

on_chain_stream

-

"hello world!, goodbye world!"

Chain

on_chain_end

[Document (...)]

"hello world!, goodbye world!"

Tool

on_tool_start

{"x": 1, "y": "2"}

-

Tool

on_tool_end

-

{"x": 1, "y": "2"}

Retriever

on_retriever_start

{"query": "hello"}

-

Retriever

on_retriever_end

{"query": "hello"}

[Document (...), ..]

Prompt

on_prompt_start

{"question": "hello"}

-

Prompt

on_prompt_end

{"question": "hello"}

ChatPromptValue (messages: [SystemMessage, ...])

StreamEvent structure

property

type

Explanation

Remarks

event

str

Event name

on_[runnable_type]_(start|stream|end) format

name

str

Runnable name

-

run_id

str

Execution unique ID

Newly created every run

parent_ids

List[str]

Parent Runnable IDs

only available on v2 API

tags

Optional[List[str]]

Runnable tag

Selector

metadata

Optional[Dict[str, Any]]

Runnable metadata

Selector

data

Dict[str, Any]

Event data

-

Custom event structure

property

type

Explanation

name

str

Custom event name

data

Any

Event-related data (JSON serialization recommended)

Last updated