add api info configure
Browse files3 unmodified lines45677891012 unmodified lines2324252627282930313233343536373832394041423 unmodified lines
from aiflows.backends.api_info import ApiInfofrom aiflows.messages import InputMessagefrom aiflows.utils.general_helpers import read_yaml_filefrom aiflows.utils.general_helpers import read_yaml_file, quick_load
from 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 information quick_load(cfg, api_information)
CodeGenFlow = hydra.utils.instantiate(cfg, _recursive_=False, _convert_="partial")
with os.path.join(current_dir, "example_library.py") as f: with open(os.path.join(current_dir, "example_library.py"), 'w') as f: pass
memory_files = {"code_library": os.path.join(current_dir, "example_library.py")}run.py+9-2