Skip to content

Commit 7413e14

Browse files
acailicclaude
andcommitted
refactor: deduplicate _event_value across collector modules
Consolidate two copies of _event_value into the canonical collector/intelligence/helpers.py definition. Scorer.py copy left untouched (intentionally in SDK to avoid circular imports). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b6ec421 commit 7413e14

2 files changed

Lines changed: 2 additions & 15 deletions

File tree

collector/causal_analysis.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@
66

77
from agent_debugger_sdk.core.events import EventType, TraceEvent
88

9-
10-
def _event_value(event: TraceEvent | None, key: str, default: Any = None) -> Any:
11-
if event is None:
12-
return default
13-
if hasattr(event, key):
14-
return getattr(event, key)
15-
return event.data.get(key, default)
9+
from .intelligence.helpers import event_value as _event_value
1610

1711

1812
class CausalAnalyzer:

collector/ranking/event_ranker.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@
77

88
from agent_debugger_sdk.core.events import EventType, TraceEvent
99

10-
11-
def _event_value(event: TraceEvent | None, key: str, default: Any = None) -> Any:
12-
"""Extract a value from an event's attributes or data dict."""
13-
if event is None:
14-
return default
15-
if hasattr(event, key):
16-
return getattr(event, key)
17-
return event.data.get(key, default)
10+
from ..intelligence.helpers import event_value as _event_value
1811

1912

2013
class EventRankingService:

0 commit comments

Comments
 (0)