File size: 1,994 Bytes
8a7fcb3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a44c20f
8a7fcb3
a44c20f
8a7fcb3
 
 
 
 
 
a44c20f
8a7fcb3
 
 
 
 
 
 
 
a44c20f
8a7fcb3
a44c20f
8a7fcb3
 
 
 
 
 
a44c20f
8a7fcb3
a44c20f
8a7fcb3
 
 
 
 
 
a44c20f
8a7fcb3
 
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: "Plan_Code_Flow"
description: |2- 
  Given a problem description, first generate a solution strategy, reflect on it, and then implement the code.

# ~~~ Input interface specification ~~~
input_interface:
  - "problem_description"
  - "input_description"
  - "output_description"
  - "io_examples_and_explanation"

# ~~~ Output interface specification ~~~
output_interface:
  - "code"

subflows_config:
  PlanGenerator:
    _target_: .CF_PlanReflect.instantiate_from_default_config
  CodeGenerator:
    _target_: .CF_CodeWithPlan.instantiate_from_default_config

### Topology specification (specifies how the sequence of messages will flow from one of the subflows to another)
topology:
  # ~~~ Plan Generator ~~~
  - goal: "Generate a plan and reflect on it."

    ### Input Interface
    input_interface:
      _target_: aiflows.interfaces.KeyInterface
      additional_transformations:
        - _target_: aiflows.data_transformations.KeyMatchInput

    ### Flow Specification
    flow: PlanGenerator

    ### Output Interface
    output_interface:
      _target_: aiflows.interfaces.KeyInterface
      keys_to_select:
        - "plan"

  # ~~~ Code Generator ~~~
  - goal: "Generate/refine a solution."

    ### Input Interface
    input_interface:
      _target_: aiflows.interfaces.KeyInterface
      additional_transformations:
        - _target_: aiflows.data_transformations.KeyMatchInput

    ### Flow Specification
    flow: CodeGenerator

    ### Output Interface
    output_interface:
      _target_: aiflows.interfaces.KeyInterface
      additional_transformations:
        - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
          regex: '(?<=```python)([\s\S]*?)(?=```)'
          regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
          input_key: "api_output"
          output_key: "code"
          strip: True
          assert_unique: True
        - _target_: aiflows.data_transformations.PrintPreviousMessages
      keys_to_select:
        - "code"