Source code for alter_ego.agents.ExternalThread
from typing import Any, Optional
import alter_ego.structure
[docs]
class ExternalThread(alter_ego.structure.Thread):
    """
    Class representing a thread that is managed by an external program.
    """
[docs]
    def send(
        self, role, message: str, response: Optional[Any] = None, **kwargs: Any
    ) -> str:
        if role == "user" and response is not None:
            self.memorize("assistant", response)
            return response