Module: DSPy::Events::SubscriberMixin
- Extended by:
- T::Sig
- Included in:
- Teleprompt::GEPA::TraceCollector
- Defined in:
- lib/dspy/events/subscriber_mixin.rb
Overview
Mixin for adding class-level event subscriptions Provides a clean way to subscribe to events at the class level instead of requiring instance-based subscriptions
Usage:
class MyTracker
include DSPy::Events::SubscriberMixin
add_subscription('llm.*') do |name, attrs|
# Handle LLM events globally for this class
end
end
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dspy/events/subscriber_mixin.rb', line 22 def self.included(base) base.extend(ClassMethods) base.class_eval do @event_subscriptions = [] @subscription_mutex = Mutex.new # Initialize subscriptions when the class is first loaded @subscriptions_initialized = false end end |