Skip to content

PostCarryoverProcessingEvent

autogen.events.agent_events.PostCarryoverProcessingEvent #

PostCarryoverProcessingEvent(*, uuid=None, chat_info)

Bases: BaseEvent

Source code in autogen/events/agent_events.py
def __init__(self, *, uuid: Optional[UUID] = None, chat_info: dict[str, Any]):
    carryover = chat_info.get("carryover", "")
    message = chat_info.get("message")
    verbose = chat_info.get("verbose", False)

    sender = chat_info["sender"].name if hasattr(chat_info["sender"], "name") else chat_info["sender"]
    recipient = chat_info["recipient"].name if hasattr(chat_info["recipient"], "name") else chat_info["recipient"]
    summary_args = chat_info.get("summary_args")
    max_turns = chat_info.get("max_turns")

    # Fix Callable in chat_info
    summary_method = chat_info.get("summary_method", "")
    if callable(summary_method):
        summary_method = summary_method.__name__

    print_message = ""
    if isinstance(message, str):
        print_message = message
    elif callable(message):
        print_message = "Callable: " + message.__name__
    elif isinstance(message, dict):
        print_message = "Dict: " + str(message)
    elif message is None:
        print_message = "None"

    super().__init__(
        uuid=uuid,
        carryover=carryover,
        message=print_message,
        verbose=verbose,
        summary_method=summary_method,
        summary_args=summary_args,
        max_turns=max_turns,
        sender=sender,
        recipient=recipient,
    )

carryover instance-attribute #

carryover

message instance-attribute #

message

verbose class-attribute instance-attribute #

verbose = False

sender instance-attribute #

sender

recipient instance-attribute #

recipient

summary_method instance-attribute #

summary_method

summary_args class-attribute instance-attribute #

summary_args = None

max_turns class-attribute instance-attribute #

max_turns = None

uuid instance-attribute #

uuid

serialize_model #

serialize_model()
Source code in autogen/events/agent_events.py
@model_serializer
def serialize_model(self) -> dict[str, Any]:
    return {
        "uuid": self.uuid,
        "chat_info": {
            "carryover": self.carryover,
            "message": self.message,
            "verbose": self.verbose,
            "sender": self.sender,
            "recipient": self.recipient,
            "summary_method": self.summary_method,
            "summary_args": self.summary_args,
            "max_turns": self.max_turns,
        },
    }

print #

print(f=None)
Source code in autogen/events/agent_events.py
def print(self, f: Optional[Callable[..., Any]] = None) -> None:
    f = f or print

    print_carryover = self._process_carryover()

    f(colored("\n" + "*" * 80, "blue"), flush=True, sep="")
    f(
        colored(
            "Starting a new chat....",
            "blue",
        ),
        flush=True,
    )
    if self.verbose:
        f(colored("Event:\n" + self.message, "blue"), flush=True)
        f(colored("Carryover:\n" + print_carryover, "blue"), flush=True)
    f(colored("\n" + "*" * 80, "blue"), flush=True, sep="")