fix(platform): Fix logging incomplete information & LLM missing error (#8128)
parent
62a3e1c127
commit
52ee846744
|
@ -320,7 +320,7 @@ class AITextGeneratorBlock(Block):
|
||||||
if output_name == "response":
|
if output_name == "response":
|
||||||
return output_data["response"]
|
return output_data["response"]
|
||||||
else:
|
else:
|
||||||
raise output_data
|
raise RuntimeError(output_data)
|
||||||
raise ValueError("Failed to get a response from the LLM.")
|
raise ValueError("Failed to get a response from the LLM.")
|
||||||
|
|
||||||
def run(self, input_data: Input) -> BlockOutput:
|
def run(self, input_data: Input) -> BlockOutput:
|
||||||
|
|
|
@ -69,20 +69,28 @@ class LogMetadata:
|
||||||
self.prefix = f"[ExecutionManager|uid:{user_id}|gid:{graph_id}|nid:{node_id}]|geid:{graph_eid}|nid:{node_eid}|{block_name}]"
|
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):
|
def info(self, msg: str, **extra):
|
||||||
|
msg = self._wrap(msg, **extra)
|
||||||
logger.info(msg, extra={"json_fields": {**self.metadata, **extra}})
|
logger.info(msg, extra={"json_fields": {**self.metadata, **extra}})
|
||||||
|
|
||||||
def warning(self, msg: str, **extra):
|
def warning(self, msg: str, **extra):
|
||||||
|
msg = self._wrap(msg, **extra)
|
||||||
logger.warning(msg, extra={"json_fields": {**self.metadata, **extra}})
|
logger.warning(msg, extra={"json_fields": {**self.metadata, **extra}})
|
||||||
|
|
||||||
def error(self, msg: str, **extra):
|
def error(self, msg: str, **extra):
|
||||||
|
msg = self._wrap(msg, **extra)
|
||||||
logger.error(msg, extra={"json_fields": {**self.metadata, **extra}})
|
logger.error(msg, extra={"json_fields": {**self.metadata, **extra}})
|
||||||
|
|
||||||
def debug(self, msg: str, **extra):
|
def debug(self, msg: str, **extra):
|
||||||
|
msg = self._wrap(msg, **extra)
|
||||||
logger.debug(msg, extra={"json_fields": {**self.metadata, **extra}})
|
logger.debug(msg, extra={"json_fields": {**self.metadata, **extra}})
|
||||||
|
|
||||||
def exception(self, msg: str, **extra):
|
def exception(self, msg: str, **extra):
|
||||||
|
msg = self._wrap(msg, **extra)
|
||||||
logger.exception(msg, extra={"json_fields": {**self.metadata, **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")
|
T = TypeVar("T")
|
||||||
ExecutionStream = Generator[NodeExecution, None, None]
|
ExecutionStream = Generator[NodeExecution, None, None]
|
||||||
|
|
Loading…
Reference in New Issue