Skip to content

Commit

Permalink
feat: various fixes to improve notebook useability (#1593)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahwooders committed Jul 31, 2024
1 parent a88cd1e commit 8d7bd08
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions memgpt/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,13 @@ def rename_agent(self, agent_id: uuid.UUID, new_name: str):
def delete_agent(self, agent_id: uuid.UUID):
self.server.delete_agent(user_id=self.user_id, agent_id=agent_id)

def get_agent(self, agent_id: uuid.UUID) -> AgentState:
def get_agent_config(self, agent_id: uuid.UUID) -> AgentState:
self.interface.clear()
return self.server.get_agent_config(user_id=self.user_id, agent_id=agent_id)

def get_agent(self, agent_id: Optional[uuid.UUID] = None, agent_name: Optional[str] = None):
return self.server.ms.get_agent(user_id=self.user_id, agent_id=agent_id, agent_name=agent_name)

# presets
def create_preset(self, preset: Preset) -> Preset:
if preset.user_id is None:
Expand All @@ -799,7 +802,19 @@ def update_agent_core_memory(self, agent_id: str, new_memory_contents: Dict) ->

# agent interactions

def send_message(self, agent_id: uuid.UUID, message: str, role: str, stream: Optional[bool] = False) -> UserMessageResponse:
def send_message(
self,
message: str,
role: str,
agent_id: Optional[uuid.UUID] = None,
agent_name: Optional[str] = None,
stream: Optional[bool] = False,
) -> UserMessageResponse:
if not agent_id:
assert agent_name, f"Either agent_id or agent_name must be provided"
agent_state = self.get_agent(agent_name=agent_name)
agent_id = agent_state.id

if stream:
# TODO: implement streaming with stream=True/False
raise NotImplementedError
Expand Down
2 changes: 1 addition & 1 deletion memgpt/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ def system_message(
message.created_at = timestamp

# Run the agent state forward
return self._step(user_id=user_id, agent_id=agent_id, input_message=packaged_system_message, timestamp=None)
return self._step(user_id=user_id, agent_id=agent_id, input_message=packaged_system_message, timestamp=timestamp)

# @LockingServer.agent_lock_decorator
def run_command(self, user_id: uuid.UUID, agent_id: uuid.UUID, command: str) -> Union[MemGPTUsageStatistics, None]:
Expand Down

0 comments on commit 8d7bd08

Please sign in to comment.