pub struct LearnableSwarmBuilder { /* private fields */ }Expand description
学習機能付き Swarm のビルダー
Orchestrator + LearningDaemon + Subscriber を統合構築する。
Implementations§
Source§impl LearnableSwarmBuilder
impl LearnableSwarmBuilder
Sourcepub fn with_learning(self, enabled: bool) -> Self
pub fn with_learning(self, enabled: bool) -> Self
学習機能を有効化
Note: LearningEventChannel の有効化は build() 時に行われる。
Sourcepub fn swarm_config(self, config: SwarmConfig) -> Self
pub fn swarm_config(self, config: SwarmConfig) -> Self
Swarm 設定を追加
Sourcepub fn add_worker(self, worker: Box<dyn WorkerAgent>) -> Self
pub fn add_worker(self, worker: Box<dyn WorkerAgent>) -> Self
Worker を追加
Sourcepub fn workers(self, workers: Vec<Box<dyn WorkerAgent>>) -> Self
pub fn workers(self, workers: Vec<Box<dyn WorkerAgent>>) -> Self
複数の Workers を追加
Sourcepub fn add_manager(self, manager: Box<dyn ManagerAgent>) -> Self
pub fn add_manager(self, manager: Box<dyn ManagerAgent>) -> Self
Manager を追加
Sourcepub fn managers(self, managers: Vec<Box<dyn ManagerAgent>>) -> Self
pub fn managers(self, managers: Vec<Box<dyn ManagerAgent>>) -> Self
複数の Managers を追加
Sourcepub fn batch_invoker(self, invoker: Box<dyn BatchInvoker>) -> Self
pub fn batch_invoker(self, invoker: Box<dyn BatchInvoker>) -> Self
BatchInvoker を設定
Sourcepub fn dependency_provider(
self,
provider: Box<dyn DependencyGraphProvider>,
) -> Self
pub fn dependency_provider( self, provider: Box<dyn DependencyGraphProvider>, ) -> Self
DependencyGraphProvider を設定
Sourcepub fn operator_provider(
self,
provider: Box<dyn OperatorProvider<NodeRules>>,
) -> Self
pub fn operator_provider( self, provider: Box<dyn OperatorProvider<NodeRules>>, ) -> Self
OperatorProvider を設定
Sourcepub fn extensions(self, extensions: Extensions) -> Self
pub fn extensions(self, extensions: Extensions) -> Self
Extensions を設定
Sourcepub fn dependency_graph(self, graph: DependencyGraph) -> Self
pub fn dependency_graph(self, graph: DependencyGraph) -> Self
DependencyGraph を設定
Sourcepub fn offline_model(self, model: OfflineModel) -> Self
pub fn offline_model(self, model: OfflineModel) -> Self
Offline model を設定
Sourcepub fn with_scenario_profile(self, profile: &ScenarioProfile) -> Self
pub fn with_scenario_profile(self, profile: &ScenarioProfile) -> Self
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) -> Self
pub fn prior_snapshot(self, snapshot: LearningSnapshot) -> Self
Prior snapshot を設定
Sourcepub fn learning_store(self, store: LearningStore) -> Self
pub fn learning_store(self, store: LearningStore) -> Self
LearningStore を設定(ロードなし、store のみ設定)
Sourcepub fn with_learning_store(self, store: LearningStore) -> Self
pub fn with_learning_store(self, store: LearningStore) -> Self
既存の LearningStore からシナリオデータを自動ロード
prior_snapshot, offline_model, data_dir を自動設定し、learning を有効化する。 EvalRunner など、store を保持し続ける必要がある場合に使用。
§Note
ロード時のクリティカルエラー(permission denied 等)は build() 時に返される。
NotFound(初回実行)は正常として扱われる。
Sourcepub fn train_trigger(self, trigger: Arc<dyn TrainTrigger>) -> Self
pub fn train_trigger(self, trigger: Arc<dyn TrainTrigger>) -> Self
Train trigger を設定
Sourcepub fn lifecycle_hook(self, hook: Box<dyn LifecycleHook>) -> Self
pub fn lifecycle_hook(self, hook: Box<dyn LifecycleHook>) -> Self
LifecycleHook を設定
Sourcepub fn enable_exploration(self, enabled: bool) -> Self
pub fn enable_exploration(self, enabled: bool) -> Self
Exploration を有効化
Sourcepub fn with_trace_subscriber(self, subscriber: Arc<dyn TraceSubscriber>) -> Self
pub fn with_trace_subscriber(self, subscriber: Arc<dyn TraceSubscriber>) -> Self
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>) -> Self
pub fn with_learning_store_path(self, path: impl AsRef<Path>) -> Self
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