File size: 3,331 Bytes
e97f8cf
 
 
 
 
 
 
 
 
 
 
2acff8b
bdec769
 
e97f8cf
 
30ff857
e97f8cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
013c284
e97f8cf
 
 
 
 
 
 
fba1ff2
e97f8cf
 
 
 
 
 
 
 
 
 
 
013c284
e97f8cf
013c284
e97f8cf
 
 
 
 
 
 
 
013c284
e97f8cf
 
 
 
 
 
013c284
3026619
e97f8cf
3026619
 
 
e97f8cf
 
 
 
013c284
e97f8cf
013c284
e97f8cf
 
 
 
 
013c284
e97f8cf
013c284
e97f8cf
 
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Abstract class, should provide more information in subclasses

_target_: Tachi67.AbstractBossFlowModule.CtrlExMemFlow.instantiate_from_default_config

name: "AbstractCtrlExMemFlow"
description: "Abstract class of controller-executor flow with mem reading and mem writing"
max_rounds: 30

input_interface:
  - "plan"
  - "memory_files"
  - "goal"
  - "logs"
  
output_interface:
  - "summary"
  - "result"

subflows_config:
  Controller:
    _target_: ??? # controller of the flow, could be a subclass of ChatAtomic flow, see https://huggingface.co/Tachi67/CodeWriterFlowModule/blob/main/CodeWriterCtrlFlow.py
    backend:
      api_infos: ???
      model_name:
        openai: gpt-4
        azure: azure/gpt-4
    # In subclasses, should provide specific command and command args.
# E.g.,
#    commands:
#      wiki_search:
#        description: "Performs a search on Wikipedia."
#        input_args: ["search_term"]

  Executor:
     _target_: aiflows.base_flows.BranchingFlow.instantiate_from_default_config
    # In subclasses, should provide what are the branches of executors
# E.g.,
#    subflows_config:
#      wiki_search:
#        _target_: .WikiSearchAtomicFlow.instantiate_from_default_config

  MemoryWriting:
    _target_: Tachi67.MemoryWritingFlowModule.MemoryWritingAtomicFlow.instantiate_from_default_config
    # default input interface is summary & memory_files

  MemoryReading:
    _target_: Tachi67.MemoryReadingFlowModule.MemoryReadingAtomicFlow.instantiate_from_default_config
    # should provide the output of MemRead in the CtrlExMem flow e.g. plan, logs, code_library
    # output is then like {"plan":"plan string", "code_library": "function signatures in the code library"}
    # default output interface is code_library

topology:
  - goal: "Select the next action and prepare the input for the executor."
    input_interface:
      _target_: aiflows.interfaces.KeyInterface
      additional_transformations:
        - _target_: aiflows.data_transformations.KeyMatchInput
    flow: Controller
    output_interface: ???
      # In subclasses, should provide name of function name of output processor
      #_target_: Controller.detect_finish_or_continue
    reset: false

  - goal: "Execute the action specified by the Controller."
    input_interface:
      _target_: aiflows.interfaces.KeyInterface
      keys_to_rename:
        command: branch
        command_args: branch_input_data
      keys_to_select: ["branch", "branch_input_data"]
    flow: Executor
    output_interface:
      _target_: aiflows.interfaces.KeyInterface
      # in subclasses, should provide corresponding output interface of branches      
      keys_to_rename:
        branch_output_data.summary: summary
        branch_output_data.result: result
      keys_to_delete: [ "branch_output_data" ]
    reset: false

  - goal: "Write memory to memory files"
    input_interface:
      _target_: aiflows.interfaces.KeyInterface
      additional_transformations:
        - _target_: aiflows.data_transformations.KeyMatchInput
    flow: MemoryWriting
    reset: false

  - goal: "Read memory from memory files (flow_state)"
    input_interface:
      _target_: aiflows.interfaces.KeyInterface
      additional_transformations:
        - _target_: aiflows.data_transformations.KeyMatchInput
    flow: MemoryReading
    reset: false