File size: 4,531 Bytes
fbcd24f
4462cc9
 
 
 
 
 
 
 
 
 
 
 
eb538dc
4462cc9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb538dc
 
 
4462cc9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb538dc
4462cc9
 
 
9a22fe4
4462cc9
 
 
 
 
 
 
 
 
 
 
9a22fe4
4462cc9
 
 
 
 
9de62e3
 
 
eb538dc
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
_target_: Tachi67.PlanWriterFlowModule.PlanWriterCtrlFlow.instantiate_from_default_config
name: "PlanWriterControllerFlow"
description: "Proposes the next action to take towards achieving the goal, and prepares the input for the branching flow"
enable_cache: True

#######################################################
# Input keys
#######################################################

input_interface_non_initialized: # initial input keys
  - "goal"

input_interface_initialized:
  - "goal"
  - "plan"
  - "feedback"

#######################################################
# Output keys
#######################################################

output_interface:
  - 'command'
  - 'command_args'

backend:
  api_infos: ???
  model_name:
    openai: gpt-4
    azure: azure/gpt-4

commands:
  write_plan:
    description: "Write plan to finish the goal with user interaction"
    input_args: ["goal"]
  finish:
    description: "Signal that the objective has been satisfied, return the summary of what was done"
    input_args: ["summary"]
  manual_finish:
    description: "The user demands to quit and terminate the current process"
    input_args: []
  ask_user:
    description: "Ask user a question for confirmation or assistance"
    input_args: ["question"]

system_message_prompt_template:
  _target_: langchain.PromptTemplate
  template: |2-
          You are in charge of a department of writing plans to solve a certain goal. You work with a planner, who does all the planning job.
    
          Your **ONLY** task is to take the user's goal for you, to decide whether to call the planner to write or re-write the plan, or to finish the current task.
    
          Here is the goal you need to achieve:
          {{goal}}
          
          When you need to call the plan writer, call the `write_plan` command with the goal specified.
          When the plan is written and the user is satisfied, call the `finish` command to terminate the current process with a summary of what was done in one sentence.
          Whenever you are in doubt, or need to confirm something to the user, call `ask_user` with the question.
          
          You **must not** write plans yourself. You only decide whether to call the planner with specified goals or to finish.
    
          Your workflow:
          0. Whenever the user demands to quit or terminate the current process, call `manual_finish` command.
          1. Upon user request, call the `write_plan` with the goal given.
          2. The planner will write the plan. The user will examine the plan, and provide feedback.
          3. Depending on the feedback of the user:
            3.1. The user provides feedback on how to change the plan, **call the planner with user's specific requirements again, to ask the planner to refine the plan**. Go back to step 2.
            3.2. The user does not provide details about refining the plan, for example, just stating the fact that the user has updated the plan, **this means the user is satisfied with the plan written, call the `finish` command.**
            3.3. The user is satisfied with the plan, **call the `finish` command with a summary of what was done**
                    
          If you have completed all your tasks, make sure to use the "finish" command, with a summary of what was done.
    
          Constraints:
          1. Exclusively use the commands listed in double quotes e.g. "command name"
          
          Your response **MUST** be in the following format:
              Response Format:
              {
              "command": "call plan writer, or to finish",
              "command_args": {
                  "arg name": "value"
                  }
              }
          Ensure your responses can be parsed by Python json.loads
          
  
          Available Functions:
          {{commands}}
  input_variables: ["commands", "goal"]
  template_format: jinja2

human_message_prompt_template:
  _target_: aiflows.prompt_template.JinjaPrompt
  template: |2-
    Here is the plan written by the planner, it might have been updated by the user, depending on the user's feedback:
    {{plan}}
    Here is the feedback from the user:
    {{feedback}}
  input_variables:
    - "plan"
    - "feedback"
  template_format: jinja2

init_human_message_prompt_template:
  _target_: aiflows.prompt_template.JinjaPrompt
  template: |2-
    Here is the goal you need to achieve:
    {{goal}}
  input_variables:
    - "goal"
  template_format: jinja2

previous_messages:
  last_k: 3