pub struct DependencyGraph { /* private fields */ }Expand description
アクション依存グラフ
タスクに対して LLM が生成したアクション間の依存関係。 探索時はこのグラフに従ってアクションを選択する。
Implementations§
Source§impl DependencyGraph
impl DependencyGraph
Sourcepub fn builder() -> DependencyGraphBuilder
pub fn builder() -> DependencyGraphBuilder
Builder パターンでグラフを構築
Sourcepub fn valid_next_actions(&self, current_action: &str) -> Vec<String>
pub fn valid_next_actions(&self, current_action: &str) -> Vec<String>
指定アクションの後に実行可能なアクションを取得
確信度順にソートして返す。
Sourcepub fn start_actions(&self) -> Vec<String>
pub fn start_actions(&self) -> Vec<String>
開始可能なアクションを取得
アルファベット順にソートして一貫した順序を保証。
Sourcepub fn terminal_actions(&self) -> Vec<String>
pub fn terminal_actions(&self) -> Vec<String>
終端アクションを取得
アルファベット順にソートして一貫した順序を保証。
Sourcepub fn is_terminal(&self, action: &str) -> bool
pub fn is_terminal(&self, action: &str) -> bool
指定アクションが終端か
Sourcepub fn can_transition(&self, from: &str, to: &str) -> bool
pub fn can_transition(&self, from: &str, to: &str) -> bool
指定アクションから指定アクションへの遷移が有効か
Sourcepub fn edges(&self) -> &[DependencyEdge]
pub fn edges(&self) -> &[DependencyEdge]
全エッジを取得
Sourcepub fn available_actions(&self) -> &[String]
pub fn available_actions(&self) -> &[String]
利用可能なアクション一覧を取得
Sourcepub fn discover_order(&self) -> &[String]
pub fn discover_order(&self) -> &[String]
Discover アクションの順序を取得
Sourcepub fn not_discover_order(&self) -> &[String]
pub fn not_discover_order(&self) -> &[String]
NotDiscover アクションの順序を取得
Sourcepub fn set_action_order(
&mut self,
discover: Vec<String>,
not_discover: Vec<String>,
)
pub fn set_action_order( &mut self, discover: Vec<String>, not_discover: Vec<String>, )
アクション順序を設定
Sourcepub fn has_action_order(&self) -> bool
pub fn has_action_order(&self) -> bool
アクション順序が設定されているか
Sourcepub fn set_learn_record(&mut self, record: DependencyGraphRecord)
pub fn set_learn_record(&mut self, record: DependencyGraphRecord)
学習用記録を設定
Sourcepub fn learn_record(&self) -> Option<&DependencyGraphRecord>
pub fn learn_record(&self) -> Option<&DependencyGraphRecord>
学習用記録を取得
Sourcepub fn take_learn_record(&mut self) -> Option<DependencyGraphRecord>
pub fn take_learn_record(&mut self) -> Option<DependencyGraphRecord>
学習用記録を取り出し(所有権移動)
Sourcepub fn validate(&self) -> Result<(), DependencyGraphError>
pub fn validate(&self) -> Result<(), DependencyGraphError>
グラフが有効か検証
- 少なくとも1つの開始ノードがある
- 少なくとも1つの終端ノードがある
- 全エッジのアクションが available_actions に含まれる
- 全開始ノードが available_actions に含まれる
- 全終端ノードが available_actions に含まれる
Sourcepub fn to_mermaid(&self) -> String
pub fn to_mermaid(&self) -> String
グラフを Mermaid 形式で出力
Trait Implementations§
Source§impl Clone for DependencyGraph
impl Clone for DependencyGraph
Source§fn clone(&self) -> DependencyGraph
fn clone(&self) -> DependencyGraph
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DependencyGraph
impl Debug for DependencyGraph
Source§impl Default for DependencyGraph
impl Default for DependencyGraph
Source§fn default() -> DependencyGraph
fn default() -> DependencyGraph
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DependencyGraph
impl<'de> Deserialize<'de> for DependencyGraph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&DependencyGraph> for NodeRules
impl From<&DependencyGraph> for NodeRules
Source§fn from(graph: &DependencyGraph) -> Self
fn from(graph: &DependencyGraph) -> Self
Converts to this type from the input type.
Source§impl From<DependencyGraph> for NodeRules
impl From<DependencyGraph> for NodeRules
Source§fn from(graph: DependencyGraph) -> Self
fn from(graph: DependencyGraph) -> Self
DependencyGraph(ドメイン固有)から NodeRules(ドメイン非依存)へ変換
- edges → successors + edge_confidence
- start_nodes → roots
- terminal_nodes → terminals
- param_variants → param_variants
Auto Trait Implementations§
impl Freeze for DependencyGraph
impl RefUnwindSafe for DependencyGraph
impl Send for DependencyGraph
impl Sync for DependencyGraph
impl Unpin for DependencyGraph
impl UnwindSafe for DependencyGraph
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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