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