CrucibleTrace.Event (CrucibleTrace v0.3.1)
View SourceRepresents a single causal reasoning event in the decision chain.
Events capture the decision-making process of LLMs during code generation, including what was chosen, what alternatives were considered, and why.
Summary
Functions
Creates an event from a map (e.g., from JSON parsing).
Creates a new event with the given attributes.
Converts an event to a map suitable for JSON encoding.
Validates an event struct.
Types
@type event_type() ::
:hypothesis_formed
| :alternative_rejected
| :constraint_evaluated
| :pattern_applied
| :ambiguity_flagged
| :confidence_updated
| :training_started
| :training_completed
| :epoch_started
| :epoch_completed
| :batch_processed
| :loss_computed
| :metric_recorded
| :gradient_computed
| :checkpoint_saved
| :checkpoint_loaded
| :early_stopped
| :deployment_started
| :model_loaded
| :inference_completed
| :deployment_completed
| :reward_received
| :policy_updated
| :experience_sampled
| :stage_started
| :stage_completed
@type t() :: %CrucibleTrace.Event{ alternatives: [String.t()], code_section: String.t() | nil, confidence: float(), decision: String.t(), depends_on: [String.t()], experiment_id: String.t() | nil, id: String.t(), metadata: map(), parent_id: String.t() | nil, reasoning: String.t(), spec_reference: String.t() | nil, stage_id: String.t() | nil, timestamp: DateTime.t(), type: event_type() }
Functions
Creates an event from a map (e.g., from JSON parsing).
Creates a new event with the given attributes.
Examples
iex> CrucibleTrace.Event.new(:hypothesis_formed, "Use GenServer for state", "Need concurrent state management")
%CrucibleTrace.Event{
type: :hypothesis_formed,
decision: "Use GenServer for state",
reasoning: "Need concurrent state management"
}
Converts an event to a map suitable for JSON encoding.
Validates an event struct.
Returns {:ok, event} if valid, {:error, reason} otherwise.