Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove debugging logs #2287

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions letta/server/rest_api/routers/v1/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,6 @@ def get_agent_messages(
"""
actor = server.user_manager.get_user_or_default(user_id=user_id)

# TODO: Temporary debugging logs for debugging very slow endpoint
import uuid

temp_rand_uuid = uuid.uuid4()

logger.info(f"[{temp_rand_uuid}] RECEIVED GET /messages for agent_id={agent_id} before={before} limit={limit}")

return server.get_agent_recall_cursor(
user_id=actor.id,
agent_id=agent_id,
Expand All @@ -472,7 +465,6 @@ def get_agent_messages(
return_message_object=msg_object,
assistant_message_tool_name=assistant_message_tool_name,
assistant_message_tool_kwarg=assistant_message_tool_kwarg,
temp_rand_uuid=temp_rand_uuid,
)


Expand Down
23 changes: 0 additions & 23 deletions letta/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,27 +979,13 @@ def get_agent_recall_cursor(
return_message_object: bool = True,
assistant_message_tool_name: str = constants.DEFAULT_MESSAGE_TOOL,
assistant_message_tool_kwarg: str = constants.DEFAULT_MESSAGE_TOOL_KWARG,
temp_rand_uuid: Optional[str] = None,
) -> Union[List[Message], List[LettaMessage]]:
# TODO: Thread actor directly through this function, since the top level caller most likely already retrieved the user
import datetime

start_time = datetime.datetime.utcnow()

logger.info(
f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Fetching actor for user_id={user_id} (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)"
)
actor = self.user_manager.get_user_or_default(user_id=user_id)

logger.info(
f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Resolving start_date and end_date for filtering messages (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)"
)
start_date = self.message_manager.get_message_by_id(after, actor=actor).created_at if after else None
end_date = self.message_manager.get_message_by_id(before, actor=actor).created_at if before else None

logger.info(
f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Fetching messages for agent_id={agent_id}, start_date={start_date}, end_date={end_date}, limit={limit}, reverse={reverse} (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)"
)
records = self.message_manager.list_messages_for_agent(
agent_id=agent_id,
actor=actor,
Expand All @@ -1010,9 +996,6 @@ def get_agent_recall_cursor(
)

if not return_message_object:
logger.info(
f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Converting messages to LettaMessage objects (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)"
)
records = [
msg
for m in records
Expand All @@ -1023,14 +1006,8 @@ def get_agent_recall_cursor(
]

if reverse:
logger.info(
f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Reversing message order (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)"
)
records = records[::-1]

logger.info(
f"[{temp_rand_uuid}] {datetime.datetime.utcnow()} - Returning {len(records)} messages (Elapsed: {(datetime.datetime.utcnow() - start_time).total_seconds()}s)"
)
return records

def get_server_config(self, include_defaults: bool = False) -> dict:
Expand Down
Loading