StreamEvent: {
    data: StreamEventData;
    event: string;
    metadata: Record<string, any>;
    name: string;
    run_id: string;
    tags?: string[];

A streaming event.

Schema of a streaming event which is produced from the streamEvents method.

Type declaration

  • data: StreamEventData

    Event data.

    The contents of the event data depend on the event type.

  • event: string

    Event names are of the format: on_[runnable_type]_(start|stream|end).

    Runnable types are one of:

    • llm - used by non chat models
    • chat_model - used by chat models
    • prompt -- e.g., ChatPromptTemplate
    • tool -- from tools defined via


    decorator or inheriting from Tool/BaseTool

    • chain - most Runnables are of this type

    Further, the events are categorized as one of:

    • start - when the runnable starts
    • stream - when the runnable is streaming
    • end - when the runnable ends

    start, stream and end are associated with slightly different data payload.

    Please see the documentation for EventData for more details.

  • metadata: Record<string, any>

    Metadata associated with the runnable that generated this event.

  • name: string

    The name of the runnable that generated the event.

  • run_id: string

    An randomly generated ID to keep track of the execution of the given runnable.

    Each child runnable that gets invoked as part of the execution of a parent runnable is assigned its own unique ID.

  • Optional tags?: string[]

    Tags associated with the runnable that generated this event. Tags are always inherited from parent runnables.

Generated using TypeDoc