File size: 5,124 Bytes
d4a9b53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23e13da
d4a9b53
 
 
 
6146371
d4a9b53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: "Planner/Jarvis"
description: "Generates plan with interactions with the user, used for the coder class"

_target_: Tachi67.JarvisFlowModule.Planner_JarvisFlow.instantiate_from_default_config

input_interface:
  - "goal"
  - "memory_files"

output_interface:
  - "plan"
  - "status"
  - "summary"

### Subflows specification
subflows_config:
  Controller:
    _target_: Tachi67.PlanWriterFlowModule.PlanWriterCtrlFlow.instantiate_from_default_config
    backend:
      api_infos: ???
      model_name:
        openai: gpt-4
        azure: azure/gpt-4

  Executor:
    _target_: flows.base_flows.BranchingFlow.instantiate_from_default_config
    subflows_config:
      write_plan:
        subflows_config:
          PlanGenerator:
            backend:
              api_infos: ???
              model_name:
                openai: gpt-4
                azure: azure/gpt-4
            system_message_prompt_template:
              _target_: flows.prompt_template.JinjaPrompt
              template: |2-
                You are the planner for Jarvis, an intelligent agent able to achieve goals by writing and running code, you write step-by-step plans for Jarvis to follow and execute.

                Jarvis is capable of:
                  1. Generating and running code, given a goal.
                  2. Giving a final answer to the user when the goal is achieved, it is also possible that Jarvis is able to give a final answer without writing and running code.
                
                **Your task is: given a goal to achieve, decompose the goal into step-by-step plans for Jarvis, each step of your plan should ONLY involve one of the following:
                  1. Write and run code with a given goal generated by you, the goal should be a sub-goal of the current goal, it should be nicely separated from other-subgoals.
                  2. Give a final answer.**

                Here are some criteria you should consider in order to write a good plan:
                  1. The plan should be nicely separated into steps, each step should involve either writing & running code, or giving a final answer.
                  2. Decompose the goal into sub-goals, each sub-goal should be nicely separated from other sub-goals, all the sub-goals should be logically linked in order to process each sub-goal to achieve the final goal.
                
                Performance Evaluation:
                  1. Your plan must be as explicit, well-indented, and human-readable as possible. 
                  2. Your plan must be step-by-step with number indexes, each step involves either writing & running code or giving a final answer.
                  3. You should make plans with as few steps as possible.
                
                
                **Here is an example of a good plan:**
                Goal: Send an email with the data of the weather in Paris of 19. Dec. 2021 to my friend.
                Plan:
                  1. Write and run code to get the data of the weather in Paris of 19. Dec. 2021.
                  2. Write and run code to send an email with the data of the weather in Paris of 19. Dec. 2021 to my friend.
                  3. Give a final answer to the user.

                **It's important that you should only respond in JSON format as described below:**
                Response Format:
                {
                "plan": "A well indented string, containing a step-by-step plan to finish the given goal",
                }
                Ensure your responses can be parsed by Python json.loads
                **Make sure that the plan you generate is a well-indented human readable string, with numbered indexes for each step.**

          PlanFileEditor:
            _target_: Tachi67.PlanFileEditFlowModule.PlanFileEditAtomicFlow.instantiate_from_default_config

          ParseFeedback:
            _target_: Tachi67.ParseFeedbackFlowModule.ParseFeedbackAtomicFlow.instantiate_from_default_config
            input_interface:
              - "temp_plan_file_location"
            output_interface:
              - "plan"
              - "feedback"

      ask_user:
        _target_: Tachi67.PlanWriterFlowModule.PlanWriterAskUserFlow.instantiate_from_default_config


early_exit_key: "EARLY_EXIT"

topology:
  - goal: "Select the next action and prepare the input for the executor."
    input_interface:
      _target_: flows.interfaces.KeyInterface
      additional_transformations:
        - _target_: flows.data_transformations.KeyMatchInput
    flow: Controller
    output_interface:
      _target_: Planner_JarvisFlow.detect_finish_or_continue
    reset: false

  - goal: "Execute the action specified by the Controller."
    input_interface:
      _target_: flows.interfaces.KeyInterface
      keys_to_rename:
        command: branch
        command_args: branch_input_data
      keys_to_select: ["branch", "branch_input_data"]
    flow: Executor
    output_interface:
      _target_: flows.interfaces.KeyInterface
      keys_to_rename:
        branch_output_data: observation
      keys_to_unpack: ["observation"]
    reset: false