Skip to main content

Module record

Module record 

Source
Expand description

Record - 生イベントの抽象化

§設計思想

全ての Record は Event から変換されなければならない。

[External Events]                    [Learn Domain Records (DTO)]
ActionEvent ─────────────────────▶ ActionRecord ──────────────┐
LlmDebugEvent ───────────────────▶ LlmCallRecord ─────────────┤
LearningEvent::DependencyGraph ──▶ DependencyGraphRecord ─────├──▶ Record ──▶ Episode
LearningEvent::StrategyAdvice ───▶ StrategyAdviceRecord ──────┤
LearningEvent::LearnStatsSnapshot ▶ LearnStatsRecord ─────────┘

§EventSource trait

新しい Record を追加する際は [EventSource] trait を実装すること。 これにより From<&Event> 実装が強制される。

// 各 record ファイルで実装
impl EventSource for MyRecord {
    type Event = MyEvent;
}

impl From<&MyEvent> for MyRecord {
    fn from(event: &MyEvent) -> Self { ... }
}

§Checklist (新規 Record 追加時)

  1. record/ に新しいファイルを作成
  2. Record 構造体を定義
  3. 対応する Event を定義(または既存 Event に variant 追加)
  4. From<&Event> for *Record を同ファイルに実装
  5. EventSource trait を実装
  6. mod.rsRecord enum variant を追加
  7. mod.rsFrom<&Event> for Record のルーティングを追加
  8. FromRecord trait を実装

Structs§

ActionRecord
アクション実行の記録
DependencyGraphRecord
DependencyGraph 推論の記録
LearnStatsRecord
LearnStats スナップショット記録
LlmCallRecord
LLM呼び出しの記録
RecordStream
Record のストリームを操作するためのヘルパー
StrategyAdviceRecord
LLM 戦略アドバイス記録

Enums§

Record
生イベントから変換された Record

Traits§

FromRecord
Record から特定の型を抽出するための Trait