Skip to main content

DependencyGraph

Struct DependencyGraph 

Source
pub struct DependencyGraph { /* private fields */ }
Expand description

アクション依存グラフ

タスクに対して LLM が生成したアクション間の依存関係。 探索時はこのグラフに従ってアクションを選択する。

Implementations§

Source§

impl DependencyGraph

Source

pub fn new() -> Self

空のグラフを作成

Source

pub fn builder() -> DependencyGraphBuilder

Builder パターンでグラフを構築

Source

pub fn valid_next_actions(&self, current_action: &str) -> Vec<String>

指定アクションの後に実行可能なアクションを取得

確信度順にソートして返す。

Source

pub fn start_actions(&self) -> Vec<String>

開始可能なアクションを取得

アルファベット順にソートして一貫した順序を保証。

Source

pub fn terminal_actions(&self) -> Vec<String>

終端アクションを取得

アルファベット順にソートして一貫した順序を保証。

Source

pub fn is_terminal(&self, action: &str) -> bool

指定アクションが終端か

Source

pub fn is_start(&self, action: &str) -> bool

指定アクションが開始ノードか

Source

pub fn can_transition(&self, from: &str, to: &str) -> bool

指定アクションから指定アクションへの遷移が有効か

Source

pub fn transition_confidence(&self, from: &str, to: &str) -> Option<f64>

遷移の確信度を取得

Source

pub fn edges(&self) -> &[DependencyEdge]

全エッジを取得

Source

pub fn task(&self) -> &str

タスク説明を取得

Source

pub fn available_actions(&self) -> &[String]

利用可能なアクション一覧を取得

Source

pub fn param_variants(&self, action: &str) -> Option<(&str, &[String])>

指定アクションのパラメータバリアントを取得

Source

pub fn all_param_variants(&self) -> &HashMap<String, (String, Vec<String>)>

全パラメータバリアントを取得

Source

pub fn discover_order(&self) -> &[String]

Discover アクションの順序を取得

Source

pub fn not_discover_order(&self) -> &[String]

NotDiscover アクションの順序を取得

Source

pub fn set_action_order( &mut self, discover: Vec<String>, not_discover: Vec<String>, )

アクション順序を設定

Source

pub fn has_action_order(&self) -> bool

アクション順序が設定されているか

Source

pub fn set_learn_record(&mut self, record: DependencyGraphRecord)

学習用記録を設定

Source

pub fn learn_record(&self) -> Option<&DependencyGraphRecord>

学習用記録を取得

Source

pub fn take_learn_record(&mut self) -> Option<DependencyGraphRecord>

学習用記録を取り出し(所有権移動)

Source

pub fn validate(&self) -> Result<(), DependencyGraphError>

グラフが有効か検証

  • 少なくとも1つの開始ノードがある
  • 少なくとも1つの終端ノードがある
  • 全エッジのアクションが available_actions に含まれる
  • 全開始ノードが available_actions に含まれる
  • 全終端ノードが available_actions に含まれる
Source

pub fn to_mermaid(&self) -> String

グラフを Mermaid 形式で出力

Trait Implementations§

Source§

impl Clone for DependencyGraph

Source§

fn clone(&self) -> DependencyGraph

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DependencyGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DependencyGraph

Source§

fn default() -> DependencyGraph

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for DependencyGraph

Source§

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

Source§

fn from(graph: &DependencyGraph) -> Self

Converts to this type from the input type.
Source§

impl From<DependencyGraph> for NodeRules

Source§

fn from(graph: DependencyGraph) -> Self

DependencyGraph(ドメイン固有)から NodeRules(ドメイン非依存)へ変換

  • edges → successors + edge_confidence
  • start_nodes → roots
  • terminal_nodes → terminals
  • param_variants → param_variants
Source§

impl Serialize for DependencyGraph

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,