Tachi67's picture
add more docs & comments
12790c9 verified

Table of Contents

Structure of InteractivePlanGenFlow

               goal
                |
                |
                |
                v
        +------------------+                     
        |   PlanGenerator  |  Generates plan given goal. (https://huggingface.co/aiflows/PlanGeneratorFlowModule)
        +------------------+                     
                |
                | (plan)
                |
                v
        +-------------------+
        |  PlanFileEdit     | Edit a temp file with the plan generated. (https://huggingface.co/aiflows/PlanFileEditFlowModule)
        +-------------------+                        
                |                                
                |  (temp_plan_file_location)
                |                                
                v                                
        +------------------+                     
        |   ParseFeedback  |  Opens up the temp file until user closes the file, parse for user feedback. (https://huggingface.co/aiflows/ParseFeedbackFlowModule)
        +------------------+                     
                |                                
                | (plan, feedback)                      
                |                                
                v                                            
             plan, feedback     

run

InteractivePlanGenFlow

InteractivePlanGenFlow Objects

class InteractivePlanGenFlow(SequentialFlow)

This flow writes code in an interactive manner. It is a sequential flow composed of:

  1. PlanGenerator: generates plan based on the goal.
  2. PlanFileEditor: writes the generated plan to a temp file for the user to see, edit and provide feedback.
  3. ParseFeedback: opens up the temp file with vscode and parses the feedback from the user.

Input Interface:

  • goal
  • plan_file_location

Output Interface:

  • plan
  • feedback
  • temp_plan_file_location

Configuration Parameters:

  • input_interface: the input interface of the flow.
  • output_interface: the output interface of the flow.
  • subflows_config: the configuration of the subflows.
  • early_exit_key: the key in the state dict that indicates whether the flow should exit early.
  • topology: the topology of the subflows.

__init__

def __init__(**kwargs)

This function initializes the flow.

Arguments:

  • kwargs (Dict[str, Any]): the configuration of the flow.

instantiate_from_config

@classmethod
def instantiate_from_config(cls, config)

This function instantiates the flow from a configuration.

Arguments:

  • config (Dict[str, Any]): the configuration of the flow.

Returns:

InteractivePlanGenFlow: the instantiated flow.

run

def run(input_data: Dict[str, Any]) -> Dict[str, Any]

This function runs the flow.

Arguments:

  • input_data (Dict[str, Any]): the input data of the flow.

Returns:

Dict[str, Any]: the output data of the flow.

__init__