capability_example/
grower_flow_strategy.rs

1// ---------------- [ File: capability-example/src/grower_flow_strategy.rs ]
2crate::ix!();
3
4/// A trait representing how we fill in any missing partial-model fields.
5/// We can have multiple implementations of this:
6///  - `ManualFlowStrategy` (prints query text to a file + instructs user to paste the JSON)
7///  - `AutomatedFlowStrategy` (calls the language model client automatically)
8#[async_trait]
9pub trait GrowerFlowStrategy: Send + Sync {
10    /// Handle the scenario where we need a new JustifiedGrowerTreeConfiguration.
11    /// Returns `Ok(Some(config))` if we successfully filled in that piece, `Ok(None)` if we choose to do nothing,
12    /// or an error if an unrecoverable failure happened.
13    async fn fill_justified_tree_configuration(
14        &self,
15        partial: &PartiallyGrownModel,
16        grower_inputs: &GrowerInputs,
17    ) -> Result<Option<JustifiedGrowerTreeConfiguration>, ManualGrowerFlowError>;
18
19    /// Handle the scenario where we have a JustifiedGrowerTreeConfiguration but need a JustifiedStringSkeleton.
20    async fn fill_justified_string_skeleton(
21        &self,
22        partial: &PartiallyGrownModel,
23        grower_inputs: &GrowerInputs,
24        tree_conf: &JustifiedGrowerTreeConfiguration,
25    ) -> Result<Option<JustifiedStringSkeleton>, ManualGrowerFlowError>;
26
27    /// Handle the scenario where we need a CoreStringSkeleton.
28    async fn fill_core_string_skeleton(
29        &self,
30        partial: &PartiallyGrownModel,
31        grower_inputs: &GrowerInputs,
32        tree_conf: &JustifiedGrowerTreeConfiguration,
33        stripped_skel: &StrippedStringSkeleton,
34    ) -> Result<Option<CoreStringSkeleton>, ManualGrowerFlowError>;
35
36    /// Handle the scenario where we need AnnotatedLeafHolderExpansions.
37    async fn fill_annotated_leaf_holder_expansions(
38        &self,
39        partial: &PartiallyGrownModel,
40        grower_inputs: &GrowerInputs,
41        tree_conf: &JustifiedGrowerTreeConfiguration,
42        core_skel: &CoreStringSkeleton,
43    ) -> Result<Option<AnnotatedLeafHolderExpansions>, ManualGrowerFlowError>;
44}