add api info configure
Browse files3 unmodified lines4567891012 unmodified lines232425262728293031323334353 unmodified linesfrom aiflows.backends.api_info import ApiInfofrom aiflows.messages import InputMessagefrom aiflows.utils.general_helpers import read_yaml_filefrom aiflows import loggingfrom aiflows.flow_cache import CACHING_PARAMETERS, clear_cache12 unmodified linesflow_verse.sync_dependencies(dependencies)if __name__ == "__main__":current_dir = os.getcwd()cfg_path = os.path.join(current_dir, "CodeGeneratorAtomicFlow.yaml")cfg = read_yaml_file(cfg_path)CodeGenFlow = hydra.utils.instantiate(cfg, _recursive_=False, _convert_="partial")with os.path.join(current_dir, "example_library.py") as f:passmemory_files = {"code_library": os.path.join(current_dir, "example_library.py")}3 unmodified lines4567891012 unmodified lines23242526272829303132333435363738394041423 unmodified linesfrom aiflows.backends.api_info import ApiInfofrom aiflows.messages import InputMessagefrom aiflows.utils.general_helpers import read_yaml_file, quick_loadfrom aiflows import loggingfrom aiflows.flow_cache import CACHING_PARAMETERS, clear_cache12 unmodified linesflow_verse.sync_dependencies(dependencies)if __name__ == "__main__":# ~~~ make sure to set the openai api key in the envs ~~~key = os.getenv("OPENAI_API_KEY")api_information = [ApiInfo(backend_used="openai", api_key=os.getenv("OPENAI_API_KEY"))]current_dir = os.getcwd()cfg_path = os.path.join(current_dir, "CodeGeneratorAtomicFlow.yaml")cfg = read_yaml_file(cfg_path)# configuring api informationquick_load(cfg, api_information)CodeGenFlow = hydra.utils.instantiate(cfg, _recursive_=False, _convert_="partial")with open(os.path.join(current_dir, "example_library.py"), 'w') as f:passmemory_files = {"code_library": os.path.join(current_dir, "example_library.py")}
run.py+9-2