jeff3071 commented on code in PR #72202:
URL: https://github.com/apache/airflow/pull/72202#discussion_r4145439042
##########
providers/common/ai/src/airflow/providers/common/ai/toolsets/logging.py:
##########
@@ -58,11 +69,34 @@ async def call_tool(
return result
except ApprovalRequired:
# Not a failure: the run pauses here until a person approves or
rejects the call.
- self.logger.info("Tool %s is waiting to be approved", name)
+ elapsed = time.monotonic() - start
+ self.logger.info("Tool %s is waiting to be approved after %.2fs",
name, elapsed)
+ self.logger.info("::endgroup::")
+ raise
+ except (ModelRetry, ToolFailed, CallDeferred, SkipToolExecution) as e:
+ elapsed = time.monotonic() - start
+ self.logger.info("Tool %s requested %s after %.2fs: %s", name,
type(e).__name__, elapsed, e)
self.logger.info("::endgroup::")
raise
except Exception:
elapsed = time.monotonic() - start
- self.logger.exception("Tool %s failed after %.2fs", name, elapsed)
self.logger.info("::endgroup::")
+ self.logger.exception("Tool %s failed after %.2fs", name, elapsed)
raise
+
+
+@dataclass
+class ToolLoggingCapability(AbstractCapability[Any]):
+ """Apply tool-call logging to the assembled function toolset for an agent
run."""
+
+ logger: Logger | logging.Logger = field(default_factory=lambda:
logging.getLogger(__name__))
+
+ @classmethod
+ def get_serialization_name(cls) -> str | None:
+ return None
+
+ def get_ordering(self) -> CapabilityOrdering:
Review Comment:
Added `CombinedCapability` in spellcheck and one-line docstring in
`get_ordering`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]