Skip to content

Commit

Permalink
fix: cleanup base agent typing on step(), from PR #1700 (#1754)
Browse files Browse the repository at this point in the history
Co-authored-by: vivek3141 <[email protected]>
  • Loading branch information
cpacker and vivek3141 authored Sep 13, 2024
1 parent bba1a73 commit 93f7409
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions memgpt/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,33 @@ def initialize_message_sequence(


class BaseAgent(ABC):
"""Base class for all agents. Only two interfaces are required: step and update_state."""
"""
Abstract class for all agents.
Only two interfaces are required: step and update_state.
"""

# @abstractmethod
# def step(self, message: Message) -> List[Message]:
# raise NotImplementedError

# TODO cleanup
@abstractmethod
def step(self, message: Message) -> List[Message]:
raise NotImplementedError
def step(
self,
user_message: Union[Message, str], # NOTE: should be json.dump(dict)
first_message: bool = False,
first_message_retry_limit: int = FIRST_MESSAGE_ATTEMPTS,
skip_verify: bool = False,
return_dicts: bool = True, # if True, return dicts, if False, return Message objects
recreate_message_timestamp: bool = True, # if True, when input is a Message type, recreated the 'created_at' field
stream: bool = False, # TODO move to config?
timestamp: Optional[datetime.datetime] = None,
inner_thoughts_in_kwargs: OptionState = OptionState.DEFAULT,
ms: Optional[MetadataStore] = None,
) -> Tuple[List[Union[dict, Message]], bool, bool, bool]:
"""
Top-level event message handler for the agent.
"""

@abstractmethod
def update_state(self) -> AgentState:
Expand Down

0 comments on commit 93f7409

Please sign in to comment.