add docs and comments
Browse filesFiles changed (2)
13 unmodified lines14151617181920215 unmodified lines2728293031328 unmodified lines4142434445464748495013 unmodified lines*Output Interface*:- `plan`"""def __init__(self, **kwargs):super().__init__(**kwargs)self.hint_for_model = """Make sure your response is in the following format:5 unmodified lines@classmethoddef instantiate_from_config(cls, config):flow_config = deepcopy(config)kwargs = {"flow_config": flow_config}8 unmodified linesreturn cls(**kwargs)def _update_prompts_and_input(self, input_data: Dict[str, Any]):if 'goal' in input_data:input_data['goal'] += self.hint_for_modeldef run(self, input_data: Dict[str, Any]) -> Dict[str, Any]:self._update_prompts_and_input(input_data)while True:api_output = super().run(input_data)["api_output"].strip()13 unmodified lines1415161718192021222324252627282930313233343536375 unmodified lines434445464748495051525354558 unmodified lines64656667686970717273747576777879808182838485868713 unmodified lines*Output Interface*:- `plan`*Configuration Parameters*:- Also refer to ChatAtomicFlow (https://huggingface.co/aiflows/ChatFlowModule/blob/main/ChatAtomicFlow.py)- `input_interface_non_initialized`: The input interface when the conversation is not initialized.- `input_interface_initialized`: The input interface when the conversation is initialized.- `output_interface`: The output interface.- `backend`: The backend to use for the Chat API.- `system_message_prompt_template`: The template for the system message prompt.- `human_message_prompt_template`: The template for the human message prompt.- `init_human_message_prompt_template`: The initial human message prompt."""def __init__(self, **kwargs):"""This function instantiates the class.:param kwargs: The configuration parameters.:type kwargs: Dict[str, Any]"""super().__init__(**kwargs)self.hint_for_model = """Make sure your response is in the following format:5 unmodified lines@classmethoddef instantiate_from_config(cls, config):"""This function instantiates the class from a configuration.:param config: The configuration.:type config: Dict[str, Any]:return: The instantiated class.:rtype: ChatAtomicFlow"""flow_config = deepcopy(config)kwargs = {"flow_config": flow_config}8 unmodified linesreturn cls(**kwargs)def _update_prompts_and_input(self, input_data: Dict[str, Any]):"""This function updates the prompts and input data.:param input_data: The input data.:type input_data: Dict[str, Any]:return: None:rtype: None"""if 'goal' in input_data:input_data['goal'] += self.hint_for_modeldef run(self, input_data: Dict[str, Any]) -> Dict[str, Any]:"""This function runs the flow.:param input_data: The input data.:type input_data: Dict[str, Any]:return: The output data.:rtype: Dict[str, Any]"""self._update_prompts_and_input(input_data)while True:api_output = super().run(input_data)["api_output"].strip()
1 unmodified line23456719 unmodified lines2728293031321 unmodified line* [PlanGeneratorAtomicFlow](#PlanGeneratorAtomicFlow)* [PlanGeneratorAtomicFlow](#PlanGeneratorAtomicFlow.PlanGeneratorAtomicFlow)* [\_\_init\_\_](#__init__)<a id="PlanGeneratorAtomicFlow"></a>19 unmodified lines*Output Interface*:- `plan`<a id="__init__"></a># \_\_init\_\_1 unmodified line23456789101119 unmodified lines3132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011 unmodified line* [PlanGeneratorAtomicFlow](#PlanGeneratorAtomicFlow)* [PlanGeneratorAtomicFlow](#PlanGeneratorAtomicFlow.PlanGeneratorAtomicFlow)* [\_\_init\_\_](#PlanGeneratorAtomicFlow.PlanGeneratorAtomicFlow.__init__)* [instantiate\_from\_config](#PlanGeneratorAtomicFlow.PlanGeneratorAtomicFlow.instantiate_from_config)* [run](#PlanGeneratorAtomicFlow.PlanGeneratorAtomicFlow.run)* [run](#run)* [\_\_init\_\_](#__init__)<a id="PlanGeneratorAtomicFlow"></a>19 unmodified lines*Output Interface*:- `plan`*Configuration Parameters*:- Also refer to ChatAtomicFlow (https://huggingface.co/aiflows/ChatFlowModule/blob/main/ChatAtomicFlow.py)- `input_interface_non_initialized`: The input interface when the conversation is not initialized.- `input_interface_initialized`: The input interface when the conversation is initialized.- `output_interface`: The output interface.- `backend`: The backend to use for the Chat API.- `system_message_prompt_template`: The template for the system message prompt.- `human_message_prompt_template`: The template for the human message prompt.- `init_human_message_prompt_template`: The initial human message prompt.<a id="PlanGeneratorAtomicFlow.PlanGeneratorAtomicFlow.__init__"></a>#### \_\_init\_\_```pythondef __init__(**kwargs)```This function instantiates the class.**Arguments**:- `kwargs` (`Dict[str, Any]`): The configuration parameters.<a id="PlanGeneratorAtomicFlow.PlanGeneratorAtomicFlow.instantiate_from_config"></a>#### instantiate\_from\_config```python@classmethoddef instantiate_from_config(cls, config)```This function instantiates the class from a configuration.**Arguments**:- `config` (`Dict[str, Any]`): The configuration.**Returns**:`ChatAtomicFlow`: The instantiated class.<a id="PlanGeneratorAtomicFlow.PlanGeneratorAtomicFlow.run"></a>#### run```pythondef run(input_data: Dict[str, Any]) -> Dict[str, Any]```This function runs the flow.**Arguments**:- `input_data` (`Dict[str, Any]`): The input data.**Returns**:`Dict[str, Any]`: The output data.<a id="run"></a># run<a id="__init__"></a># \_\_init\_\_
PlanGeneratorAtomicFlow.py+37
README.md+69