pub struct LearnableSwarmBuilder { /* private fields */ }Expand description
学習機能付き Swarm のビルダー
Orchestrator + LearningDaemon + Subscriber を統合構築する。
Implementations§
Source§impl LearnableSwarmBuilder
impl LearnableSwarmBuilder
Sourcepub fn new(runtime: Handle) -> LearnableSwarmBuilder
pub fn new(runtime: Handle) -> LearnableSwarmBuilder
新しいビルダーを作成
Sourcepub fn scenario(self, name: impl Into<String>) -> LearnableSwarmBuilder
pub fn scenario(self, name: impl Into<String>) -> LearnableSwarmBuilder
シナリオ名を設定
Sourcepub fn with_learning(self, enabled: bool) -> LearnableSwarmBuilder
pub fn with_learning(self, enabled: bool) -> LearnableSwarmBuilder
学習機能を有効化
Note: LearningEventChannel の有効化は build() 時に行われる。
Sourcepub fn data_dir(self, path: impl Into<PathBuf>) -> LearnableSwarmBuilder
pub fn data_dir(self, path: impl Into<PathBuf>) -> LearnableSwarmBuilder
データディレクトリを設定
Sourcepub fn swarm_config(self, config: SwarmConfig) -> LearnableSwarmBuilder
pub fn swarm_config(self, config: SwarmConfig) -> LearnableSwarmBuilder
Swarm 設定を追加
Sourcepub fn add_worker(self, worker: Box<dyn WorkerAgent>) -> LearnableSwarmBuilder
pub fn add_worker(self, worker: Box<dyn WorkerAgent>) -> LearnableSwarmBuilder
Worker を追加
Sourcepub fn workers(
self,
workers: Vec<Box<dyn WorkerAgent>>,
) -> LearnableSwarmBuilder
pub fn workers( self, workers: Vec<Box<dyn WorkerAgent>>, ) -> LearnableSwarmBuilder
複数の Workers を追加
Sourcepub fn add_manager(
self,
manager: Box<dyn ManagerAgent>,
) -> LearnableSwarmBuilder
pub fn add_manager( self, manager: Box<dyn ManagerAgent>, ) -> LearnableSwarmBuilder
Manager を追加
Sourcepub fn managers(
self,
managers: Vec<Box<dyn ManagerAgent>>,
) -> LearnableSwarmBuilder
pub fn managers( self, managers: Vec<Box<dyn ManagerAgent>>, ) -> LearnableSwarmBuilder
複数の Managers を追加
Sourcepub fn batch_invoker(
self,
invoker: Box<dyn BatchInvoker>,
) -> LearnableSwarmBuilder
pub fn batch_invoker( self, invoker: Box<dyn BatchInvoker>, ) -> LearnableSwarmBuilder
BatchInvoker を設定
Sourcepub fn dependency_provider(
self,
provider: Box<dyn DependencyGraphProvider>,
) -> LearnableSwarmBuilder
pub fn dependency_provider( self, provider: Box<dyn DependencyGraphProvider>, ) -> LearnableSwarmBuilder
DependencyGraphProvider を設定
Sourcepub fn operator_provider(
self,
provider: Box<dyn OperatorProvider<NodeRules>>,
) -> LearnableSwarmBuilder
pub fn operator_provider( self, provider: Box<dyn OperatorProvider<NodeRules>>, ) -> LearnableSwarmBuilder
OperatorProvider を設定
Sourcepub fn extensions(self, extensions: Extensions) -> LearnableSwarmBuilder
pub fn extensions(self, extensions: Extensions) -> LearnableSwarmBuilder
Extensions を設定
Sourcepub fn dependency_graph(self, graph: DependencyGraph) -> LearnableSwarmBuilder
pub fn dependency_graph(self, graph: DependencyGraph) -> LearnableSwarmBuilder
DependencyGraph を設定
Sourcepub fn offline_model(self, model: OfflineModel) -> LearnableSwarmBuilder
pub fn offline_model(self, model: OfflineModel) -> LearnableSwarmBuilder
Offline model を設定
Sourcepub fn with_scenario_profile(
self,
profile: &ScenarioProfile,
) -> LearnableSwarmBuilder
pub fn with_scenario_profile( self, profile: &ScenarioProfile, ) -> LearnableSwarmBuilder
ScenarioProfile から OfflineModel を生成して設定
ScenarioProfile の各コンポーネント(LearnedExploration, LearnedStrategy, LearnedDepGraph) を OfflineModel に変換し、Orchestrator に適用する。
§Example
use swarm_engine_core::learn::{LearnableSwarmBuilder, ScenarioProfile};
let profile = load_profile("troubleshooting")?;
let swarm = LearnableSwarmBuilder::new(runtime.handle().clone())
.with_scenario_profile(&profile)
.build()?;Sourcepub fn offline_model_ref(&self) -> Option<&OfflineModel>
pub fn offline_model_ref(&self) -> Option<&OfflineModel>
Offline model への参照を取得(build 前に参照する場合)
Sourcepub fn prior_snapshot(self, snapshot: LearningSnapshot) -> LearnableSwarmBuilder
pub fn prior_snapshot(self, snapshot: LearningSnapshot) -> LearnableSwarmBuilder
Prior snapshot を設定
Sourcepub fn learning_store(self, store: LearningStore) -> LearnableSwarmBuilder
pub fn learning_store(self, store: LearningStore) -> LearnableSwarmBuilder
LearningStore を設定(ロードなし、store のみ設定)
Sourcepub fn with_learning_store(self, store: LearningStore) -> LearnableSwarmBuilder
pub fn with_learning_store(self, store: LearningStore) -> LearnableSwarmBuilder
既存の LearningStore からシナリオデータを自動ロード
prior_snapshot, offline_model, data_dir を自動設定し、learning を有効化する。 EvalRunner など、store を保持し続ける必要がある場合に使用。
§Note
ロード時のクリティカルエラー(permission denied 等)は build() 時に返される。
NotFound(初回実行)は正常として扱われる。
Sourcepub fn train_trigger(
self,
trigger: Arc<dyn TrainTrigger>,
) -> LearnableSwarmBuilder
pub fn train_trigger( self, trigger: Arc<dyn TrainTrigger>, ) -> LearnableSwarmBuilder
Train trigger を設定
Sourcepub fn lifecycle_hook(
self,
hook: Box<dyn LifecycleHook>,
) -> LearnableSwarmBuilder
pub fn lifecycle_hook( self, hook: Box<dyn LifecycleHook>, ) -> LearnableSwarmBuilder
LifecycleHook を設定
Sourcepub fn enable_exploration(self, enabled: bool) -> LearnableSwarmBuilder
pub fn enable_exploration(self, enabled: bool) -> LearnableSwarmBuilder
Exploration を有効化
Sourcepub fn with_trace_subscriber(
self,
subscriber: Arc<dyn TraceSubscriber>,
) -> LearnableSwarmBuilder
pub fn with_trace_subscriber( self, subscriber: Arc<dyn TraceSubscriber>, ) -> LearnableSwarmBuilder
TraceSubscriber を設定(ActionEvent のトレース出力)
§Example
use swarm_engine_core::events::{InMemoryTraceSubscriber, JsonlTraceSubscriber};
// InMemory: 最後にまとめて出力
let trace = Arc::new(InMemoryTraceSubscriber::new());
builder.with_trace_subscriber(trace.clone());
// Jsonl: リアルタイム出力
let trace = Arc::new(JsonlTraceSubscriber::new("trace.jsonl")?);
builder.with_trace_subscriber(trace);Sourcepub fn with_learning_store_path(
self,
path: impl AsRef<Path>,
) -> LearnableSwarmBuilder
pub fn with_learning_store_path( self, path: impl AsRef<Path>, ) -> LearnableSwarmBuilder
LearningStore からシナリオデータを自動ロード(パス指定)
prior_snapshot と offline_model を自動設定する。
§Note
Store 作成失敗やロード時のクリティカルエラーは build() 時に返される。
Sourcepub fn build(self) -> Result<LearnableSwarm, SwarmError>
pub fn build(self) -> Result<LearnableSwarm, SwarmError>
LearnableSwarm を構築
Auto Trait Implementations§
impl Freeze for LearnableSwarmBuilder
impl !RefUnwindSafe for LearnableSwarmBuilder
impl Send for LearnableSwarmBuilder
impl Sync for LearnableSwarmBuilder
impl Unpin for LearnableSwarmBuilder
impl !UnwindSafe for LearnableSwarmBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more