Skip to content

Commit

Permalink
fix(platform): Fix logging incomplete information & LLM missing error (
Browse files Browse the repository at this point in the history
  • Loading branch information
majdyz authored Sep 21, 2024
1 parent 62a3e1c commit 52ee846
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion autogpt_platform/backend/backend/blocks/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def llm_call(input_data: AIStructuredResponseGeneratorBlock.Input) -> str:
if output_name == "response":
return output_data["response"]
else:
raise output_data
raise RuntimeError(output_data)
raise ValueError("Failed to get a response from the LLM.")

def run(self, input_data: Input) -> BlockOutput:
Expand Down
8 changes: 8 additions & 0 deletions autogpt_platform/backend/backend/executor/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,28 @@ def __init__(
self.prefix = f"[ExecutionManager|uid:{user_id}|gid:{graph_id}|nid:{node_id}]|geid:{graph_eid}|nid:{node_eid}|{block_name}]"

def info(self, msg: str, **extra):
msg = self._wrap(msg, **extra)
logger.info(msg, extra={"json_fields": {**self.metadata, **extra}})

def warning(self, msg: str, **extra):
msg = self._wrap(msg, **extra)
logger.warning(msg, extra={"json_fields": {**self.metadata, **extra}})

def error(self, msg: str, **extra):
msg = self._wrap(msg, **extra)
logger.error(msg, extra={"json_fields": {**self.metadata, **extra}})

def debug(self, msg: str, **extra):
msg = self._wrap(msg, **extra)
logger.debug(msg, extra={"json_fields": {**self.metadata, **extra}})

def exception(self, msg: str, **extra):
msg = self._wrap(msg, **extra)
logger.exception(msg, extra={"json_fields": {**self.metadata, **extra}})

def _wrap(self, msg: str, **extra):
return f"{self.prefix} {msg} {extra}"


T = TypeVar("T")
ExecutionStream = Generator[NodeExecution, None, None]
Expand Down

0 comments on commit 52ee846

Please sign in to comment.