| | import os |
| |
|
| | import hydra |
| |
|
| | from aiflows.backends.api_info import ApiInfo |
| | from aiflows.messages import InputMessage |
| | from aiflows.utils.general_helpers import read_yaml_file |
| |
|
| | from aiflows import logging |
| | from aiflows.flow_cache import CACHING_PARAMETERS, clear_cache |
| | from aiflows.utils.general_helpers import quick_load |
| |
|
| | CACHING_PARAMETERS.do_caching = False |
| | |
| |
|
| | logging.set_verbosity_debug() |
| | logging.auto_set_dir() |
| |
|
| | dependencies = [ |
| | {"url": "Tachi67/ContentWriterFlowModule", "revision": "main"}, |
| | {"url": "Tachi67/InteractivePlanGenFlowModule", "revision": "main"}, |
| | {"url": "Tachi67/PlanWriterFlowModule", "revision": "main"}, |
| | {"url": "aiflows/ChatFlowModule", "revision": "297c90d08087d9ff3139521f11d1a48d7dc63ed4"}, |
| | ] |
| |
|
| | from aiflows import flow_verse |
| |
|
| | flow_verse.sync_dependencies(dependencies) |
| |
|
| | if __name__ == "__main__": |
| | |
| | key = os.getenv("OPENAI_API_KEY") |
| | api_information = [ApiInfo(backend_used="openai", api_key=os.getenv("OPENAI_API_KEY"))] |
| | path_to_output_file = None |
| |
|
| | current_dir = os.getcwd() |
| | cfg_path = os.path.join(current_dir, "PlanWriterFlow.yaml") |
| | cfg = read_yaml_file(cfg_path) |
| | |
| | |
| | quick_load(cfg, api_information) |
| |
|
| | |
| | PlanWriterFlow = hydra.utils.instantiate(cfg, _recursive_=False, _convert_="partial") |
| |
|
| | |
| | plan_file_location = os.path.join(current_dir, "ExtLib_plan.txt") |
| | with open(plan_file_location, 'w') as file: |
| | pass |
| |
|
| | mem_files = {"plan": plan_file_location} |
| |
|
| | input_data = { |
| | "goal": "create a function that adds two numbers and returns the result", |
| | "memory_files": mem_files |
| | } |
| | input_message = InputMessage.build( |
| | data_dict=input_data, |
| | src_flow="Launcher", |
| | dst_flow=PlanWriterFlow.name |
| | ) |
| |
|
| | |
| | output_message = PlanWriterFlow(input_message) |
| |
|