Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
the-praxs committed Dec 22, 2024
1 parent 9867928 commit f5faec2
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions agentops/partners/taskweaver_event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,12 @@ def _get_or_create_agent(self, role: str):
return self._active_agents.get(role)

def handle_session(self, type: SessionEventType, msg: str, extra: Any, **kwargs: Any):
agentops.record(
ActionEvent(action_type=type.value, params={"extra": extra, "message": msg})
)
agentops.record(ActionEvent(action_type=type.value, params={"extra": extra, "message": msg}))

def handle_round(self, type: RoundEventType, msg: str, extra: Any, round_id: str, **kwargs: Any):
if type == RoundEventType.round_error:
agentops.record(
ErrorEvent(
error_type=type.value,
details={"round_id": round_id, "message": msg, "extra": extra}
)
ErrorEvent(error_type=type.value, details={"round_id": round_id, "message": msg, "extra": extra})
)
logger.error(f"Could not record the Round event: {msg}")
self.cleanup_round()
Expand Down Expand Up @@ -100,7 +95,7 @@ def handle_post(self, type: PostEventType, msg: str, extra: Any, post_id: str, r
agent_id=agent_id,
)
)

elif type == PostEventType.post_attachment_update:
attachment_id = extra["id"]
attachment_type = extra["type"].value
Expand Down Expand Up @@ -154,7 +149,7 @@ def handle_post(self, type: PostEventType, msg: str, extra: Any, post_id: str, r
agent_id=agent_id,
)
)

self._attachment_buffer.pop(attachment_id, None)

elif type == PostEventType.post_message_update:
Expand All @@ -168,7 +163,7 @@ def handle_post(self, type: PostEventType, msg: str, extra: Any, post_id: str, r
}

self._message_buffer[post_id]["content"].append(str(msg))

if is_end:
self._message_buffer[post_id]["end_timestamp"] = datetime.now(timezone.utc).isoformat()
complete_message = "".join(self._message_buffer[post_id]["content"])
Expand Down

0 comments on commit f5faec2

Please sign in to comment.