pub trait EngineObserver: Send + Sync {
// Required methods
fn on_start(
&self,
id: &str,
template: &str,
slot: &str,
request: &GenerationRequest,
);
fn on_success(&self, id: &str, response: &GenerationResponse);
fn on_healing_step(&self, id: &str, attempt: u32, error: &str);
fn on_failure(&self, id: &str, error: &str);
// Provided method
fn on_metadata(&self, _id: &str, _key: &str, _value: Value) { ... }
}Expand description
Trait for observing engine events (logging, metrics, UI).
Required Methods§
Sourcefn on_start(
&self,
id: &str,
template: &str,
slot: &str,
request: &GenerationRequest,
)
fn on_start( &self, id: &str, template: &str, slot: &str, request: &GenerationRequest, )
Called when a generation starts.
Sourcefn on_success(&self, id: &str, response: &GenerationResponse)
fn on_success(&self, id: &str, response: &GenerationResponse)
Called when a generation succeeds.
Sourcefn on_healing_step(&self, id: &str, attempt: u32, error: &str)
fn on_healing_step(&self, id: &str, attempt: u32, error: &str)
Called when a validation/healing attempt occurs.
Sourcefn on_failure(&self, id: &str, error: &str)
fn on_failure(&self, id: &str, error: &str)
Called when a generation fails permanently.
Provided Methods§
Sourcefn on_metadata(&self, _id: &str, _key: &str, _value: Value)
fn on_metadata(&self, _id: &str, _key: &str, _value: Value)
Called to report arbitrary metadata for an event.