Skip to content

events

Class info

Classes

Name Children Inherits
ConnectionEventData
llmling_agent.messaging.events
Event from connection activity.

    🛈 DocStrings

    Event sources for LLMling agent.

    ConnectionEventData

    Bases: EventData

    Event from connection activity.

    Source code in src/llmling_agent/messaging/events.py
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    class ConnectionEventData[TTransmittedData](EventData):
        """Event from connection activity."""
    
        connection_name: str
        """Name of the connection which fired an event."""
    
        connection: Talk[TTransmittedData]
        """The connection which fired the event."""
    
        event_type: ConnectionEventType
        """Type of event that occurred."""
    
        message: ChatMessage[TTransmittedData] | None = None
        """The message at the stage of the event."""
    
        def to_prompt(self) -> str:
            """Convert event to agent prompt."""
            base = f"Connection {self.connection_name!r} event: {self.event_type}"
            if self.message:
                return f"{base}\nMessage content: {self.message.content}"
            return base
    

    connection instance-attribute

    connection: Talk[TTransmittedData]
    

    The connection which fired the event.

    connection_name instance-attribute

    connection_name: str
    

    Name of the connection which fired an event.

    event_type instance-attribute

    event_type: ConnectionEventType
    

    Type of event that occurred.

    message class-attribute instance-attribute

    message: ChatMessage[TTransmittedData] | None = None
    

    The message at the stage of the event.

    to_prompt

    to_prompt() -> str
    

    Convert event to agent prompt.

    Source code in src/llmling_agent/messaging/events.py
    34
    35
    36
    37
    38
    39
    def to_prompt(self) -> str:
        """Convert event to agent prompt."""
        base = f"Connection {self.connection_name!r} event: {self.event_type}"
        if self.message:
            return f"{base}\nMessage content: {self.message.content}"
        return base